class EncryptedField::PolicyWithoutIV

EncryptedField::PolicyWithoutIV all the logic required to encrypt/decrypt data using symmetric encryption.

Public Instance Methods

decrypt(encrypted_str) click to toggle source
# File lib/encrypted-field/policy_without_iv.rb, line 15
def decrypt(encrypted_str)
  cipher = create_cipher.decrypt
  cipher.key = secret_key
  cipher.update(decode_payload(encrypted_str)) << cipher.final
end
encrypt(str) click to toggle source
# File lib/encrypted-field/policy_without_iv.rb, line 9
def encrypt(str)
  cipher = create_cipher.encrypt
  cipher.key = secret_key
  encode_payload(cipher.update(str) << cipher.final)
end