encrypt
encrypt copied to clipboard
how to parse private key directly instead from a .pem file?
final privKey = RSAKeyParser().parse( "private key");
final encrypter = Encrypter(RSA(privateKey: privKey)); **//here it gives me error, because RSAKeyParser().parse() returns RSAAsymmetricKey**
You need to cast it to RSAPrivateKey
. To do that you need to add a direct dependency to pointycastle.
import 'package:pointycastle/asymmetric/api.dart';
private = RSAKeyParser().parse(key_string) as RSAPrivateKey
A direct function like RSAKeyParser().parsePrivateKey()
would've been a nice addition @leocavalcante
Is anyone working on that?