Botan: Botan::BlockCipherModePaddingMethod Class Reference

Botan 1.10.16

Public Member Functions | List of all members
Botan::BlockCipherModePaddingMethod Class Referenceabstract

`#include <mode_pad.h>`

Inheritance diagram for Botan::BlockCipherModePaddingMethod:

## Public Member Functions
virtual std::string | name () const =0
virtual void | pad (byte block[], size_t size, size_t current_position) const =0
virtual size_t | pad_bytes (size_t block_size, size_t position) const
virtual size_t | unpad (const byte block[], size_t size) const =0
virtual bool | valid_blocksize (size_t block_size) const =0
virtual | ~BlockCipherModePaddingMethod ()

## Detailed Description

Block Cipher Mode Padding Method This class is pretty limited, it cannot deal well with randomized padding methods, or any padding method that wants to add more than one block. For instance, it should be possible to define cipher text stealing mode as simply a padding mode for CBC, which happens to consume the last two block (and requires use of the block cipher).

Definition at line 25 of file mode_pad.h.

## Constructor & Destructor Documentation

## ◆ ~BlockCipherModePaddingMethod()

virtual Botan::BlockCipherModePaddingMethod::~BlockCipherModePaddingMethod | ( |  | ) |
| inlinevirtual

virtual destructor

Definition at line 66 of file mode_pad.h.

66 {}

## Member Function Documentation

## ◆ name()

virtual std::string Botan::BlockCipherModePaddingMethod::name | ( |  | ) | const
| pure virtual

Returns
  name of the mode

Implemented in Botan::Null_Padding, Botan::OneAndZeros_Padding, Botan::ANSI_X923_Padding, and Botan::PKCS7_Padding.

Referenced by Botan::CBC_Encryption::name(), Botan::ECB_Encryption::name(), Botan::ECB_Decryption::name(), Botan::CBC_Decryption::name(), Botan::PKCS7_Padding::unpad(), Botan::ANSI_X923_Padding::unpad(), and Botan::OneAndZeros_Padding::unpad().

## ◆ pad()

virtual void Botan::BlockCipherModePaddingMethod::pad | ( | byte | block[],
|  | size_t | size,
|  | size_t | current_position
| ) |  | const
| pure virtual

Parameters

  block | output buffer
  size | of the block
  current_position | in the last block

Implemented in Botan::Null_Padding, Botan::OneAndZeros_Padding, Botan::ANSI_X923_Padding, and Botan::PKCS7_Padding.

Referenced by Botan::ECB_Encryption::name(), and Botan::CBC_Encryption::set_iv().

## ◆ pad_bytes()

size_t Botan::BlockCipherModePaddingMethod::pad_bytes | ( | size_t | block_size,
|  | size_t | position
| ) |  | const
| virtual

Parameters

  block_size | of the cipher
  position | in the current block

Returns
  number of padding bytes that will be appended

Reimplemented in Botan::Null_Padding.

Definition at line 17 of file mode_pad.cpp.

Referenced by Botan::ECB_Encryption::name(), and Botan::CBC_Encryption::set_iv().

18 {
19 return (bs - pos);
20 }

## ◆ unpad()

virtual size_t Botan::BlockCipherModePaddingMethod::unpad | ( | const byte | block[],
|  | size_t | size
| ) |  | const
| pure virtual

Parameters

  block | the last block
  size | the of the block

Implemented in Botan::Null_Padding, Botan::OneAndZeros_Padding, Botan::ANSI_X923_Padding, and Botan::PKCS7_Padding.

Referenced by Botan::ECB_Decryption::name(), and Botan::CBC_Decryption::set_iv().

## ◆ valid_blocksize()

virtual bool Botan::BlockCipherModePaddingMethod::valid_blocksize | ( | size_t | block_size | ) | const
| pure virtual

Parameters

  block_size | of the cipher

Returns
  valid block size for this padding mode

Implemented in Botan::Null_Padding, Botan::OneAndZeros_Padding, Botan::ANSI_X923_Padding, and Botan::PKCS7_Padding.

The documentation for this class was generated from the following files:

- src/filters/modes/mode_pad/mode_pad.h
- src/filters/modes/mode_pad/mode_pad.cpp