Botan  2.4.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::BlockCipherModePaddingMethod Class Referenceabstract

#include <mode_pad.h>

Inheritance diagram for Botan::BlockCipherModePaddingMethod:
Botan::ANSI_X923_Padding Botan::ESP_Padding Botan::Null_Padding Botan::OneAndZeros_Padding Botan::PKCS7_Padding

Public Member Functions

virtual void add_padding (secure_vector< uint8_t > &buffer, size_t final_block_bytes, size_t block_size) const =0
 
virtual std::string name () const =0
 
virtual size_t unpad (const uint8_t block[], size_t size) const =0
 
virtual bool valid_blocksize (size_t block_size) const =0
 
virtual ~BlockCipherModePaddingMethod ()=default
 

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 26 of file mode_pad.h.

Constructor & Destructor Documentation

◆ ~BlockCipherModePaddingMethod()

virtual Botan::BlockCipherModePaddingMethod::~BlockCipherModePaddingMethod ( )
virtualdefault

virtual destructor

Member Function Documentation

◆ add_padding()

virtual void Botan::BlockCipherModePaddingMethod::add_padding ( secure_vector< uint8_t > &  buffer,
size_t  final_block_bytes,
size_t  block_size 
) const
pure virtual

Add padding bytes to buffer.

Parameters
bufferdata to pad
final_block_bytessize of the final block in bytes
block_sizesize of each block in bytes

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

Referenced by Botan::CBC_Encryption::finish().

◆ name()

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

◆ unpad()

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

Remove padding bytes from block

Parameters
blockthe last block
sizethe size of the block in bytes
Returns
number of padding bytes

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

Referenced by Botan::CBC_Decryption::finish().

◆ valid_blocksize()

virtual bool Botan::BlockCipherModePaddingMethod::valid_blocksize ( size_t  block_size) const
pure virtual
Parameters
block_sizeof the cipher
Returns
valid block size for this padding mode

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


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