Research Article

Smart Contract-Based Cross-Domain Authentication and Key Agreement System for Heterogeneous Wireless Networks

Table 4

Register to the smart contract.

Algorithm 2 register

function AP_Register (id, pk)
% AP node invokes the function to register to CA.
 If(AP_node[id] = NULL) % id has not been registered.
  AP_node[id] = sender.addr; len ++;
  ap[id] = = { id, pk, NUL, NUL, NUL};
function CA_Confirm(id, t_begin, t_end, sig)
% CA invokes the function to confirm the registration of AP by writing the t_begin, t_end and signature sig to the contract.
 if(sender.pk = = owner) % Guarantee only CA can invoke the function.
 ap[id]. T_begin = t_begin;
 ap[id]. T_end = t_end;
 ap[id].sig = sig;
function user_Register (hash)
% CA invokes the function to write the hash of user public key to the contract.
 if(sender.addr = = owner) % Guarantee only CA can invoke the function.
  User[hash] = true;
function getAP(id)
% invoked to obtain the public key of an AP.
 return ap[id];
function user_Verificate (hash)
% Invoked by someone to check a certain hash is registered or not.
 if(user[hash])
  return true;
 else return false;