getEncrypter function
Implementation
encrypt.Encrypter? getEncrypter(String publicKeyPem) {
try {
final parser = RSAKeyParser();
final RSAPublicKey publicKey = parser.parse(publicKeyPem) as RSAPublicKey;
final encrypter = encrypt.Encrypter(encrypt.RSA(publicKey: publicKey));
return encrypter;
} catch (e) {
print('Failed to parse public key: $e');
return null;
}
}