rsaDecrypt static method

String rsaDecrypt(
  1. String cipherMessage,
  2. RSAPrivateKey privateKey
)

Decrypt the given cipherMessage using the given RSA privateKey.

Implementation

static String rsaDecrypt(String cipherMessage, RSAPrivateKey privateKey) {
  var cipher = RSAEngine()
    ..init(false, PrivateKeyParameter<RSAPrivateKey>(privateKey));
  var decrypted = cipher.process(Uint8List.fromList(cipherMessage.codeUnits));

  return String.fromCharCodes(decrypted);
}