Questions tagged [attr-encrypted]
63 questions
1
vote
2 answers
attr_encrypted and devise, Encrypt user data with users password
I'm using the attr_encrypted gem and I got also devise installed in my environment.
I got a user model this is handled by devise and the database column is:
encrypted_password
Users can save clients and I want to encrypt the clients name and age…

AME
- 2,262
- 6
- 19
- 39
1
vote
0 answers
Symmetrical encryption of email attributes with Devise authentication
I try to encrypt email attribute for User model. email is used by Devise.
class User < ActiveRecord::Base
end
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable
To encryption I use…

Leszek Andrukanis
- 2,114
- 2
- 19
- 30
1
vote
2 answers
attr_encrypted and encrypting dates generated by the date_select form helper
I'm new to rails and I am using Rails 4 and the attr_encrypted gem to encrypt some fields (SSN, names, date of birth, etc ) which will all be inserted into the database in varchar columns. In the form view, I'm using date_select to generate the date…

WillieG
- 45
- 5
1
vote
0 answers
attr_encrypted nil after saving object
My seeds.rb:
doc = Document.new(
:name => "Document"+i,
:description => "Description of Document"+i,
:content => "hello world",
:public => false
)
doc.save! #encrypted_content and content will be nil after this line
…
user3546013
1
vote
2 answers
Encrypt the Devise token
I'm using Devise with token Authentication and, now, I want to encrypt the token in the Database.
Can anyone give me a hint where devise does the storing/retrieving of the token from the DB?
I'm also using the attr_encrypted gem with which the whole…

chris h.
- 265
- 1
- 4
- 18
1
vote
2 answers
trying to decrypt attr_encrypted stored value from Java
I have a rails application that encrypts (with attr_encrypted) 2 fields in one of the models.
Another part of my process, which is not the web-application needs to perform some tasks using this data (plaintext).
I'm trying to read the stored values…

Zach Moshe
- 2,782
- 4
- 24
- 40
1
vote
1 answer
Rails encryption: danpal/attr_encryptor key generation
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…

Sash
- 4,448
- 1
- 17
- 31
1
vote
1 answer
attr_encryptor bad decrypt error
I used danpal/attr_encryptor gem to encrypt some attribute in my ActiveRecord model.
attr_encrypted :number, :charset => 'UTF-8', :key => 'vasya pupkin'
and got following error
OpenSSL::Cipher::CipherError: bad decrypt
Then I tried to use…

maxs
- 427
- 1
- 6
- 15
1
vote
1 answer
Virtual attribute is not set before attr_encrypted uses said virtual attribute for encryption key
When encryption_key is called by attr_encrypted, :passphrase hasn't been set. The encryption key ends up being a sha1 hash of the salt; it should be a sha1 hash of the passphrase and salt.
The salt is generated on creation and saved in the…

pdjk
- 13
- 2
0
votes
1 answer
gem attr_encrypted doesn't work with rails 2.3.8 + bundler?
so, when I use this gem with the config.gem method it rails 2's environment.rb file, everything is fine. I can save and read encrypted attributes.
but when I use bundler (the preferred method =D), attr_encrypted suddenly isn't able to read or write…

NullVoxPopuli
- 61,906
- 73
- 206
- 352
0
votes
1 answer
How we can decrypt data in rails raw sql query?
In rails i have used gem => attr_encrypted
using above gem data encrypted in PostgreSQL DB table.
using model name can be decrypt.
But how I can do in raw query in select query
like
i have column encrypted in table like
email encrypted and…

vikasrb
- 1
- 2
0
votes
0 answers
How to properly use the gem 'attr_encrypted' during a migration
I am adding the attr_encrypted gem to an existing model.
The problem that I am having is that the data on the migration is not converting.
When I create a new record, I do see it encrypted.
My migration looks like this.
class…

MZaragoza
- 10,108
- 9
- 71
- 116
0
votes
1 answer
Rails - decrypt attr_encrypted manually
I have a model named Contact which has sensitive information like user's mobile number and email. So I am using the gem attr_encrypted and the columns mobile_number and email are encrypted and stored by default.
While retrieving the records, the…

Suganya Selvarajan
- 962
- 1
- 11
- 33
0
votes
1 answer
In Rails 6 / FactoryBot 6, how do I simulate attr_encrypted attributes?
Recently upgraded to Rails 6 and FactoryBot 6.2.0. I have this model
class Store < ApplicationRecord
…
attr_encrypted :ein_number,
key: APP_CONFIG[:app_encryption][::Rails.env][‘secret_key’]
I have corresponding…

Dave
- 15,639
- 133
- 442
- 830
0
votes
1 answer
SecureRandom.hex() vs SecureRandom.random_bytes() for key generation in Rails with attr_encrypted
The docs for attr_encrypted say that I must store the results of key = SecureRandom.random_bytes(32) on the model. I think that it would be more secure to have this key stored as an ENV variable. I am also accustomed to running rake secret for my…

calyxofheld
- 1,538
- 3
- 24
- 62