#include <cbc.h>

Public Member Functions | |
| virtual bool | attachable () |
| CBC_Encryption (BlockCipher *cipher, BlockCipherModePaddingMethod *padding, const SymmetricKey &key, const InitializationVector &iv) | |
| CBC_Encryption (BlockCipher *cipher, BlockCipherModePaddingMethod *padding) | |
| std::string | name () const |
| void | set_iv (const InitializationVector &iv) |
| void | set_key (const SymmetricKey &key) |
| virtual void | start_msg () |
| bool | valid_iv_length (u32bit iv_len) const |
| bool | valid_keylength (u32bit key_len) const |
| ~CBC_Encryption () | |
Protected Member Functions | |
| void | send (const MemoryRegion< byte > &in) |
| void | send (byte in) |
| void | send (const byte in[], u32bit length) |
Private Member Functions | |
| void | buffer_reset () |
| u32bit | buffered_block_size () const |
| u32bit | current_position () const |
Definition at line 21 of file cbc.h.
| Botan::CBC_Encryption::CBC_Encryption | ( | BlockCipher * | cipher, | |
| BlockCipherModePaddingMethod * | padding | |||
| ) |
Definition at line 17 of file cbc.cpp.
References Botan::BlockCipher::BLOCK_SIZE, Botan::BlockCipherModePaddingMethod::name(), name(), Botan::MemoryRegion< T >::resize(), and Botan::BlockCipherModePaddingMethod::valid_blocksize().
00018 : 00019 Buffered_Filter(ciph->BLOCK_SIZE, 0), 00020 cipher(ciph), padder(pad) 00021 { 00022 if(!padder->valid_blocksize(cipher->BLOCK_SIZE)) 00023 throw Invalid_Block_Size(name(), padder->name()); 00024 00025 state.resize(cipher->BLOCK_SIZE); 00026 }
| Botan::CBC_Encryption::CBC_Encryption | ( | BlockCipher * | cipher, | |
| BlockCipherModePaddingMethod * | padding, | |||
| const SymmetricKey & | key, | |||
| const InitializationVector & | iv | |||
| ) |
Definition at line 31 of file cbc.cpp.
References Botan::BlockCipher::BLOCK_SIZE, Botan::BlockCipherModePaddingMethod::name(), name(), Botan::MemoryRegion< T >::resize(), set_iv(), set_key(), and Botan::BlockCipherModePaddingMethod::valid_blocksize().
00034 : 00035 Buffered_Filter(ciph->BLOCK_SIZE, 0), 00036 cipher(ciph), padder(pad) 00037 { 00038 if(!padder->valid_blocksize(cipher->BLOCK_SIZE)) 00039 throw Invalid_Block_Size(name(), padder->name()); 00040 00041 state.resize(cipher->BLOCK_SIZE); 00042 00043 set_key(key); 00044 set_iv(iv); 00045 }
| Botan::CBC_Encryption::~CBC_Encryption | ( | ) | [inline] |
| virtual bool Botan::Filter::attachable | ( | ) | [inline, virtual, inherited] |
Check whether this filter is an attachable filter.
Reimplemented in Botan::DataSink, and Botan::SecureQueue.
Definition at line 50 of file filter.h.
| std::string Botan::CBC_Encryption::name | ( | ) | const [virtual] |
Implements Botan::Filter.
Definition at line 107 of file cbc.cpp.
References Botan::BlockCipherModePaddingMethod::name(), and Botan::SymmetricAlgorithm::name().
Referenced by CBC_Encryption(), and set_iv().
| void Botan::Filter::send | ( | const MemoryRegion< byte > & | in | ) | [inline, protected, inherited] |
| in | some input for the filter |
Definition at line 68 of file filter.h.
References Botan::MemoryRegion< T >::begin(), Botan::Filter::send(), and Botan::MemoryRegion< T >::size().
Referenced by Botan::Filter::send().
00068 { send(in.begin(), in.size()); }
| void Botan::Filter::send | ( | byte | in | ) | [inline, protected, inherited] |
| in | some input for the filter |
Definition at line 63 of file filter.h.
References Botan::Filter::send().
Referenced by Botan::Filter::send().
00063 { send(&in, 1); }
| in | some input for the filter | |
| length | the length of in |
Definition at line 28 of file filter.cpp.
References Botan::MemoryRegion< T >::append(), Botan::MemoryRegion< T >::destroy(), Botan::MemoryRegion< T >::size(), and Botan::Filter::write().
Referenced by Botan::Zlib_Decompression::end_msg(), Botan::Zlib_Compression::end_msg(), Botan::PK_Verifier_Filter::end_msg(), Botan::PK_Signer_Filter::end_msg(), Botan::PK_Decryptor_Filter::end_msg(), Botan::PK_Encryptor_Filter::end_msg(), Botan::Hex_Encoder::end_msg(), Botan::Bzip_Decompression::end_msg(), Botan::Bzip_Compression::end_msg(), Botan::Base64_Decoder::end_msg(), Botan::Base64_Encoder::end_msg(), Botan::MAC_Filter::end_msg(), Botan::Hash_Filter::end_msg(), Botan::Zlib_Compression::flush(), Botan::Bzip_Compression::flush(), Botan::Zlib_Decompression::write(), Botan::Zlib_Compression::write(), Botan::Bzip_Decompression::write(), Botan::Bzip_Compression::write(), and Botan::StreamCipher_Filter::write().
00029 { 00030 bool nothing_attached = true; 00031 for(u32bit j = 0; j != total_ports(); ++j) 00032 if(next[j]) 00033 { 00034 if(write_queue.size()) 00035 next[j]->write(write_queue, write_queue.size()); 00036 next[j]->write(input, length); 00037 nothing_attached = false; 00038 } 00039 00040 if(nothing_attached) 00041 write_queue.append(input, length); 00042 else 00043 write_queue.destroy(); 00044 }
| void Botan::CBC_Encryption::set_iv | ( | const InitializationVector & | iv | ) | [virtual] |
Set the initialization vector of this filter. Note: you should call set_iv() only after you have called set_key()
| iv | the initialization vector to use |
Reimplemented from Botan::Keyed_Filter.
Definition at line 50 of file cbc.cpp.
References Botan::OctetString::bits_of(), Botan::Buffered_Filter::buffer_reset(), Botan::OctetString::length(), name(), and valid_iv_length().
Referenced by CBC_Encryption().
00051 { 00052 if(!valid_iv_length(iv.length())) 00053 throw Invalid_IV_Length(name(), iv.length()); 00054 00055 state = iv.bits_of(); 00056 buffer_reset(); 00057 }
| void Botan::CBC_Encryption::set_key | ( | const SymmetricKey & | key | ) | [inline, virtual] |
Set the key of this filter
| key | the key to use |
Implements Botan::Keyed_Filter.
Definition at line 29 of file cbc.h.
Referenced by CBC_Encryption().
| virtual void Botan::Filter::start_msg | ( | ) | [inline, virtual, inherited] |
Start a new message. Must be closed by end_msg() before another message can be started.
Reimplemented in Botan::Bzip_Compression, Botan::Bzip_Decompression, Botan::EAX_Base, Botan::Zlib_Compression, Botan::Zlib_Decompression, Botan::PBE_PKCS5v15, and Botan::PBE_PKCS5v20.
Definition at line 38 of file filter.h.
| bool Botan::CBC_Encryption::valid_iv_length | ( | u32bit | length | ) | const [inline, virtual] |
Check whether an IV length is valid for this filter
| length | the IV length to be checked for validity |
Reimplemented from Botan::Keyed_Filter.
Definition at line 34 of file cbc.h.
Referenced by set_iv().
| bool Botan::CBC_Encryption::valid_keylength | ( | u32bit | length | ) | const [inline, virtual] |
Check whether a key length is valid for this filter
| length | the key length to be checked for validity |
Implements Botan::Keyed_Filter.
Definition at line 31 of file cbc.h.
1.5.8