rsaPrivateEncrypt static method
rsa加密
privateKey rsa私钥
data 需要加密的内容
Implementation
static String? rsaPrivateEncrypt(String privateKey, String data ) {
try {
RSAPrivateKey key = RSAKeyParser().parse(privateKey) as RSAPrivateKey;
var encrypter = Encrypter(RSA(privateKey: key));
var encrypted = encrypter.encrypt(data);
return encrypted.base64;
} catch (e) {
return null;
}
}