fromPrivateKey static method

KeyPair fromPrivateKey(
  1. PrivateKey privateKey
)

Implementation

static common.KeyPair fromPrivateKey(common.PrivateKey privateKey) {
  pc.ECDomainParameters domainParams =
      pc.ECDomainParameters(privateKey.curve.name!);
  pc.ECPrivateKey pKeyEC = pc.ECPrivateKey(
      common.PDUtil.decodeBigInt(privateKey.ec(), endian: Endian.big),
      domainParams);
  pc.ECPoint Q = (domainParams.G * pKeyEC.d)!;
  return common.KeyPair(
      privateKey,
      common.PublicKey(
          common.PDUtil.encodeBigInt(Q.x!.toBigInteger()!,
              endian: Endian.big),
          common.PDUtil.encodeBigInt(Q.y!.toBigInteger()!,
              endian: Endian.big),
          privateKey.curve));
}