Skip to content
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

Must specify an iv when adding form field #306

Closed
dessery85 opened this issue Apr 20, 2018 · 8 comments
Closed

Must specify an iv when adding form field #306

dessery85 opened this issue Apr 20, 2018 · 8 comments

Comments

@dessery85
Copy link

Hi

I have just started to use this gem to encrypt email addresses in our database. I have created a script to programatically convert values from an existing email column to a new encrypted email_address column and this works fine, both encrypting and decrypting. I am now trying to update my views to output form inputs for the new column but when i do I get the follow error:

Must specify an iv

The code I am using is:

<div class="input-field"> <%= f.label :email_address, 'Contact Email:' %> <%= f.input :email_address, label: false, :wrapper => false %> </div>

Should this work? Or do I have to just add a field with a different field name using attr_accessor on my model, then programatically save that value to my email_address property on save? I couldn't see any examples on how best to approach this.

Any guidance would be greatly appreciated!!

Many thanks

@szymonbaranowski
Copy link

szymonbaranowski commented May 4, 2018

I'm getting the same error randomly when processing encrypted values within the code (read only).
It looks like it has started happening after migrating to version 3.1.0

@saghaulor
Copy link
Contributor

@dessery85 what does your schema for that object look like?

@szymonbaranowski
Copy link

szymonbaranowski commented Jun 4, 2018

Downgraded the gem to version 3.0.3, no Must specify an iv errors present since then (around 30 errors a day when using 3.1.0 during usual load). However, it looks to me like those have been replaced by the Cipher errors, same as in #207).

@szymonbaranowski
Copy link

szymonbaranowski commented Jun 6, 2018

Yet another update from my side: I was able to reproduce the situation in the development environment by triggering multiple, heavy read-write operations on the AR objects using encrypted attributes. I also investigated production logs and there is a strong correlation between the occurrence of the Must specify an iv error and multiple simultaneous read-write operations on the AR objects.

@c-moyer
Copy link

c-moyer commented Jul 19, 2018

Any updates? Having the same issues.

@amrocco
Copy link

amrocco commented Sep 17, 2018

Any updates?

@amrocco
Copy link

amrocco commented Sep 18, 2018

@szymonbaranowski This PR looks like it could be addressing the same issue you're talking about: #320
@Admin-IT

@AnubhavMukhija
Copy link

AnubhavMukhija commented May 28, 2020

Same Error for my form

<%= form_with model: @customer, url: '/add_key' do |form| %>
  <%= form.label "API Key" %>
  <%= form.text_field(:apikey) %>
  <%= form.submit %>
<% end %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants