-
Notifications
You must be signed in to change notification settings - Fork 1
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
ArgumentError: must specify an iv #1
Comments
Hey @jbrown296, I think you might be missing an option: https://github.com/attr-encrypted/encryptor/blob/master/lib/encryptor.rb#L45-L47 In your migration you've written this line of code: The example project in the REAME didn't require that option but it looks like your project does. It should just be a case of adding the |
Hi @tomkadwill, I added the The result is the method not recognizing I'm going to drop the traces in here as well. It might be overkill but better all the info than not enough. Here is the trace below:
I tried to drop the string in without the
Funny, it's screaming about an escape but when I escape the I did check out the https://github.com/attr-encrypted/encryptor/blob/master/lib/encryptor.rb#L45-L47 and see the |
Thanks for the detailed report @jbrown296, it looks like my gem doesn't accept the It requires a change here: https://github.com/tomkadwill/encryption_migrator/blob/master/lib/encryption_migrator.rb#L26-L40 And also one here: https://github.com/tomkadwill/encryption_migrator/blob/master/lib/encryption_migrator.rb#L8-L12 Would it be possible for you to create a sample application that re-produce your problem? That way I can easily fix the problem and test that it works with your sample app. Alternatively you could try to change those methods to add in |
Hi @tomkadwill, I threw up a quick app here: https://github.com/jbrown296/toy_app/ So, the sample app has the gem but does not have the "unencrypt" migration, obviously, because it won't migrate. The user model names are encrypted. Check it out and let me know what you think. And then I read your entire message... I will take a look at where the changes could be made if I can get to it within the next couple of days. |
Hi @tomkadwill, I cannot seem to configure this properly. Any luck on your end? |
Hey @jbrown296, I haven't had time to look at this yet. I'll try to make some time this weekend |
Hi @jbrown296, I've had another look at this today. I've modified the code so that it accepts an IV but the problem I've got is that I don't know how to read the unencrypted IV. For example, this code works:
In this case, I know the iv value and I so I can decrypt the value. However, in your example app. I don't know the IV. My understanding is that the IV is assigned randomly each time. Here is some example code:
Even if I try to assign the IV, I can't read the encrypted value, using the IV. As I said, I think this is because it's assigning a random IV. Do you have any ideas about this? If not, I'll raise an issue on the attr-encrypted gem to see if they can help |
I'm having an unexpected error and am pretty stumped here. I'm pretty new to Rails so maybe I am missing something simple.
I want to revert the encrypted field of date_of_birth on my Users model so I followed the ReadMe.
I'm using:
attr_encrypted (3.0.3)
encryptor (3.0.0)
encryption_migrator (0.1.0)
After I installed the gem, I commented out the attr_encrypted attribute:
# attr_encrypted :date_of_birth, key: ENV["USER_DOB"]
I then ran the following migration:
So far, so good.
However, when I run rake db:migrate I get an error that I "must specify an iv." I am dropping the trace below. Any help is appreciated. Thanks!!
The text was updated successfully, but these errors were encountered: