rsaPrivateDecrypt static method
rsa解密
privateKey rsa 私钥
data 需要解密的base64内容
Implementation
static String? rsaPrivateDecrypt(String privateKey, String data) {
try {
RSAPrivateKey key = RSAKeyParser().parse(privateKey) as RSAPrivateKey;
AsymmetricBlockCipher cipher = PKCS1Encoding(RSAEngine());
cipher.init(false, PrivateKeyParameter<RSAPrivateKey>(key));
List<int> sourceBytes = base64Decode(data);
var process = cipher.process(Uint8List.fromList(sourceBytes));
return utf8.decode(process);
} catch (e) {
return null;
}
}