Rails encryption: danpal/attr_encryptor key generation
-
22-06-2021 - |
Question
Using the danpal fork of attr_encrypted.
attr_encrypted :col_int, :key => 'key', :if => :encryption_required, :marshall => true
Does the 'key
' string generate a new object with a new session? Since I have ran into a problem where I have created an instance with the encrypted value and it works fine. However when I run a new rails console session or for example try and access the value through a view I get a bad decrypt
error. I am guessing it is related to having an incorrect key? As in the new session will pass a different string object as the key?
Is there anyway to avoid this?
Solution
Problem was in not reading the documentation, an extra col_int_salt
and col_int__iv
columns are required
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow