KeyPair.generate constructor
KeyPair.generate({
- int keySize = 2048,
Implementation
KeyPair.generate({int keySize = 2048}) {
final keyPair = CryptoUtils.generateRSAKeyPair(keySize: keySize);
/**
* Pointycastle's generation is slightly more performant and secure than Ninja's so
* we use it instead and then map back to Ninja keys.
*/
final _privateKey = keyPair.privateKey as pointy_castle.RSAPrivateKey;
final _publicKey = keyPair.publicKey as pointy_castle.RSAPublicKey;
privateKey = ninja.RSAPrivateKey(_privateKey.n!, _publicKey.publicExponent!,
_privateKey.privateExponent!, _privateKey.p!, _privateKey.q!);
publicKey = ninja.RSAPublicKey(_publicKey.n!, _publicKey.publicExponent!);
}