method
encrypt
v8.1.1 -
Show latest stable
- Class:
ActiveSupport::MessageEncryptor
encrypt(data)private
No documentation available.
# File activesupport/lib/active_support/message_encryptor.rb, line 277
def encrypt(data)
cipher = new_cipher
cipher.encrypt
cipher.key = @secret
# Rely on OpenSSL for the initialization vector
iv = cipher.random_iv
cipher.auth_data = "" if aead_mode?
encrypted_data = cipher.update(data)
encrypted_data << cipher.final
parts = [encrypted_data, iv]
parts << cipher.auth_tag(AUTH_TAG_LENGTH) if aead_mode?
join_parts(parts)
end