lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-3.0.0 vs lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-3.0.1
- old
+ new
@@ -246,10 +246,10 @@
cipher_name = cipher_cfg[:cipher_name] || cipher_cfg[:cipher]
# Generate a new Symmetric Key pair
iv_filename = cipher_cfg[:iv_filename]
- key_pair = SymmetricEncryption::Cipher.random_key_pair(cipher_name || 'aes-256-cbc', !iv_filename.nil?)
+ key_pair = SymmetricEncryption::Cipher.random_key_pair(cipher_name || 'aes-256-cbc')
if key_filename = cipher_cfg[:key_filename]
# Save symmetric key after encrypting it with the private RSA key, backing up existing files if present
File.rename(key_filename, "#{key_filename}.#{Time.now.to_i}") if File.exist?(key_filename)
File.open(key_filename, 'wb') {|file| file.write( rsa_key.public_encrypt(key_pair[:key]) ) }
\ No newline at end of file