Skip to main content

StreamingEncryptor

Trait StreamingEncryptor 

Source
pub(crate) trait StreamingEncryptor: Sized {
    // Required method
    fn update(
        &mut self,
        plaintext_chunk: &[u8],
        last_block: bool,
    ) -> ChunkEncryptionResult;
}
Expand description

A symmetric streaming encryptor.

Required Methods§

Source

fn update( &mut self, plaintext_chunk: &[u8], last_block: bool, ) -> ChunkEncryptionResult

Pass in a chunk of any size of the stream. The encryptor buffers and emits as much ciphertext as it can. The caller signals the end of the stream by calling update with last_block = true.

The encryptor MAY buffer the entire plaintext before emitting any ciphertext depending on the underlying algorithm implementation. In this case, the caller must keep calling update with an empty chunk until the final encrypted chunk is emitted.

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.

Implementors§