Struct fernet::MultiFernet[][src]

pub struct MultiFernet { /* fields omitted */ }

Implementations

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 no decryption was possible across the set of fernet keys.

Trait Implementations

impl Clone for MultiFernet[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.