pub trait Decryption: Sized {
    // Required methods
    fn init(
        key_id: u32,
        key_version: u32,
        key: &[u8],
        iv: &[u8],
        same_size: bool
    ) -> Result<Self, EncryptionError>;
    fn update(
        &mut self,
        src: &[u8],
        dst: &mut [u8]
    ) -> Result<usize, EncryptionError>;

    // Provided method
    fn finish(&mut self, dst: &mut [u8]) -> Result<usize, EncryptionError> { ... }
}
Expand description

Decryption interface; implement this on decryption context

This can be the same type as Encryption but does not have to be.

Required Methods§

source

fn init( key_id: u32, key_version: u32, key: &[u8], iv: &[u8], same_size: bool ) -> Result<Self, EncryptionError>

Initialize the decryption context object. See Encryption::init for information on parameters.

source

fn update( &mut self, src: &[u8], dst: &mut [u8] ) -> Result<usize, EncryptionError>

Update the encryption context with new data, return the number of bytes written.

Provided Methods§

source

fn finish(&mut self, dst: &mut [u8]) -> Result<usize, EncryptionError>

Finish decryption. Usually this performs validation and, in some cases, can be used to write additional data.

If init was called with same_size = true, dst will likely be empty.

Object Safety§

This trait is not object safe.

Implementors§