AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions | List of all members
anch::crypto::CBC< Cipher, Padding > Class Template Reference

Cipher-block chaining implementation. More...

#include <cbc.hpp>

Inheritance diagram for anch::crypto::CBC< Cipher, Padding >:
Collaboration diagram for anch::crypto::CBC< Cipher, Padding >:

Public Member Functions

 CBC (const std::array< uint8_t, Cipher::getBlockSize()> &initVect, unsigned int nbThread=1)
 
virtual ~CBC ()
 
- Public Member Functions inherited from anch::crypto::BlockCipherModeOfOperation< CBC< Cipher, Padding >, Cipher >
void cipher (std::istream &input, std::ostream &output, const std::string &key)
 
void decipher (std::istream &input, std::ostream &output, const std::string &key)
 
void setNbThread (unsigned int nbThread)
 

Protected Member Functions

virtual std::size_t cipherBlock (std::array< uint8_t, Cipher::getBlockSize()> &input, std::streamsize nbRead, std::array< uint8_t, Cipher::getBlockSize()> &output, uint32_t, Cipher &cipher) override
 
virtual std::size_t decipherBlock (std::array< uint8_t, Cipher::getBlockSize()> &input, std::array< uint8_t, Cipher::getBlockSize()> &prevInput, std::streamsize nbRead, bool lastBlock, std::array< uint8_t, Cipher::getBlockSize()> &output, uint32_t, Cipher &cipher) override
 
virtual const std::array< uint8_t, Cipher::getBlockSize()> & reset ()
 
- Protected Member Functions inherited from anch::crypto::BlockCipherModeOfOperation< CBC< Cipher, Padding >, Cipher >
 BlockCipherModeOfOperation (bool cipherParallelizable, bool decipherParallelizable, unsigned int nbThread=1)
 
virtual ~BlockCipherModeOfOperation ()
 

Detailed Description

template<typename Cipher, typename Padding>
class anch::crypto::CBC< Cipher, Padding >

Cipher-block chaining implementation.

CBC is the most commonly used mode of operation

Since
0.1
Author
Vincent Lachenal

Constructor & Destructor Documentation

template<typename Cipher , typename Padding >
anch::crypto::CBC< Cipher, Padding >::CBC ( const std::array< uint8_t, Cipher::getBlockSize()> &  initVect,
unsigned int  nbThread = 1 
)
inline

CBC constructor

Parameters
initVectthe initialization vector
nbThreadthe maximum number of thread to run in parallel (default to 1). If is set to 0, it will be set to the number of CPU if found (1 otherwise).
template<typename Cipher , typename Padding >
virtual anch::crypto::CBC< Cipher, Padding >::~CBC ( )
inlinevirtual

CBC destructor

Member Function Documentation

template<typename Cipher , typename Padding >
virtual std::size_t anch::crypto::CBC< Cipher, Padding >::cipherBlock ( std::array< uint8_t, Cipher::getBlockSize()> &  input,
std::streamsize  nbRead,
std::array< uint8_t, Cipher::getBlockSize()> &  output,
uint32_t  ,
Cipher &  cipher 
)
inlineoverrideprotectedvirtual

Cipher a block.
This method will handle initialization vector management.

Parameters
inputthe input block to cipher
nbReadthe size of block which has been read
outputthe output block
cipherthe cipher instance
Returns
the number of bytes to write

Implements anch::crypto::BlockCipherModeOfOperation< CBC< Cipher, Padding >, Cipher >.

template<typename Cipher , typename Padding >
virtual std::size_t anch::crypto::CBC< Cipher, Padding >::decipherBlock ( std::array< uint8_t, Cipher::getBlockSize()> &  input,
std::array< uint8_t, Cipher::getBlockSize()> &  prevInput,
std::streamsize  nbRead,
bool  lastBlock,
std::array< uint8_t, Cipher::getBlockSize()> &  output,
uint32_t  ,
Cipher &  cipher 
)
inlineoverrideprotectedvirtual

Decipher a block.
This method will handle initialization vector management.

Parameters
inputthe input block to decipher
prevInputthe previous input block to decipher
nbReadthe size of block which has been read
lastBlockis last block to decipher
outputthe output block
cipherthe cipher instance
Returns
the number of bytes to write

Implements anch::crypto::BlockCipherModeOfOperation< CBC< Cipher, Padding >, Cipher >.

template<typename Cipher , typename Padding >
virtual const std::array<uint8_t,Cipher::getBlockSize()>& anch::crypto::CBC< Cipher, Padding >::reset ( )
inlineprotectedvirtual

Reset block cipher mode of operation context

Returns
the initial context

Implements anch::crypto::BlockCipherModeOfOperation< CBC< Cipher, Padding >, Cipher >.


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