We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I was using attr_encrypted (1.3.3) in rails 4.1 in User model with following details
attr_encrypted :email, :key => 'some_key'
After upgrading the application to rails 6 attr_encrypted bumped to attr_encrypted (3.1.0) which uses encryptor (~> 3.0.0)
in the encryptor (~> 3.0.0) new validation has been introduced
raise ArgumentError.new("key must be #{cipher.key_len} bytes or longer") if options[:key].bytesize < cipher.key_len
which raises ArgumentError (key must be 32 bytes or longer) exception
How can I keep using the existing :key => 'some_key' in attr_encrypted (3.1.0) version
The text was updated successfully, but these errors were encountered:
How about use this:
:key => 'some_key'.bytes[0..31].pack( "c" * 32 )
Sorry, something went wrong.
It's raising below error
ArgumentError (too few arguments)
How about use this: :key => 'some_key'.bytes[0..31].pack( "c" * 32 )
Works for me on rails 7.1
I changed:
attr_encrypted :email, key: Rails.application.credentials.secret_key_base
to the following:
attr_encrypted :email, key: Rails.application.credentials.secret_key_base.bytes[0..31].pack( "c" * 32 )
No branches or pull requests
I was using attr_encrypted (1.3.3) in rails 4.1 in User model with following details
attr_encrypted :email, :key => 'some_key'
After upgrading the application to rails 6 attr_encrypted bumped to attr_encrypted (3.1.0) which uses encryptor (~> 3.0.0)
in the encryptor (~> 3.0.0) new validation has been introduced
raise ArgumentError.new("key must be #{cipher.key_len} bytes or longer") if options[:key].bytesize < cipher.key_len
which raises ArgumentError (key must be 32 bytes or longer) exception
How can I keep using the existing :key => 'some_key' in attr_encrypted (3.1.0) version
The text was updated successfully, but these errors were encountered: