Crate fernet[][src]

Fernet provides symmetric-authenticated-encryption with an API that makes misusing it difficult. It is based on a public specification and there are interoperable implementations in Rust, Python, Ruby, Go, and Clojure.

Example

// Store `key` somewhere safe!
let key = fernet::Fernet::generate_key();
let fernet = fernet::Fernet::new(&key).unwrap();
let plaintext = b"my top secret message!";
let ciphertext = fernet.encrypt(plaintext);
let decrypted_plaintext = fernet.decrypt(&ciphertext);
assert_eq!(decrypted_plaintext.unwrap(), plaintext);

Structs

DecryptionError

This error is returned when fernet cannot decrypt the ciphertext for any reason. It could be an expired token, incorrect key or other failure. If you recieve this error, you should consider the fernet token provided as invalid.

Fernet
MultiFernet