Closed maxmcd closed 10 years ago
Interesting, what is the rails version that you're using?
4.1.4
Looks like the IV should be 16 bytes in size, I don't know why it's 17 bytes in your case! I'm using 4.1.4
as well and never had this problem.
If you're getting the correct data, then I think it's a good change and a pull request is very welcome so others don't get this error.
Thanks.
Weird. Well, it is continuing to work for me after a bunch of testing. I'll open this up if anything goes wrong in production.
Pull request submitted.
And no problem, thanks for writing this awesome utility, saved me a lot of time.
Ok, thanks for the pull request and I'm glad to hear it's been helpful to you :)
Getting an invalid key length warning.
Changed this line: https://github.com/smirzaei/rails-session-decoder/blob/master/index.js#L40
To this:
var decipher = crypto.createDecipheriv('aes-256-cbc', derivedKey.slice(0, 32), iv.slice(0, 16));
To force the key length to length 16.
This seems to work, and returns the correct data, although I'm not sure why. Not an issue for now, but figured I would let you know.
Edit: full error trace: