rsaEncrypt static method

String rsaEncrypt(
  1. String message,
  2. RSAPublicKey publicKey
)

Encrypt the given message using the given RSA publicKey.

Implementation

static String rsaEncrypt(String message, RSAPublicKey publicKey) {
  var cipher = RSAEngine()
    ..init(true, PublicKeyParameter<RSAPublicKey>(publicKey));
  var cipherText = cipher.process(Uint8List.fromList(message.codeUnits));

  return String.fromCharCodes(cipherText);
}