Struct aead::stream::StreamBE32

source ·
pub struct StreamBE32<A>where
    A: AeadInPlace,
    A::NonceSize: Sub<U5>,
    <<A as AeadCore>::NonceSize as Sub<U5>>::Output: ArrayLength<u8>,{ /* private fields */ }
Available on crate feature stream only.
Expand description

The original “Rogaway-flavored” STREAM as described in the paper Online Authenticated-Encryption and its Nonce-Reuse Misuse-Resistance.

Uses a 32-bit big endian counter and 1-byte “last block” flag stored as the last 5-bytes of the AEAD nonce.

Trait Implementations§

source§

impl<A> NewStream<A> for StreamBE32<A>where A: AeadInPlace, A::NonceSize: Sub<U5>, <<A as AeadCore>::NonceSize as Sub<U5>>::Output: ArrayLength<u8>,

source§

fn from_aead(aead: A, nonce: &Nonce<A, Self>) -> Self

Create a new STREAM from the given AEAD cipher.
source§

impl<A> StreamPrimitive<A> for StreamBE32<A>where A: AeadInPlace, A::NonceSize: Sub<U5>, <<A as AeadCore>::NonceSize as Sub<U5>>::Output: ArrayLength<u8>,

§

type NonceOverhead = UInt<UInt<UInt<UTerm, B1>, B0>, B1>

Number of bytes this STREAM primitive requires from the nonce.
§

type Counter = u32

Type used as the STREAM counter.
source§

const COUNTER_INCR: u32 = 1u32

Value to use when incrementing the STREAM counter (i.e. one)
source§

const COUNTER_MAX: u32 = 4_294_967_295u32

Maximum value of the STREAM counter.
source§

fn encrypt_in_place( &self, position: u32, last_block: bool, associated_data: &[u8], buffer: &mut dyn Buffer ) -> Result<()>

Encrypt an AEAD message in-place at the given position in the STREAM.
source§

fn decrypt_in_place( &self, position: Self::Counter, last_block: bool, associated_data: &[u8], buffer: &mut dyn Buffer ) -> Result<()>

Decrypt an AEAD message in-place at the given position in the STREAM.
source§

fn encrypt<'msg, 'aad>( &self, position: Self::Counter, last_block: bool, plaintext: impl Into<Payload<'msg, 'aad>> ) -> Result<Vec<u8>>

Available on crate feature alloc only.
Encrypt the given plaintext payload, and return the resulting ciphertext as a vector of bytes.
source§

fn decrypt<'msg, 'aad>( &self, position: Self::Counter, last_block: bool, ciphertext: impl Into<Payload<'msg, 'aad>> ) -> Result<Vec<u8>>

Available on crate feature alloc only.
Decrypt the given ciphertext slice, and return the resulting plaintext as a vector of bytes.
source§

fn encryptor(self) -> Encryptor<A, Self>where Self: Sized,

Obtain Encryptor for this StreamPrimitive.
source§

fn decryptor(self) -> Decryptor<A, Self>where Self: Sized,

Obtain Decryptor for this StreamPrimitive.

Auto Trait Implementations§

§

impl<A> RefUnwindSafe for StreamBE32<A>where A: RefUnwindSafe, <<<A as AeadCore>::NonceSize as Sub<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>>::Output as ArrayLength<u8>>::ArrayType: RefUnwindSafe,

§

impl<A> Send for StreamBE32<A>where A: Send,

§

impl<A> Sync for StreamBE32<A>where A: Sync,

§

impl<A> Unpin for StreamBE32<A>where A: Unpin, <<<A as AeadCore>::NonceSize as Sub<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>>::Output as ArrayLength<u8>>::ArrayType: Unpin,

§

impl<A> UnwindSafe for StreamBE32<A>where A: UnwindSafe, <<<A as AeadCore>::NonceSize as Sub<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>>::Output as ArrayLength<u8>>::ArrayType: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.