Kemal::Session::Crypto
Low-level cryptographic primitives matching Rails' defaults: PBKDF2-HMAC-SHA1 key derivation and AES-256-GCM authenticated encryption.
Constants
Not configurable, and shouldn't be. Rails' encrypted_cookie_cipher can
technically be changed, but its only other value (aes-256-cbc) is a
different wire format there — non-AEAD ciphers get an HMAC signature
appended and no auth tag — so it would be a second code path, not a
different constant. encrypt also sizes its output buffer at exactly
plaintext.size, which is only correct for a stream mode like GCM.
Instance methods
Decrypts and authenticates an AES-256-GCM message. Raises Crypto::Error
if the auth tag does not verify (tampering, wrong key, etc.).
PBKDF2-HMAC-SHA1, matching ActiveSupport::KeyGenerator
(iterations: 1000, SHA1, 32-byte key for AES-256-GCM cookies).
Encrypts plaintext with AES-256-GCM. Returns {ciphertext, auth_tag}.
No additional authenticated data is used (matching Rails cookies).