Fog computing in IoT networks provides many advantages, such as less latency and more quality of network resource management in comparison to cloud-based IoT. Although there is an important performance in this technology, fog computing confronts some security challenges in using access control and data encryption. Therefore, ciphertext policy attribute-based encryption (CP-ABE) is one of the most suitable models that can be used in fog computing to overcome these security challenges. To this end, in this thesis, we propose a new model based on CP-ABE and permissioned blockchain. In our method, the Shamir secret sharing algorithm is used to distribute the keys among the authorities and in the permissioned blockchain platform. In this model, Fog servers keys are distributed in the blockchain, based on established rules in smart contracts. The end-users’ keys are also distributed among authorities. This process provides a distributed multi-authorities structure to reduce the risk of security attacks that are occurred by compromising the authorities. Furthermore, the outsourcing of the decryption phase to the fog layer provides quality and security in the proposed model. The security of the proposed model is proven by designing a security model based on the q-linear Diffie-Hellman assumption. The proposed model is robust against some security attacks, such as the collusion attack. The resilience of the model is compared with three state-of-the-art approaches. Storage and computing overhead orders are also calculated to evaluate the system performance. The security and performance analysis show that the proposed model has a suitable performance.