lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-2.0.1 vs lib/symmetric_encryption/symmetric_encryption.rb in symmetric-encryption-2.0.2
- old
+ new
@@ -243,10 +243,11 @@
if symmetric_key = (config['key'] || config['symmetric_key'])
raise "SymmetricEncryption Cannot hard code Production encryption keys in #{filename}" if (environment || Rails.env) == 'production'
cfg[:key] = symmetric_key
cfg[:iv] = config['iv'] || config['symmetric_iv']
cfg[:cipher_name] = default_cipher
+ cfg[:version] = config['version']
elsif ciphers = config['ciphers']
raise "Missing mandatory config parameter 'private_rsa_key'" unless cfg[:private_rsa_key] = config['private_rsa_key']
cfg[:ciphers] = ciphers.collect do |cipher_cfg|
@@ -294,19 +295,19 @@
# encrypted using the public key matching the supplied private_key
def self.cipher_from_encrypted_files(private_rsa_key, cipher_conf)
# Load Encrypted Symmetric keys
key_filename = cipher_conf[:key_filename]
encrypted_key = begin
- File.read(key_filename)
+ File.read(key_filename, :open_args => ['rb'])
rescue Errno::ENOENT
puts "\nSymmetric Encryption key file: '#{key_filename}' not found or readable."
puts "To generate the keys for the first time run: rails generate symmetric_encryption:new_keys\n\n"
return
end
iv_filename = cipher_conf[:iv_filename]
encrypted_iv = begin
- File.read(iv_filename) if iv_filename
+ File.read(iv_filename, :open_args => ['rb']) if iv_filename
rescue Errno::ENOENT
puts "\nSymmetric Encryption initialization vector file: '#{iv_filename}' not found or readable."
puts "To generate the keys for the first time run: rails generate symmetric_encryption:new_keys\n\n"
return
end
\ No newline at end of file