-
Notifications
You must be signed in to change notification settings - Fork 92
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
Gem complains "key must be 32 bytes" even though I give it proper keys #122
Comments
I actually just ran into this exact issue today. It's an open ssl issue. So you'll need to change your key to use |
@LaithAzer sorry but that doesn't seem to be the issue here. The new app don't complain over key length now, but gives different encryption results. New app: SymmetricEncryption.encrypt("foo") # => "QTa0QWD/CXQPnmCg8BLF2A==" Old app: SymmetricEncryption.encrypt("foo") # => "iN35mhZeB/v989ZLZqis8Q==" The manual test sides with the old app: cipher = SymmetricEncryption::Cipher.new(
key: ["b1c7d3086cb05b5056a6b30f5e55180cec6fb28ef1650ded94947787da9588c2"].pack('H*'),
iv: ["f053932542406db77f3afcbbd7ade139"].pack('H*'),
cipher_name: 'aes-256-cbc',
encoding: :base64strict,
version: 0,
always_add_header: false
)
cipher.encrypt("foo") # => "iN35mhZeB/v989ZLZqis8Q==" |
Ah ok, well that new issue seems to be more related to this gem. Sorry I can't be of more help with that. |
I'm testing symmetric-encryption 3.6.0 on ruby 2.2.7 and ruby 2.6.2. I used the script above and a different config and resulting strings matched, so I also think this is issue is related to symmetric-encryption gem upgrade. |
The same problem occurred when I upgraded ruby from 2.3.1 to 2.5.5. |
Hi guys.
I'm in the process of replacing an old Rails app with a new one.
The old app uses
ruby 2.2.2
andsymmetric-encryption 3.8.2
.The new app uses
ruby 2.4.1
andsymmetric-encryption 4.2.0
.I prefer to store my keys as hexidecimals. So in both apps my
symmetric-encryption.yml
looks like this:However my new app complains:
I've tried debugging by creating new keys, and get the same result. They keys I generate work in the old, but not the new app:
Any idea what goes wrong?
The text was updated successfully, but these errors were encountered: