class ActiveSupport::MessageEncryptor
def initialize(secret, sign_secret = nil, cipher: nil, digest: nil, serializer: nil)
+SHA1+. Ignored when using an AEAD cipher like 'aes-256-gcm'.
* :digest - String of digest to use for signing. Default is
OpenSSL::Cipher.ciphers. Default is 'aes-256-gcm'.
* :cipher - Cipher to use. Can be any cipher returned by
Options:
ActiveSupport::MessageEncryptor.new('secret', 'signature_secret')
This allows you to specify keys to encrypt and sign data.
First additional parameter is used as the signature key for MessageVerifier.
derivation function.
key by using ActiveSupport::KeyGenerator or a similar key
bits. If you are using a user-entered secret, you can generate a suitable
the cipher key size. For the default 'aes-256-gcm' cipher, this is 256
Initialize a new MessageEncryptor. +secret+ must be at least as long as
def initialize(secret, sign_secret = nil, cipher: nil, digest: nil, serializer: nil) @secret = secret @sign_secret = sign_secret @cipher = cipher || self.class.default_cipher @digest = digest || "SHA1" unless aead_mode? @verifier = resolve_verifier @serializer = serializer || Marshal end