instance method
encrypt
Ruby on Rails 7.1.6
Since v2.3.18 PrivateSignature
encrypt(data)
No documentation comment.
Parameters
-
datareq
Source
# 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
Defined in activesupport/lib/active_support/message_encryptor.rb line 277
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::MessageEncryptor