Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Getting error "Message too long for RSA (n=32, l=32)" #37

Open
tcoupe opened this issue Oct 18, 2018 · 1 comment
Open

Getting error "Message too long for RSA (n=32, l=32)" #37

tcoupe opened this issue Oct 18, 2018 · 1 comment

Comments

@tcoupe
Copy link

tcoupe commented Oct 18, 2018

I'm getting this error in RSAEncrypt when trying to do AES-CBC 256 bit encryption. I think it has to do with the age of the JavaScript engine and use of String.fromCharCode() as it relates to UTF-8 encoding, but I'm not sure.
Any ideas what's wrong?
my code is:
var Bits = 256;
RSAkey = cryptico.generateRSAKey(PassWord, Bits); // PassWord is "12340000000..." 32 characters long
PublicKeyString = cryptico.publicKeyString(RSAkey);
var ret = cryptico.encrypt(ping, PublicKeyString); // fails in here, ping is a JSON (string)

@matheograil
Copy link

According to the documentation :

bitlength: integer, length of the RSA key (512, 1024, 2048, 4096, 8192).

So 256 is a wrong value.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@tcoupe @matheograil and others