class ActiveRecord::Coders::Encryptors::AES

Attributes

cipher[R]
options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/active_record/coders/encryptors/aes.rb, line 5
def initialize(options = {})
  password = options[:password]
  key_length = options[:key_length] || 256
  binary = !!options[:binary]

  @cipher = ::Gibberish::AES.new(password, key_length)
  @options = { binary: binary }
end

Public Instance Methods

dump(data) click to toggle source
# File lib/active_record/coders/encryptors/aes.rb, line 14
def dump(data)
  cipher.encrypt(data, options) if data && !data.empty?
end
load(data) click to toggle source
# File lib/active_record/coders/encryptors/aes.rb, line 18
def load(data)
  cipher.decrypt(data, options) if data
end