Module: Keepassx::AESCrypt
- Defined in:
- lib/keepassx/aes_crypt.rb
Class Method Summary collapse
-
.decrypt(encrypted_data, key, iv, cipher_type) ⇒ Object
rubocop:disable Naming/MethodParameterName.
-
.encrypt(data, key, iv, cipher_type) ⇒ Object
rubocop:disable Naming/MethodParameterName.
Class Method Details
.decrypt(encrypted_data, key, iv, cipher_type) ⇒ Object
rubocop:disable Naming/MethodParameterName
8 9 10 11 12 13 14 |
# 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) ⇒ Object
rubocop:disable Naming/MethodParameterName
19 20 21 22 23 24 25 |
# 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 |