loadPublicKey static method
return a publicKey from hex string
Implementation
static ECPublicKey loadPublicKey(String storedkey) {
final param = ECCurve_secp256k1();
if (storedkey.length < 120) {
List<int> codeList = [];
for (var _idx = 0; _idx < storedkey.length - 1; _idx += 2) {
final hexStr = storedkey.substring(_idx, _idx + 2);
codeList.add(int.parse(hexStr, radix: 16));
}
final Q = param.curve.decodePoint(codeList);
return ECPublicKey(Q, param);
} else {
final x = BigInt.parse(storedkey.substring(0, 64), radix: 16);
final y = BigInt.parse(storedkey.substring(64), radix: 16);
final Q = param.curve.createPoint(x, y);
return ECPublicKey(Q, param);
}
}