pub trait BlockMode<C: BlockCipher, P: Padding>: Sized {
    fn new(
        cipher: C,
        iv: &GenericArray<u8, <C as BlockCipher>::BlockSize>
    ) -> Self;
fn encrypt_blocks(
        &mut self,
        blocks: &mut [GenericArray<u8, <C as BlockCipher>::BlockSize>]
    );
fn decrypt_blocks(
        &mut self,
        blocks: &mut [GenericArray<u8, <C as BlockCipher>::BlockSize>]
    ); fn new_fix(
        key: &GenericArray<u8, <C as BlockCipher>::KeySize>,
        iv: &GenericArray<u8, <C as BlockCipher>::BlockSize>
    ) -> Self { ... }
fn new_var(key: &[u8], iv: &[u8]) -> Result<Self, InvalidKeyIvLength> { ... }
fn encrypt(
        self,
        buffer: &mut [u8],
        pos: usize
    ) -> Result<&[u8], BlockModeError> { ... }
fn decrypt(self, buffer: &mut [u8]) -> Result<&[u8], BlockModeError> { ... }
fn encrypt_vec(self, plaintext: &[u8]) -> Vec<u8>Notable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
    A: Allocator
{ ... }
fn decrypt_vec(self, ciphertext: &[u8]) -> Result<Vec<u8>, BlockModeError> { ... } }
Expand description

Trait for a block cipher mode of operation that is used to apply a block cipher operation to input data to transform it into a variable-length output message.

Required methods

Create a new block mode instance from initialized block cipher and IV.

Encrypt blocks of data

Decrypt blocks of data

Provided methods

Create a new block mode instance from fixed sized key and IV.

Create a new block mode instance from variable size key and IV.

Returns an error if key or IV have unsupported length.

Encrypt message in-place.

&buffer[..pos] is used as a message and &buffer[pos..] as a reserved space for padding. The padding space should be big enough for padding, otherwise method will return Err(BlockModeError).

Decrypt message in-place.

Returns an error if buffer length is not multiple of block size and if after decoding message has malformed padding.

Encrypt message and store result in vector.

Encrypt message and store result in vector.

Implementors