aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2013-04-19 10:27:35 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2013-04-19 10:27:35 -0700
commiteaec0ec71f00f76f47811fc2f27761c7a73056b9 (patch)
tree9896ff811f86329bb635617d400854f6d0efa6db /activesupport/lib/active_support
parent082c90da988ed8f35d9f91d047663da7b72d9245 (diff)
parent0920d4fccbfc41b6ccdae7070758fc2133280409 (diff)
downloadrails-eaec0ec71f00f76f47811fc2f27761c7a73056b9.tar.gz
rails-eaec0ec71f00f76f47811fc2f27761c7a73056b9.tar.bz2
rails-eaec0ec71f00f76f47811fc2f27761c7a73056b9.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/message_encryptor.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/message_encryptor.rb b/activesupport/lib/active_support/message_encryptor.rb
index ce40a7d689..96025e7614 100644
--- a/activesupport/lib/active_support/message_encryptor.rb
+++ b/activesupport/lib/active_support/message_encryptor.rb
@@ -28,7 +28,7 @@ module ActiveSupport
end
class InvalidMessage < StandardError; end
- OpenSSLCipherError = OpenSSL::Cipher.const_defined?(:CipherError) ? OpenSSL::Cipher::CipherError : OpenSSL::CipherError
+ OpenSSLCipherError = OpenSSL::Cipher::CipherError
# Initialize a new MessageEncryptor. +secret+ must be at least as long as
# the cipher key size. For the default 'aes-256-cbc' cipher, this is 256
@@ -66,12 +66,11 @@ module ActiveSupport
def _encrypt(value)
cipher = new_cipher
- # Rely on OpenSSL for the initialization vector
- iv = cipher.random_iv
-
cipher.encrypt
cipher.key = @secret
- cipher.iv = iv
+
+ # Rely on OpenSSL for the initialization vector
+ iv = cipher.random_iv
encrypted_data = cipher.update(@serializer.dump(value))
encrypted_data << cipher.final