encryptRSAKeyUsing method

  1. @override
Future<String> encryptRSAKeyUsing(
  1. String publicKey,
  2. String rsaPrivateKey
)
override

Implementation

@override
Future<String> encryptRSAKeyUsing(String publicKey, String rsaPrivateKey) async {
  final RSAPublicKey myPublicKey = publicKey.toPublicKey();

  final encryptorForMe = pointy.OAEPEncoding(pointy.RSAEngine())
    ..init(true, pointy.PublicKeyParameter<pointy.RSAPublicKey>(myPublicKey.asPointyCastle));

  return encryptorForMe.process(rsaPrivateKey.fromHexString()).toHexString();
}