lib/symmetric_encryption/keystore.rb in symmetric-encryption-4.1.0.beta1 vs lib/symmetric_encryption/keystore.rb in symmetric-encryption-4.1.0

- old
+ new

@@ -70,11 +70,11 @@ cipher_name = config[:cipher_name] || 'aes-256-cbc' keystore_class = keystore ? constantize_symbol(keystore) : keystore_for(config) - args = { + args = { cipher_name: cipher_name, app_name: app_name, version: version, environment: environment } @@ -102,11 +102,11 @@ config = cfg[:ciphers].first # Only generate new keys for keystore's that have a key encrypting key next unless config[:key_encrypting_key] - version = config.delete(:version) || 1 + version = config.delete(:version) || 1 version -= 1 always_add_header = config.delete(:always_add_header) encoding = config.delete(:encoding) @@ -115,11 +115,11 @@ # The current data encrypting key without any of the key encrypting keys. key = Keystore.read_key(config) cipher_name = key.cipher_name keystore_class = keystore_for(config) - args = { + args = { cipher_name: cipher_name, app_name: app_name, version: version, environment: environment, dek: key @@ -139,18 +139,18 @@ # The default development config. def self.dev_config { ciphers: - [ - { - key: '1234567890ABCDEF', - iv: '1234567890ABCDEF', - cipher_name: 'aes-128-cbc', - version: 1 - } - ] + [ + { + key: '1234567890ABCDEF', + iv: '1234567890ABCDEF', + cipher_name: 'aes-128-cbc', + version: 1 + } + ] } end # Returns [Key] by recursively navigating the config tree. # @@ -217,26 +217,25 @@ # Backward compatibility - Deprecated private_rsa_key = config.delete(:private_rsa_key) # Migrate old encrypted_iv if (encrypted_iv = config.delete(:encrypted_iv)) && private_rsa_key - encrypted_iv = RSAKey.new(private_rsa_key).decrypt(encrypted_iv) - config[:iv] = ::Base64.decode64(encrypted_iv) + encrypted_iv = RSAKey.new(private_rsa_key).decrypt(encrypted_iv) + config[:iv] = ::Base64.decode64(encrypted_iv) end # Migrate old iv_filename - if (file_name = config.delete(:iv_filename)) && private_rsa_key + if (file_name = config.delete(:iv_filename)) && private_rsa_key encrypted_iv = ::File.read(file_name) config[:iv] = RSAKey.new(private_rsa_key).decrypt(encrypted_iv) end # Backward compatibility - Deprecated config[:key_encrypting_key] = RSAKey.new(private_rsa_key) if private_rsa_key # Migrate old encrypted_key to new binary format - if (encrypted_key = config[:encrypted_key]) && private_rsa_key + if (encrypted_key = config[:encrypted_key]) && private_rsa_key config[:encrypted_key] = ::Base64.decode64(encrypted_key) end end - end end