Closed Ahmadre closed 1 year ago
I try to encrypt asymmetric with the publicKey and I get on longer bytes this:
flutter: Invalid argument(s): message too long flutter: #0 OAEPEncoding._encodeBlock (package:pointycastle/asymmetric/oaep.dart:196:7) #1 OAEPEncoding.processBlock (package:pointycastle/asymmetric/oaep.dart:167:14)
I call it like:
String asymmetricEncrypt({ Uint8List bytes, }) { const pem = '-----BEGIN PUBLIC KEY-----\n${PBKey}\n-----END PUBLIC KEY-----\n'; final publicKey = CryptoUtils.rsaPublicKeyFromPem(pem); /// Initalizing Cipher final cipher = OAEPEncoding.withSHA256(AsymmetricBlockCipher('RSA')); cipher.init(true, PublicKeyParameter<RSAPublicKey>(publicKey)); Uint8List output = cipher.process(bytes!); return base64Encode(output); }
Do you know how i can pass longer bytes? In my case I am passing the bytes of a Textfile.
Error
I try to encrypt asymmetric with the publicKey and I get on longer bytes this:
I call it like:
Do you know how i can pass longer bytes? In my case I am passing the bytes of a Textfile.