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. |
Fernet | |
MultiFernet |