[go: up one dir, main page]

Struct Decryptor

Source
pub struct Decryptor<A, S>{ /* 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>

Source

pub fn new(key: &Key<A>, nonce: &Nonce<A, S>) -> Self
where A: KeyInit, S: NewStream<A>,

Create a ๐’Ÿ STREAM decryptor object from the given AEAD key and nonce.

Source

pub fn from_aead(aead: A, nonce: &Nonce<A, S>) -> Self
where A: KeyInit, S: NewStream<A>,

Create a ๐’Ÿ STREAM decryptor object from the given AEAD primitive.

Source

pub fn from_stream_primitive(stream: S) -> Self

Create a ๐’Ÿ STREAM decryptor object from the given STREAM primitive.

Source

pub fn decrypt_next<'msg, 'aad>( &mut self, payload: impl Into<Payload<'msg, 'aad>>, ) -> Result<Vec<u8>>

Available on crate feature alloc only.

Use the underlying AEAD to decrypt the next AEAD message in this STREAM, returning the result as a Vec.

Source

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.

Source

pub fn decrypt_last<'msg, 'aad>( self, payload: impl Into<Payload<'msg, 'aad>>, ) -> Result<Vec<u8>>

Available on crate feature alloc only.

Use the underlying AEAD to decrypt the last AEAD message in this STREAM, consuming the ๐’Ÿ STREAM decryptor object in order to prevent further use.

Source

pub fn decrypt_last_in_place( self, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<()>

Use the underlying AEAD to decrypt the last AEAD message in this STREAM in-place, consuming the ๐’Ÿ STREAM decryptor object in order to prevent further use.

Auto Trait Implementationsยง

ยง

impl<A, S> Freeze for Decryptor<A, S>

ยง

impl<A, S> RefUnwindSafe for Decryptor<A, S>

ยง

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>

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> 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> Same for T

Sourceยง

type Output = T

Should always be Self
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.