Research Article

A Fine-Grained IoT Data Access Control Scheme Combining Attribute-Based Encryption and Blockchain

Algorithm 1

Data Storage.
 Begin
  policy ⟵ (Owner, file)
  if key not exist then
   key = AES. Gen(Owner)
  end if
  encfile = AES. Enc(key, file)
  hashipfs = IPFS. Store(encfile)
  hashfile = SHA256. Hash(file)
  StoreCont(hashfile, hashipfs, policy)
  if PK, MK not exist then
   PK, MK=CPABE. Setup(r)
  end if
  enckey = CPABE. Encrypt(PK, key, policy)
 End