block_padding

Trait RawPadding

Source
pub trait RawPadding {
    const TYPE: PadType;

    // Required methods
    fn raw_pad(block: &mut [u8], pos: usize);
    fn raw_unpad(block: &[u8]) -> Result<&[u8], UnpadError>;
}
Expand description

Trait for padding messages divided into blocks of arbitrary size

Required Associated Constants§

Source

const TYPE: PadType

Padding type

Required Methods§

Source

fn raw_pad(block: &mut [u8], pos: usize)

Pads block filled with data up to pos (i.e length of a message stored in the block is equal to pos).

§Panics

If pos is bigger than block.len(). Most padding algorithms also panic if they are equal.

Source

fn raw_unpad(block: &[u8]) -> Result<&[u8], UnpadError>

Unpad data in the block.

Returns Err(UnpadError) if the block contains malformed padding.

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§

Source§

impl RawPadding for AnsiX923

Source§

const TYPE: PadType = PadType::Reversible

Source§

impl RawPadding for Iso7816

Source§

const TYPE: PadType = PadType::Reversible

Source§

impl RawPadding for Iso10126

Source§

const TYPE: PadType = PadType::Reversible

Source§

impl RawPadding for NoPadding

Source§

const TYPE: PadType = PadType::NoPadding

Source§

impl RawPadding for Pkcs7

Source§

const TYPE: PadType = PadType::Reversible

Source§

impl RawPadding for ZeroPadding

Source§

const TYPE: PadType = PadType::Ambiguous