pub trait StreamPrimitive<A>{
type NonceOverhead: ArrayLength<u8>;
type Counter: AddAssign + Copy + Default + Eq;
const COUNTER_INCR: Self::Counter;
const COUNTER_MAX: Self::Counter;
// Required methods
fn encrypt_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<()>;
// Provided methods
fn encrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
plaintext: 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>> { ... }
fn encryptor(self) -> Encryptor<A, Self>
where Self: Sized { ... }
fn decryptor(self) -> Decryptor<A, Self>
where Self: Sized { ... }
}Available on crate feature
stream only.Expand description
Low-level STREAM implementation.
This trait provides a particular “flavor” of STREAM, as there are different ways the specifics of the construction can be implemented.
Deliberately immutable and stateless to permit parallel operation.
Required Associated Constants§
Sourceconst COUNTER_INCR: Self::Counter
const COUNTER_INCR: Self::Counter
Value to use when incrementing the STREAM counter (i.e. one)
Sourceconst COUNTER_MAX: Self::Counter
const COUNTER_MAX: Self::Counter
Maximum value of the STREAM counter.
Required Associated Types§
Sourcetype NonceOverhead: ArrayLength<u8>
type NonceOverhead: ArrayLength<u8>
Number of bytes this STREAM primitive requires from the nonce.
Required Methods§
Provided Methods§
Sourcefn 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.
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.
Sourcefn 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.
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.