Trait StreamingCipher

Source
pub trait StreamingCipher: SecKeyGen {
    // Required methods
    fn info(&self) -> CipherInfo;
    fn init(
        &mut self,
        key: &[u8],
        nonce: &[u8],
    ) -> Result<(), Box<dyn Error + 'static>>;
    fn update(
        &mut self,
        input: &[u8],
        output: impl Write,
    ) -> Result<usize, Box<dyn Error + 'static>>;
    fn finish(
        &mut self,
        output: impl Write,
    ) -> Result<usize, Box<dyn Error + 'static>>;
}
Expand description

A stateful (streaming) cipher interface

Required Methods§

Source

fn info(&self) -> CipherInfo

Returns information about the cipher

Source

fn init( &mut self, key: &[u8], nonce: &[u8], ) -> Result<(), Box<dyn Error + 'static>>

(Re-)initializes the handle with key and nonce

Source

fn update( &mut self, input: &[u8], output: impl Write, ) -> Result<usize, Box<dyn Error + 'static>>

Processes the bytes in input and writes the resulting bytes to output and returns the amount of bytes written

Source

fn finish( &mut self, output: impl Write, ) -> Result<usize, Box<dyn Error + 'static>>

Finishes the operation and writes the pending bytes to output and returns the amount of bytes written

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§