ZotPrivateKey constructor

ZotPrivateKey(
  1. int bitLen,
  2. ZotKeyPair zotKeyPair,
  3. Encrypto encrypto
)

Implementation

ZotPrivateKey(int bitLen, ZotKeyPair zotKeyPair, Encrypto encrypto) {
  BigInt p = randomPrimeBigInt(bitLen), q = randomPrimeBigInt(bitLen);
  BigInt n = p * q, pm1 = p - BigInt.one, qm1 = q - BigInt.one;
  _on = pm1 * qm1;
  BigInt e = randomPrimeBigInt(bitLen);
  _d = e.modInverse(_on);
  _assetEq(((e * _d) % _on));
  zotKeyPair.publicKey = ZotPublicKey(e, n);
  encrypto.keyPair = zotKeyPair;
}