Abstract The attribute-based encryption (ABE) scheme is suitable for access control of ciphertext in cloud computing. Kowalczyk and Wee proposed an adaptively secure attribute encryption scheme that supports $NC^1$ circuits. However, the circuit depth increases because this scheme supports only circuits with fan-in 2, which increases the key length and computational complexity of the key generation and decryption algorithms. To improve efficiency, we designed a secret sharing scheme for circuits with fan-in $n$, and we proposed a key-policy ABE scheme that supports circuits with fan-in $n$. We also designed pebbling rules for secret sharing in circuits with fan-in $n$, improving the compactness of the security reduction. Finally, we proved the adaptive security of the scheme by using a piecewise guessing framework and dual-system encryption. Compared with existing schemes, our scheme reduces the key size, improves the efficiency of the key generation algorithm and the decryption algorithm and provides tighter security reduction.