Sha256: ec6bcfea5ef6fb141dcf06d8143e41b2254509ce9dc9a5dc8d46897eedea3a36

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

# frozen_string_literal: true

module Keepassx
  module AESCrypt
    module_function

    # rubocop:disable Naming/UncommunicativeMethodParamName
    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
    # rubocop:enable Naming/UncommunicativeMethodParamName


    # rubocop:disable Naming/UncommunicativeMethodParamName
    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
    # rubocop:enable Naming/UncommunicativeMethodParamName

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
keepassx-1.0.0 lib/keepassx/aes_crypt.rb