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>) -> Selfwhere
A: KeyInit,
S: NewStream<A>,
pub fn new(key: &Key<A>, nonce: &Nonce<A, S>) -> Selfwhere A: KeyInit, S: NewStream<A>,
Create a 𝒟 STREAM decryptor object from the given AEAD key and nonce.
sourcepub fn from_aead(aead: A, nonce: &Nonce<A, S>) -> Selfwhere
A: KeyInit,
S: NewStream<A>,
pub fn from_aead(aead: A, nonce: &Nonce<A, S>) -> Selfwhere A: KeyInit, S: NewStream<A>,
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.