Closed lets-swapcode closed 5 years ago
@duncanhoggan can you help now ?
Hey, sure this is what i use for RSA with PKCS1 padding
static String encrypt(String text, RSAPublicKey pubKey) {
var cipher = PKCS1Encoding(RSAEngine());
cipher.init(true, PublicKeyParameter<RSAPublicKey>(pubKey));
Uint8List output1 = cipher.process(utf8.encode(text));
return base64Encode(output1);
}
static String decrypt(String input, RSAPrivateKey privateKey) {
var cipher = PKCS1Encoding(RSAEngine());
cipher.init(false, PrivateKeyParameter<RSAPrivateKey>(privateKey));
Uint8List output = cipher.process(base64Decode(input));
return utf8.decode(output);
}
Thanks alot. you saved ton of my time.
Share function code which decrypt a encrypted text using RSA (pointycastle) dart flutter.