publicKeyToHex method

  1. @override
String publicKeyToHex(
  1. PublicKey pub
)
override

publicKeyToHex converts a point on the curve into the uncompressed form specified in section 4.3.6 of ANSI X9.62.

Implementation

@override
String publicKeyToHex(PublicKey pub) {
  var byteLen = (bitSize + 7) >> 3;

  var ret = '04'; // uncompressed point

  ret += pub.X.toRadixString(16).padLeft(byteLen * 2, '0');
  ret += pub.Y.toRadixString(16).padLeft(byteLen * 2, '0');

  return ret;
}