Research Article

A2 Chain: A Blockchain-Based Decentralized Authentication Scheme for 5G-Enabled IoT

Algorithm 3

Authentication mechanism.
Initialization phase
(1)if (DMID.exist = true) then
(2)        return error()
(3)else
(4)        creat.block(DID, DMID,parameters, Ppub, Domian_Chain)
(5)        creat.block(DID, DMID, Block_num, Alliance_Chain)
(6)end if
Registration phase
(1)if (DID.exist = true) then
(2)      get(parameters, Ppub)
(3)      If (TDID.exist = false) then
(4)             If (Sig.TDID = valid) then
(5)                     creat.block
(6)                     creat.block
(7)                     reg_sucess
(8)              end if
(9)       end if
(10)else
(11)        return error()
(12)end if
Intradomain authentication
(1)if (DMID.exist = true) then
(2)       get(parameters, Ppub)
(3)       if (TDID.exist&LT = true) then
(4)              if (Hash(Sig.DMID)&Sig.TDID = valid) then
(5)                     return auth_sucess
(6)               end if
(7)       end if
(8)else
(9)       return error()
(10)end if
Cross-domain authentication
(1)if (DMID.exist&TDID.exit = true) then
(2)       get(parameters, Ppub)
(3)       DMID.Merkle_Path = getDomainChainPath(DMID.Block_num)
(4)       DMID.Merkle_Root = getDomainChainPath(DMID.Block_num)
(5)       DMID.Merkle_hash = computeMerkleTree(DMID_info, Merkle_Path)
(6)       if (DMID.Merkle_hash = DMID.Merkle_Root) then
(7)             TDID.Merkle_Path = getDomainChainPath(TDID.Block_num)
(8)             TDID.Merkle_Root = getDomainChainRoot(TDID.Block_num)
(9)             TDID.Merkle_hash = computeMerkleTree(TDID_info, Merkle_Path)
(10)              if (TDID.Merkle_hash = TDID.Merkle_Root) then
(11)                     if (Sig.TDID)&cross_authorization = valid) then
(12)                            return auth_sucess
(13)                      end if
(14)              end if
(15)      end if
(16)else
(17)      return error()
(18)end if