RSADecryptionEngine constructor

RSADecryptionEngine(
  1. RSAPrivateKey key
)

Implementation

factory RSADecryptionEngine(RSAPrivateKey key) {
  final bitSize = key.n.bitLength;
  final blockSize = (key.n.bitLength + 7) >> 3;
  BigInt pSub1 = (key.p - BigInt.one);
  BigInt qSub1 = (key.q - BigInt.one);
  BigInt dP = key.d.remainder(pSub1);
  BigInt dQ = key.d.remainder(qSub1);
  BigInt qInv = key.q.modInverse(key.p);

  return RSADecryptionEngine._(key, dP, dQ, qInv, blockSize, bitSize);
}