Research Article

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

Algorithm 2

Data access.
Begin
  hashfile, hashipfs ⟵ QueryCont(file)
  if SK not exist then
   SK = CPABE. KeyGen (PK, MK, A)
  end if
  encfile = IPFS. Query (file, hashipfs)
  enckey = Get (Owner)
  deckey = CPABE. Decrypt (PK, enckey, SK)
  decfile = AES. Dec (deckey, encfile)
  dechash = SHA256. Hash (decfile)
  If dechash equal hashfile then
   return success
  Else
   return failure
 End