Research Article

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

Table 3

Constructor of the smart contract.

Algorithm 1 constructor of smart contract

Structure AP_PK
% define the structure of information of AP’s public key.
 ID; % ID of an AP.
 PK; % the public key of the AP.
 T_begin; % the public key effective start time.
 T_end; % the public key expiration time.
 sig; % CA’s signature of ID, PK, T_begin, and T_end.
Structure CA_Info CA
% define the structure of information of CA. And CA, an CA_Info structure variable is public to all node
 ID_domain; % domain ID
 Basicpare; % the basic public parameter of the domain.
 PK; % the public key of CA.
 sig; % CA’s signature of ID_domain and PK.
Map(hash- > bool) user % A map denote if user is registered it returns true.
Map(ID- > AP_PK) ap % A map denote if ID is registered it returns the public key information of the node corresponding to ID.
Uint len; % the number of nodes.
function PK_domain (id, pare, pk, sig)
% constructor, it is automatically invoked when this smart contract is deployed; initialize CA and only this function can modify variable CA.
 owner = sender.addr; % Define CA is the owner of the contract.
 CA = {id, pare, pk, sig};
 len = 0;
function get_CA(·)
% Invoked to obtain the information of the domain.
 return CA;