[][src]Trait crypto_api::cipher::StreamingCipher

pub trait StreamingCipher: SecKeyGen {
    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>>; }

A stateful (streaming) cipher interface

Required methods

fn info(&self) -> CipherInfo

Returns information about the cipher

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

(Re-)initializes the handle with key and nonce

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

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

Loading content...

Implementors

Loading content...