Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any length limit for a string you encrypt? #17

Open
SilentImp opened this issue Aug 13, 2019 · 2 comments
Open

Is there any length limit for a string you encrypt? #17

SilentImp opened this issue Aug 13, 2019 · 2 comments

Comments

@SilentImp
Copy link

SilentImp commented Aug 13, 2019

Is there any length limit for a string you encrypt?

QuickEncrypt.encrypt(JSON.stringify({cookies: {"_ga": "GA1.2.1670449165.1565169702", session_id: "1d9e62e7-5dd7-44d7-89bc-e17c94be8340"}}), ENCRYPT_PUBLIC);
//Uncaught Error: Something went wrong during encryption

QuickEncrypt.encrypt(JSON.stringify({cookies: {session_id: "1d9e62e7-5dd7-44d7-89bc-e17c94be8340"}}), ENCRYPT_PUBLIC);
// "a25bf1cf404340f7b236f2585a9825e4cfd8fdc2e5966c8352c17b7a984facec76bda0e54aaea2801044c3eff461d88001f00dee1593cbd397610d289c29c79265b6c666897138d77af86f489385a892af109be120cc6aafa290ebdd2210eb8bff0ee738accbad01304c98cd9c19dba3f854afe459f149b1ae872b750a8ef9ce"

QuickEncrypt.encrypt(JSON.stringify({cookies: {"_ga": "GA1.2.1670449165.1565169702"}}), ENCRYPT_PUBLIC);
// "6deee086542e27c545cadcf6a78fcfa56e3e2cf8b8dcc42eeacec08a9735b871fad50caf3b7b1b98c774c6aacc626e4bfe8517524992999cd15fcb394d7529fd725151d00bee70b61a0ef2e9bd80c276a31da9f90305b0396fc76659a7422874294273734a1ef244b29831e09213365bed81ca5592f4cb8e3120eeeb301c1b9e"
@SilentImp
Copy link
Author

SilentImp commented Aug 13, 2019

Nope, look like it doesn't work in a browser because of lack of Buffer.
But why it still works on short strings?

86 strings are maximum:
"{"cookies":{"a":"1234567890123456789012345678901234567890123456789012345678901.23.d"}}"
will work, but add one character and you will get an error.

I have tried to add https://www.npmjs.com/package/buffer package to add Buffer to browser … but nope, no use.

@SilentImp
Copy link
Author

Due to technical limitations of the RSA algorithm the text to be encrypted must not be longer than 215 bytes when using keys with 2048 bits:

Maybe it may be somehow related?

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

No branches or pull requests

1 participant