Struct EncryptionCipher

Source
pub struct EncryptionCipher<C, S>
where C: AeadCore + NewAead, S: NonceSequence<C>,
{ /* private fields */ }
Expand description

Describes the Key, NonceSequence and EncryptionMode used to encrypt / decrypt the data

Implementations§

Source§

impl<C, S> EncryptionCipher<C, S>

Source

pub fn new(key: Key<C>, nonces: S, mode: EncryptionMode) -> Self

Create a new EncryptionCipher

Trait Implementations§

Source§

impl<C, S> Clone for EncryptionCipher<C, S>
where C: AeadCore + NewAead, S: NonceSequence<C>,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C, S> Debug for EncryptionCipher<C, S>
where C: AeadCore + NewAead, S: NonceSequence<C>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, S> Encryption for EncryptionCipher<C, S>

Source§

fn encrypt_ivec( &self, data: IVec, mode: EncryptionMode, nonce: Option<IVec>, ) -> Result<IVec>

Source§

fn decrypt_ivec(&self, data: IVec, mode: EncryptionMode) -> Result<IVec>

Source§

fn applies_to(&self, mode: EncryptionMode) -> bool

Source§

fn get_nonce_from_encrypted(&self, data: &IVec) -> Result<IVec>

Source§

fn salt_and_hash<D: AsRef<[u8]>>(&self, data: D) -> Hash

Source§

fn applies_to_key(&self) -> bool

Source§

fn applies_to_tree_name(&self) -> bool

Source§

fn encrypt<T, E>( &self, data: T, mode: EncryptionMode, default_nonce_fn: Box<dyn Fn(&IVec) -> Result<Option<IVec>, E> + '_>, ) -> Result<IVec, E>
where T: Into<IVec>, E: From<Error>,

Source§

fn decrypt<T: Into<IVec>>(&self, data: T, mode: EncryptionMode) -> Result<IVec>

Source§

fn encrypt_key<T, E>( &self, data: T, default_nonce_fn: Box<dyn Fn(&IVec) -> Result<Option<IVec>, E> + '_>, ) -> Result<IVec, E>
where T: Into<IVec>, E: From<Error>,

Source§

fn decrypt_key<T: Into<IVec>>(&self, data: T) -> Result<IVec>

Source§

fn encrypt_value<T: Into<IVec>>(&self, data: T) -> Result<IVec>

Source§

fn decrypt_value<T: Into<IVec>>(&self, data: T) -> Result<IVec>

Source§

fn encrypt_tree_name<T, E>( &self, data: T, default_nonce_fn: Box<dyn Fn(&IVec) -> Result<Option<IVec>, E> + '_>, ) -> Result<IVec, E>
where T: Into<IVec>, E: From<Error>,

Source§

fn decrypt_tree_name<T: Into<IVec>>(&self, data: T) -> Result<IVec>

Source§

fn decrypt_value_result<E>( &self, res: Result<Option<IVec>, E>, ) -> Result<Option<IVec>, E>
where E: From<Error>,

Source§

fn decrypt_key_value_result( &self, res: Result<Option<(IVec, IVec)>>, ) -> Result<Option<(IVec, IVec)>>

Source§

fn decrypt_event(&self, event: Event) -> Result<Event>

Auto Trait Implementations§

§

impl<C, S> Freeze for EncryptionCipher<C, S>
where <<C as NewAead>::KeySize as ArrayLength<u8>>::ArrayType: Freeze,

§

impl<C, S> RefUnwindSafe for EncryptionCipher<C, S>

§

impl<C, S> Send for EncryptionCipher<C, S>
where C: Send, S: Send,

§

impl<C, S> Sync for EncryptionCipher<C, S>
where C: Sync, S: Send,

§

impl<C, S> Unpin for EncryptionCipher<C, S>
where C: Unpin, <<C as NewAead>::KeySize as ArrayLength<u8>>::ArrayType: Unpin,

§

impl<C, S> UnwindSafe for EncryptionCipher<C, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V