Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #9980 from stouset/patch-1
Browse files Browse the repository at this point in the history
Improve poor security recommendation in docs

[ci skip]
  • Loading branch information
pixeltrix committed Apr 26, 2013
2 parents 11e23b9 + 9ec0cf8 commit 051d289
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions activesupport/lib/active_support/message_encryptor.rb
Expand Up @@ -12,10 +12,11 @@ module ActiveSupport
# This can be used in situations similar to the <tt>MessageVerifier</tt>, but
# where you don't want users to be able to determine the value of the payload.
#
# key = OpenSSL::Digest::SHA256.new('password').digest # => "\x89\xE0\x156\xAC..."
# crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
# crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
# salt = SecureRandom.random_bytes(64)
# key = ActiveSupport::KeyGenerator.new('password').generate_key(salt) # => "\x89\xE0\x156\xAC..."
# crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
# crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
class MessageEncryptor
module NullSerializer #:nodoc:
def self.load(value)
Expand Down

0 comments on commit 051d289

Please sign in to comment.