Questions tagged [attr-encrypted]
63 questions
2
votes
0 answers
Encrypt existing fields of a model with attr_encrypted Rails
I want to install the following gem https://github.com/attr-encrypted/attr_encrypted to encrypt some fields of the existing models I have. For example, a User model with first_name, last_name, etc.
My app is already deployed, so I don't want to make…

Djodjo
- 95
- 10
2
votes
0 answers
attr_encrypted gem must specify an iv - Ruby on Rails
I'm trying to encrypt two columns on my User model in Ruby on Rails. I have already successfully encrypted 6 other columns on a different table but this time I am getting the error must specify an iv only on the User table.
I am using the devise…

Cannon Moyer
- 3,014
- 3
- 31
- 75
2
votes
2 answers
Raisl 4 - attr_encrypted : How to decrypt values with select on encrypted values
We are encrypting values in table / model - RegisteredDomain, using attr_encrypted below
attr_encrypted :domain_name, :registered_by, :api_key, :key => "65xU4TdZntTV53"
Values get encrypted and stored to db as well. Below code saves values to…

Sashant Pardeshi
- 1,075
- 7
- 21
2
votes
2 answers
Using attr_encrypted to encrypt and store API token, but how to de-crypt in order to use
Building an app that pulls data from merchant's accounts on demand.
I've setup my model, installed the attr_encrypted gem, and everything is being stored properly as encrypted.
I've created a method that takes the token and sends it to the API, but…

ToddT
- 3,084
- 4
- 39
- 83
2
votes
1 answer
I am getting nil and Empty when used attr_encrypted for activerecord storage
I am using https://github.com/attr-encrypted/attr_encrypted for the encryptions of my active record for ***User model***who have following attributes.
activation_hash string
details string
email string
imei string
password string…

Fahad Idrees
- 188
- 2
- 2
- 13
2
votes
2 answers
Rails 4 encrypt foreign key
I'm building an app that requires HIPAA compliance, which, to cut to the chase, means that I can't allow for certain connections to be freely viewable in the database (patients and recommendations for them).
These tables are connected through the…

Jonathan Bender
- 1,911
- 4
- 22
- 39
2
votes
1 answer
MassAssignmentSecurity Error when using attr_encrypted (attr_encryptor) gem
For my rails 3.2.3 app, I am using attr_encryptor, which is a fork by danpal of attr_encrypted. I have followed the instructions as given here, but I am getting the following error message when I try to create a new Patient…

oort
- 1,840
- 2
- 20
- 29
1
vote
1 answer
must specify an iv error using attr_encrypted
I'm trying to add an encrypted jsonb field to my user model in rails. I'm getting an error when attempting to read or set a value.
error
irb(main):002:0> User.last.q2_email_address = "bob@bob.com"
User Load (0.4ms) SELECT "users".* FROM "users"…

Antarr Byrd
- 24,863
- 33
- 100
- 188
1
vote
1 answer
Select query adds attr_encrypted attribute in result even if not requested
I am struggling with an issue with a Rails 5.2.4.1 app.
Configuration is the following:
Ruby 2.6.5
Rails 5.2.4.1
attr_encrypted 3.1.0
I have a model called Chicken that has 2 attributes: name - which is attr_encrypted and number - which is a…

Adela Tuduce
- 41
- 2
1
vote
1 answer
how to use contents of in Rails?
I've uploaded and encrypted two images to my app, and now I need to use them in an img_tag. How can I retrieve the contents of this string and display them to the user?
Model.document_front:

calyxofheld
- 1,538
- 3
- 24
- 62
1
vote
1 answer
RSpec: Method stub in factory bot definition file
I have a model, which is using attr_encrypted gem to encrypt the password.
class Credential < ApplicationRecord
validates :user_name, presence: true
enum credential_type: { windows: 1, linux: 2 }
attr_encrypted :user_pass, key:…

Rajkaran Mishra
- 4,532
- 2
- 36
- 61
1
vote
0 answers
attr_encrypted - Updating all encrypted fields although I only changed one
I'm using the attr_encrypted gem for some user data like so:
class User < ApplicationRecord
attr_encrypted :name, key: Encryption['user_name']
attr_encrypted :date_of_birth, key: Encryption['user_date_of_birth'], marshal: true
attr_encrypted…

mhz
- 1,019
- 2
- 8
- 30
1
vote
0 answers
how to encrypt an 2 attributes with the same iv and salt in attr_encrypted?
I have 2 attributes say user_name and password. I want to encrypt both using attr_encrypted using the per_attribute_iv_and_salt mode where I store the iv and salt in the database. I dont want to use a separate iv and salt for each attribute. Is…

PiKaY
- 279
- 4
- 15
1
vote
2 answers
Gracefully re-encrypting tokens in Rails app
I inherited a Rails app that integrates with Facebook and encrypts a token sent from Facebook, which it saves as a user's identifying auth token.
For a variety of reasons, I ended up updating my Ruby, and some Gemfile changes have occurred which…

Sasha
- 6,224
- 10
- 55
- 102
1
vote
0 answers
Performing rails model validations before encrypting attribute with attr-encrypted gem
I have an encrypted attribute (let's call it @model.encrypted_attribute) in one of my models. Before adding encryption I had the following validation in my model:
validates_length_of :attribute, :minimum => 11, :maximum => 11, :allow_blank => true,…

targaf
- 125
- 6