Struct fernet::MultiFernet
[−]
[src]
pub struct MultiFernet { /* fields omitted */ }
Methods
impl MultiFernet
[src]
MultiFernet
encapsulates the encrypt operation with the first Fernet
instance and decryption with the Fernet
instances provided in order
until successful decryption or a DecryptionError
.
pub fn new(keys: Vec<Fernet>) -> MultiFernet
[src]
pub fn encrypt(&self, data: &[u8]) -> String
[src]
Encrypts data with the first Fernet
instance. Returns a value
(which is base64-encoded) that can be passed to MultiFernet::decrypt
.
pub fn decrypt(&self, token: &str) -> Result<Vec<u8>, DecryptionError>
[src]
Decrypts a ciphertext, using the Fernet
instances provided. Returns
either Ok(plaintext)
if decryption is successful or
Err(DecryptionError)
if there are any errors.