Research Article

Distributed Blockchain-Based Authentication and Authorization Protocol for Smart Grid

Algorithm 4

Registration.
Input
OutputTrue or False
1: Get cryptographic key pair cryptoKeyPair = createKeyPair();
2: String PublicKey = cryptoKeyPair.getHexPublicKey();
3: String data = AccountId + UserInfo + PublicKey;
4: Get cryptographic suite cSuite = new CryptoSuite (CryptoType.ECDSATYPE);
5: String hashData = cSuite.hash (data);
6: String sigdata = cSuite.sign (hashData, cryptoKeyPair);
7: rec = register (UserInfo, PublicKey, UserInfo, sigdata);
8: response = getRegisterEventEvents (rec);
9: ifresponse. get (0) ==0 then
10:  regFail++£» True
11:  returnTrue
12: else
13:  returnFalse
14: end if