module Keepassx::AESCrypt

Public Instance Methods

decrypt(encrypted_data, key, iv, cipher_type) click to toggle source

rubocop:disable Naming/MethodParameterName

# File lib/keepassx/aes_crypt.rb, line 8
def decrypt(encrypted_data, key, iv, cipher_type)
  aes = OpenSSL::Cipher.new(cipher_type)
  aes.decrypt
  aes.key = key
  aes.iv  = iv unless iv.nil?
  aes.update(encrypted_data) + aes.final
end
encrypt(data, key, iv, cipher_type) click to toggle source

rubocop:disable Naming/MethodParameterName

# File lib/keepassx/aes_crypt.rb, line 19
def encrypt(data, key, iv, cipher_type)
  aes = OpenSSL::Cipher.new(cipher_type)
  aes.encrypt
  aes.key = key
  aes.iv  = iv unless iv.nil?
  aes.update(data) + aes.final
end