lib/symmetric_encryption/key.rb in symmetric-encryption-4.0.0 vs lib/symmetric_encryption/key.rb in symmetric-encryption-4.0.1

- old
+ new

@@ -10,25 +10,25 @@ # Configuration keys: # * key # * encrypted_key # * key_filename def self.from_config(key: nil, key_filename: nil, encrypted_key: nil, key_env_var: nil, - iv:, key_encrypting_key: nil, cipher_name: 'aes-256-cbc') + iv:, key_encrypting_key: nil, cipher_name: 'aes-256-cbc') if key_encrypting_key.is_a?(Hash) # Recurse up the chain returning the parent key_encrypting_key key_encrypting_key = from_config(cipher_name: cipher_name, **key_encrypting_key) end key ||= if encrypted_key - raise(ArgumentError, "Missing mandatory :key_encrypting_key when config includes :encrypted_key") unless key_encrypting_key + raise(ArgumentError, 'Missing mandatory :key_encrypting_key when config includes :encrypted_key') unless key_encrypting_key Keystore::Memory.new(encrypted_key: encrypted_key, key_encrypting_key: key_encrypting_key).read elsif key_filename Keystore::File.new(file_name: key_filename, key_encrypting_key: key_encrypting_key).read elsif key_env_var - raise(ArgumentError, "Missing mandatory :key_encrypting_key when config includes :key_env_var") unless key_encrypting_key + raise(ArgumentError, 'Missing mandatory :key_encrypting_key when config includes :key_env_var') unless key_encrypting_key Keystore::Environment.new(key_env_var: key_env_var, key_encrypting_key: key_encrypting_key).read end new(key: key, iv: iv, cipher_name: cipher_name) end @@ -99,8 +99,7 @@ openssl_cipher.iv = iv result = openssl_cipher.update(encrypted_string) result << openssl_cipher.final end - end end