attr-encrypted

Validation of encrypted data

给你一囗甜甜゛ 提交于 2019-12-25 03:55:37
问题 I encrypt all private data of users before storing in database with help of gem 'attr_encrypted'. For example, I have 'email_addresses' table, which contains 'encrypted_email' column. This gem decrypt data when I call object.email or when I search by emails. But I have issues with validation of this column. I have following validations for this and other tables: validates_length_of :email, :within => 3..100 validates_numericality_of :post_code I should decrypt data before validation somehow,

Upgrading from attr_encrypted and Vault-rails for same key

孤街醉人 提交于 2019-12-13 06:31:06
问题 I was using attr_encrypted mechanism previously, attr_encrypted :ssn, key: :encryption_key, algorithm: 'bf-cfb', mode: :single_iv_and_salt, insecure_mode: true and I upgraded it to vault-rails : include Vault::EncryptedModel vault_attribute :ssn I want to keep both in a way that, if some data is already saved using attr_encrypted then use that, and use vault for new user or if any old user is updating their data. 来源: https://stackoverflow.com/questions/53498689/upgrading-from-attr-encrypted

must specify an iv attr_encrypted, how to check login and password

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 03:29:47
问题 Hi have the following model: class User < ActiveRecord::Base secret_key = ENV['DB_COL_ENCRYPTED_KEY'] attr_encrypted :email, :key => secret_key attr_encrypted :password, :key => secret_key [...] end Where I added the 4 cols to my model rails g migration AddEncryptedColumnsToUser encrypted_email:string encrypted_password:string encrypted_email_iv:string encrypted_password_iv:string Now I want to check if email and password are correct, but I don't know how to process: secret_key_data = "my big