new(secret, *signature_key_or_options) public

Initialize a new MessageEncryptor. secret must be at least as long as the cipher key size. For the default ‘aes-256-cbc’ cipher, this is 256 bits. If you are using a user-entered secret, you can generate a suitable key with OpenSSL::Digest::SHA256.new(user_secret).digest or similar.

Options:

  • :cipher - Cipher to use. Can be any cipher returned by OpenSSL::Cipher.ciphers. Default is ‘aes-256-cbc’.

  • :serializer - Object serializer to use. Default is Marshal.

Show source
Register or log in to add new notes.