encrypt method

String encrypt(
  1. String plaintext,
  2. RSAPublicKey publicKey
)

Implementation

String encrypt(String plaintext, RSAPublicKey publicKey) {
  var cipher = new RSAEngine()
    ..init(true, new PublicKeyParameter<RSAPublicKey>(publicKey));
  var cipherText =
      cipher.process(new Uint8List.fromList(plaintext.codeUnits));

  return new String.fromCharCodes(cipherText);
}