-
Notifications
You must be signed in to change notification settings - Fork 7.3k
AES256 decipher yields corrupted data #738
Comments
The issue is with the base64 encoding. If you change to hex, the problem goes away. |
It happens if the input is longer than 15 characters. |
Replicated under 0.4.2 with the same My hunch is that the issue is in
but if you forego the
That is, with |
I just noticed lines 99-100 of test-crypto:
Does |
likely a different symptom of the same base64 bug: when each of following three plaintext lines are encrypted then decrypted:
result are:
lengths are 52, 53, 54 and only the last one gets full original text back. Problem appears to be in base64 because encrypted text are same length for first two. |
Looking at file Unless I'm mistaken, this is not how base64 BIO was designed to be used as you concatenating multiple independently encoded base64 fragments won't make it whole with paddings getting in the way. Come to think of it, I think As to why 'hex' encoding works, it's handled entirely by an local function |
It probably makes sense to add native base64 support to the crypto lib and just use that. Seems like too many apps are reinventing base64 for no good reason. |
I made a simple little non-native wrapper around https://github.com/TrevorBurnham/cipherpipe All of the above examples work in it, and it generates base64-encoded output. However, its functionality is much more limited than |
I would hope to see a non openssl solution in the future.. |
Hi guys, |
Hi, I just tried pasting the changes you made to node_crypto.cc, but this still fails unfortunately. |
Will do, thanks |
I have added #1395 |
The AES256 decipherer seems broken for certain inputs. This code reproduces the problem (tested against v0.4.1):
The text was updated successfully, but these errors were encountered: