Fernet
termKept in this browser · My desk
A symmetric authenticated-encryption recipe in the pyca/cryptography package: data encrypted with a Fernet key cannot be read or altered without that key.
Its documentation lists the parts: AES in CBC mode with a 128-bit key and PKCS7 padding, HMAC with SHA-256, and initialization vectors from os.urandom(). A token carries its creation time in plaintext, decrypt() can refuse tokens older than a ttl, MultiFernet rotates keys, and the whole message must fit in memory. It belongs to the library's recipes layer, meant to be used without cryptographic decisions.
Also known as: Fernet token, MultiFernet, cryptography.fernet
Sources
- cryptography 50.0.2 documentation, Fernet (read 2026-10-27): AES-128 in CBC mode with PKCS7 padding, HMAC-SHA256, IVs from os.urandom(); creation time in plaintext; fits-in-memory limitation; MultiFernet
- cryptography 50.0.2 documentation, home page (read 2026-10-27): the recipes layer and the hazardous materials layer