Block cipher mode of operation interface. More...
#include <bcModOp.hpp>
Public Member Functions | |
| 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 | |
| BlockCipherModeOfOperation (bool cipherParallelizable, bool decipherParallelizable, unsigned int nbThread=1) | |
| virtual | ~BlockCipherModeOfOperation () |
| virtual std::size_t | cipherBlock (std::array< uint8_t, Cipher::getBlockSize()> &input, std::streamsize nbRead, std::array< uint8_t, Cipher::getBlockSize()> &output, uint32_t index, Cipher &cipher)=0 |
| 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 index, Cipher &cipher)=0 |
| virtual const std::array< uint8_t, Cipher::getBlockSize()> & | reset ()=0 |
Friends | |
| class | anch::ThreadPool |
Block cipher mode of operation interface.
Interface for all block cipher mode of operation implementations.
|
protected |
BlockCipherModeOfOperation constructor
| cipherParallelizable | Is cipher parallelizable |
| decipherParallelizable | Is decipher parallelizable |
| nbThread | the 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). |
|
protectedvirtual |
BlockCipherModeOfOperation destructor
| void anch::crypto::BlockCipherModeOfOperation< Derived, Cipher >::cipher | ( | std::istream & | input, |
| std::ostream & | output, | ||
| const std::string & | key ) |
Cipher input stream
| input | the input stream to cipher |
| output | the ouput stream to write in |
| key | the cipher key |
|
protectedpure virtual |
Cipher a block.
This method will handle initialization vector management.
| input | the input block to cipher |
| nbRead | the size of block which has been read |
| output | the output block |
| index | the block index |
| cipher | the cipher instance |
Implemented in anch::crypto::CBC< Cipher, Padding >, anch::crypto::CFB< Cipher >, anch::crypto::CTR< Cipher >, anch::crypto::ECB< Cipher, Padding >, anch::crypto::OFB< Cipher >, and anch::crypto::PCBC< Cipher, Padding >.
| void anch::crypto::BlockCipherModeOfOperation< Derived, Cipher >::decipher | ( | std::istream & | input, |
| std::ostream & | output, | ||
| const std::string & | key ) |
Decipher input stream
| input | the input stream to decipher |
| output | the ouput stream to write in |
| key | the decipher key |
|
protectedpure virtual |
Decipher a block.
This method will handle initialization vector management.
| input | the input block to decipher |
| prevInput | the previous input block to decipher |
| nbRead | the size of block which has been read |
| lastBlock | is last block to decipher |
| output | the output block |
| index | the block index |
| cipher | the cipher instance |
Implemented in anch::crypto::CBC< Cipher, Padding >, anch::crypto::CFB< Cipher >, anch::crypto::CTR< Cipher >, anch::crypto::ECB< Cipher, Padding >, anch::crypto::OFB< Cipher >, and anch::crypto::PCBC< Cipher, Padding >.
|
protectedpure virtual |
Reset block cipher mode of operation context
Implemented in anch::crypto::CBC< Cipher, Padding >, anch::crypto::CFB< Cipher >, anch::crypto::CTR< Cipher >, anch::crypto::ECB< Cipher, Padding >, anch::crypto::OFB< Cipher >, and anch::crypto::PCBC< Cipher, Padding >.
|
inline |
Maximum number of parallel thread setter
| nbThread | the maximum number of parallel thread to set |