RSAPrivateKey.fromPrimaries constructor

RSAPrivateKey.fromPrimaries(
  1. BigInt p,
  2. BigInt q, {
  3. BigInt? publicExponent,
})

Implementation

factory RSAPrivateKey.fromPrimaries(BigInt p, BigInt q,
    {BigInt? publicExponent}) {
  publicExponent ??= BigInt.from(0x01001);

  final n = p * q;

  BigInt d = publicExponent.modInverse((p - BigInt.one) * (q - BigInt.one));

  return RSAPrivateKey(n, publicExponent, d, p, q);
}