encrypt static method
Implementation
static String encrypt(String content, {String? encryptType}) {
if (encryptType == "RSA") {
String pk = "-----BEGIN PUBLIC KEY-----\n" +
Authing.sRASPublicKey +
"\n" +
"-----END PUBLIC KEY-----";
RSAPublicKey publicKey = RSAKeyParser().parse(pk) as RSAPublicKey;
final encrypter = Encrypter(RSA(publicKey: publicKey));
return encrypter.encrypt(content).base64;
} else if (encryptType == "SM2") {
return content;
} else {
return content;
}
}