Botan::BlockCipherModePaddingMethod Class Reference

#include <mode_pad.h>

Inheritance diagram for Botan::BlockCipherModePaddingMethod:

Botan::ANSI_X923_Padding Botan::Null_Padding Botan::OneAndZeros_Padding Botan::PKCS7_Padding

List of all members.

Public Member Functions

virtual std::string name () const =0
virtual void pad (byte block[], u32bit size, u32bit current_position) const =0
virtual u32bit pad_bytes (u32bit block_size, u32bit position) const
virtual u32bit unpad (const byte block[], u32bit size) const =0
virtual bool valid_blocksize (u32bit 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

virtual Botan::BlockCipherModePaddingMethod::~BlockCipherModePaddingMethod (  )  [inline, virtual]

virtual destructor

Definition at line 66 of file mode_pad.h.

00066 {}


Member Function Documentation

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

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

Parameters:
block output buffer
size of the block
current_position in the last block

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

u32bit Botan::BlockCipherModePaddingMethod::pad_bytes ( u32bit  block_size,
u32bit  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 16 of file mode_pad.cpp.

00017    {
00018    return (bs - pos);
00019    }

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

Parameters:
block the last block
size the of the block

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

virtual bool Botan::BlockCipherModePaddingMethod::valid_blocksize ( u32bit  block_size  )  const [pure virtual]

Parameters:
block_size of the cipher
Returns:
valid block size for this padding mode

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

Referenced by Botan::CBC_Decryption::CBC_Decryption(), and Botan::CBC_Encryption::CBC_Encryption().


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

Generated on Tue Jun 29 08:56:41 2010 for Botan by  doxygen 1.5.8