opensslDecrypt static method
Implementation
static Object? opensslDecrypt(String data, String privatekey) {
final parser = RSAKeyParser();
final encrypter = Encrypter(RSA(
privateKey: parser.parse(privatekey) as RSAPrivateKey,
digest: RSADigest.SHA256,
));
final stringChars = String.fromCharCodes(base64.decode(data));
List<int> source = stringChars.codeUnits;
String result = "";
//Assumes 1024 bit key and encrypts in chunks.
source.splitByLength(128).forEach((input) {
var encrypted = Encrypted(Uint8List.fromList(input));
var output = encrypter.decrypt(encrypted);
result += output;
});
return json.decode(result);
}