instance method encrypt

Ruby on Rails 8.0.4

Since v2.3.18 Private

Available in: v2.3.18 v3.0.20 v3.1.12 v3.2.22.5 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

encrypt(data)

No documentation comment.

Parameters

data req
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

Type at least 2 characters to search.

↑↓ navigate · open · esc close