pub struct Decryptor<A, S>where
A: AeadInPlace,
S: StreamPrimitive<A>,
A::NonceSize: Sub<<S as StreamPrimitive<A>>::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,{ /* private fields */ }Available on crate feature
stream only.Expand description
Stateful STREAM object which can decrypt AEAD messages one-at-a-time.
This corresponds to the ๐ STREAM decryptor object as defined in the paper Online Authenticated-Encryption and its Nonce-Reuse Misuse-Resistance.
Implementationsยง
Sourceยงimpl<A, S> Decryptor<A, S>where
A: AeadInPlace,
S: StreamPrimitive<A>,
A::NonceSize: Sub<<S as StreamPrimitive<A>>::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
impl<A, S> Decryptor<A, S>where
A: AeadInPlace,
S: StreamPrimitive<A>,
A::NonceSize: Sub<<S as StreamPrimitive<A>>::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
Sourcepub fn new(key: &Key<A>, nonce: &Nonce<A, S>) -> Self
pub fn new(key: &Key<A>, nonce: &Nonce<A, S>) -> Self
Create a ๐ STREAM decryptor object from the given AEAD key and nonce.
Sourcepub fn from_aead(aead: A, nonce: &Nonce<A, S>) -> Self
pub fn from_aead(aead: A, nonce: &Nonce<A, S>) -> Self
Create a ๐ STREAM decryptor object from the given AEAD primitive.
Sourcepub fn from_stream_primitive(stream: S) -> Self
pub fn from_stream_primitive(stream: S) -> Self
Create a ๐ STREAM decryptor object from the given STREAM primitive.
Sourcepub fn decrypt_next<'msg, 'aad>(
&mut self,
payload: impl Into<Payload<'msg, 'aad>>,
) -> Result<Vec<u8>>
Available on crate feature alloc only.
pub fn decrypt_next<'msg, 'aad>( &mut self, payload: impl Into<Payload<'msg, 'aad>>, ) -> Result<Vec<u8>>
alloc only.Use the underlying AEAD to
decrypt
the next AEAD message in this STREAM, returning the
result as a Vec.
Sourcepub fn decrypt_next_in_place(
&mut self,
associated_data: &[u8],
buffer: &mut dyn Buffer,
) -> Result<()>
pub fn decrypt_next_in_place( &mut self, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<()>
Use the underlying AEAD to decrypt the next AEAD message in this STREAM in-place.
Auto Trait Implementationsยง
impl<A, S> Freeze for Decryptor<A, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
S: Freeze,
<S as StreamPrimitive<A>>::Counter: Freeze,
impl<A, S> RefUnwindSafe for Decryptor<A, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
S: RefUnwindSafe,
<S as StreamPrimitive<A>>::Counter: RefUnwindSafe,
impl<A, S> Send for Decryptor<A, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
S: Send,
<S as StreamPrimitive<A>>::Counter: Send,
impl<A, S> Sync for Decryptor<A, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
S: Sync,
<S as StreamPrimitive<A>>::Counter: Sync,
impl<A, S> Unpin for Decryptor<A, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
S: Unpin,
<S as StreamPrimitive<A>>::Counter: Unpin,
impl<A, S> UnwindSafe for Decryptor<A, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
S: UnwindSafe,
<S as StreamPrimitive<A>>::Counter: UnwindSafe,
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more