Research Article

Distributed Blockchain-Based Authentication and Authorization Protocol for Smart Grid

Algorithm 5

Login.
Input
OutputTrue or False
1: contractAddress = loadAuthenticationAddr();
2: auth = Authentication.load (contractAddress);
3: result = auth.select(accountId);
4: ifthen
5:  Verify the validity of the account data on the blockchain
6:  String tmpPublicKey = result. getValue2();
7:  String UserInfo = result. getValue3();
8:  String tmpsigdata = result. getValue4();
9:  Get cryptographic suite cSuite = new CryptoSuite (CryptoType.ECDSATYPE);
10:  String tmpdata = + +
11:  String hashData =
12:  Boolean nVer =
13:  ifthen
14:   Generate a token to be signed by the user
15:   Long timeStamp = System.currentTimeMillis();
16:    = + + ;
17:    =
18:   Verify the validity of token data
19:   ifthen
20:    
21:    
22:    ifthen
23:     returnTrue
24:    end if
25:   end if
26:  end if
27: end if
28: returnFalse