Class: ActionEncrypt::EncryptedField

Inherits:
ApplicationRecord show all
Defined in:
app/models/action_encrypt/encrypted_field.rb

Instance Method Summary collapse

Instance Method Details

#encryption_keyObject



8
9
10
11
# File 'app/models/action_encrypt/encrypted_field.rb', line 8

def encryption_key
  self.data_encryption_key ||= DataEncryptionKey.primary
  [data_encryption_key.key].pack("H*")
end

#reencrypt!(new_key) ⇒ Object



13
14
15
# File 'app/models/action_encrypt/encrypted_field.rb', line 13

def reencrypt!(new_key)
  update_attributes!(data_encryption_key: new_key, blob: blob)
end