method

decrypt

Importance_0
v3.1.0 - Show latest stable - 0 notes - Class: ActiveSupport::MessageEncryptor
decrypt(encrypted_message) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/message_encryptor.rb, line 36
    def decrypt(encrypted_message)
      cipher = new_cipher
      encrypted_data, iv = encrypted_message.split("--").map {|v| ActiveSupport::Base64.decode64(v)}

      cipher.decrypt
      cipher.key = @secret
      cipher.iv  = iv

      decrypted_data = cipher.update(encrypted_data)
      decrypted_data << cipher.final

      Marshal.load(decrypted_data)
    rescue OpenSSLCipherError, TypeError
      raise InvalidMessage
    end
Register or log in to add new notes.