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.

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