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 */ }
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
sourceimpl<A> NewStream<A> for StreamBE32<A> where
A: AeadInPlace,
A::NonceSize: Sub<U5>,
<<A as AeadCore>::NonceSize as Sub<U5>>::Output: ArrayLength<u8>,
impl<A> NewStream<A> for StreamBE32<A> where
A: AeadInPlace,
A::NonceSize: Sub<U5>,
<<A as AeadCore>::NonceSize as Sub<U5>>::Output: ArrayLength<u8>,
sourceimpl<A> StreamPrimitive<A> for StreamBE32<A> where
A: AeadInPlace,
A::NonceSize: Sub<U5>,
<<A as AeadCore>::NonceSize as Sub<U5>>::Output: ArrayLength<u8>,
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>
type NonceOverhead = UInt<UInt<UInt<UTerm, B1>, B0>, B1>
Number of bytes this STREAM primitive requires from the nonce.
sourceconst COUNTER_INCR: u32 = 1u32
const COUNTER_INCR: u32 = 1u32
Value to use when incrementing the STREAM counter (i.e. one)
sourceconst COUNTER_MAX: u32 = 4_294_967_295u32
const COUNTER_MAX: u32 = 4_294_967_295u32
Maximum value of the STREAM counter.
sourcefn encrypt_in_place(
&self,
position: u32,
last_block: bool,
associated_data: &[u8],
buffer: &mut dyn Buffer
) -> Result<()>
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.
sourcefn decrypt_in_place(
&self,
position: Self::Counter,
last_block: bool,
associated_data: &[u8],
buffer: &mut dyn Buffer
) -> Result<()>
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.
sourcefn encrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
plaintext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
fn encrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
plaintext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
alloc
only.Encrypt the given plaintext payload, and return the resulting ciphertext as a vector of bytes. Read more
sourcefn decrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
ciphertext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
fn decrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
ciphertext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
alloc
only.Decrypt the given ciphertext slice, and return the resulting plaintext as a vector of bytes. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more