|
Botan
1.11.15
|
#include <stream_cipher.h>
Public Types | |
| typedef SCAN_Name | Spec |
Public Member Functions | |
| virtual void | cipher (const byte in[], byte out[], size_t len)=0 |
| void | cipher1 (byte buf[], size_t len) |
| virtual void | clear ()=0 |
| virtual StreamCipher * | clone () const =0 |
| template<typename Alloc > | |
| void | decrypt (std::vector< byte, Alloc > &inout) |
| template<typename Alloc > | |
| void | encipher (std::vector< byte, Alloc > &inout) |
| template<typename Alloc > | |
| void | encrypt (std::vector< byte, Alloc > &inout) |
| virtual Key_Length_Specification | key_spec () const =0 |
| size_t | maximum_keylength () const |
| size_t | minimum_keylength () const |
| virtual std::string | name () const =0 |
| virtual void | set_iv (const byte[], size_t iv_len) |
| void | set_key (const SymmetricKey &key) |
| template<typename Alloc > | |
| void | set_key (const std::vector< byte, Alloc > &key) |
| void | set_key (const byte key[], size_t length) |
| virtual bool | valid_iv_length (size_t iv_len) const |
| bool | valid_keylength (size_t length) const |
Base class for all stream ciphers
Definition at line 20 of file stream_cipher.h.
| typedef SCAN_Name Botan::StreamCipher::Spec |
Definition at line 73 of file stream_cipher.h.
| virtual void Botan::StreamCipher::cipher | ( | const byte | in[], |
| byte | out[], | ||
| size_t | len | ||
| ) | [pure virtual] |
Encrypt or decrypt a message
| in | the plaintext |
| out | the byte array to hold the output, i.e. the ciphertext |
| len | the length of both in and out in bytes |
Implemented in Botan::CTR_BE, Botan::OFB, Botan::RC4, Botan::ChaCha, and Botan::Salsa20.
Referenced by Botan::SIV_Decryption::finish().
| void Botan::StreamCipher::cipher1 | ( | byte | buf[], |
| size_t | len | ||
| ) | [inline] |
Encrypt or decrypt a message
| buf | the plaintext / ciphertext |
| len | the length of buf in bytes |
Definition at line 36 of file stream_cipher.h.
Referenced by Botan::SIV_Encryption::finish().
{ cipher(buf, buf, len); }
| virtual void Botan::SymmetricAlgorithm::clear | ( | ) | [pure virtual, inherited] |
Implemented in Botan::GHASH, Botan::AES_256_NI, Botan::AES_256, Botan::AES_256_SSSE3, Botan::Camellia_256, Botan::GOST_28147_89, Botan::AES_192_NI, Botan::AES_192, Botan::AES_192_SSSE3, Botan::Camellia_192, Botan::TripleDES, Botan::CTR_BE, Botan::OFB, Botan::Lion, Botan::ChaCha, Botan::Salsa20, Botan::Cascade_Cipher, Botan::RC2, Botan::Blowfish, Botan::Poly1305, Botan::AES_128_NI, Botan::Threefish_512, Botan::CMAC, Botan::CBC_MAC, Botan::AES_128, Botan::AES_128_SSSE3, Botan::Camellia_128, Botan::CAST_128, Botan::CAST_256, Botan::DES, Botan::DESX, Botan::IDEA, Botan::KASUMI, Botan::MARS, Botan::MISTY1, Botan::Noekeon, Botan::RC5, Botan::RC6, Botan::SAFER_SK, Botan::SEED, Botan::Serpent, Botan::TEA, Botan::Twofish, Botan::XTEA, Botan::RC4, Botan::HMAC, Botan::ANSI_X919_MAC, and Botan::SipHash.
Referenced by botan_mac_clear().
| virtual StreamCipher* Botan::StreamCipher::clone | ( | ) | const [pure virtual] |
Get a new object representing the same algorithm as *this
Implemented in Botan::CTR_BE, Botan::OFB, Botan::ChaCha, Botan::Salsa20, and Botan::RC4.
| void Botan::StreamCipher::decrypt | ( | std::vector< byte, Alloc > & | inout | ) | [inline] |
Definition at line 48 of file stream_cipher.h.
{ cipher(&inout[0], &inout[0], inout.size()); }
| void Botan::StreamCipher::encipher | ( | std::vector< byte, Alloc > & | inout | ) | [inline] |
Definition at line 40 of file stream_cipher.h.
{ cipher(&inout[0], &inout[0], inout.size()); }
| void Botan::StreamCipher::encrypt | ( | std::vector< byte, Alloc > & | inout | ) | [inline] |
Definition at line 44 of file stream_cipher.h.
{ cipher(&inout[0], &inout[0], inout.size()); }
| virtual Key_Length_Specification Botan::SymmetricAlgorithm::key_spec | ( | ) | const [pure virtual, inherited] |
Implemented in Botan::Block_Cipher_Fixed_Params< BS, KMIN, KMAX, KMOD >, Botan::Block_Cipher_Fixed_Params< 16, 32 >, Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 4 >, Botan::Block_Cipher_Fixed_Params< 8, 1, 56 >, Botan::Block_Cipher_Fixed_Params< 8, 32 >, Botan::Block_Cipher_Fixed_Params< 16, 16 >, Botan::Block_Cipher_Fixed_Params< 8, 11, 16 >, Botan::Block_Cipher_Fixed_Params< 8, 16, 24, 8 >, Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >, Botan::Block_Cipher_Fixed_Params< 16, 4, 32, 4 >, Botan::Block_Cipher_Fixed_Params< 64, 64 >, Botan::Block_Cipher_Fixed_Params< 8, 1, 32 >, Botan::Block_Cipher_Fixed_Params< 16, 24 >, Botan::Block_Cipher_Fixed_Params< 8, 16 >, Botan::Block_Cipher_Fixed_Params< 16, 1, 32 >, Botan::Block_Cipher_Fixed_Params< 8, 8 >, Botan::Block_Cipher_Fixed_Params< 8, 24 >, Botan::GHASH, Botan::Lion, Botan::Poly1305, Botan::CTR_BE, Botan::OFB, Botan::RC4, Botan::CMAC, Botan::HMAC, Botan::ANSI_X919_MAC, Botan::ChaCha, Botan::Salsa20, Botan::CBC_MAC, Botan::SipHash, and Botan::Cascade_Cipher.
Referenced by Botan::CBC_Mode::key_spec(), Botan::ECB_Mode::key_spec(), Botan::XTS_Mode::key_spec(), and Botan::CFB_Mode::key_spec().
| size_t Botan::SymmetricAlgorithm::maximum_keylength | ( | ) | const [inline, inherited] |
Definition at line 36 of file sym_algo.h.
References Botan::Key_Length_Specification::maximum_keylength().
{
return key_spec().maximum_keylength();
}
| size_t Botan::SymmetricAlgorithm::minimum_keylength | ( | ) | const [inline, inherited] |
Definition at line 44 of file sym_algo.h.
{
return key_spec().minimum_keylength();
}
| virtual std::string Botan::SymmetricAlgorithm::name | ( | ) | const [pure virtual, inherited] |
Implemented in Botan::GHASH, Botan::AES_256_NI, Botan::AES_256, Botan::AES_256_SSSE3, Botan::Camellia_256, Botan::GOST_28147_89, Botan::AES_192_NI, Botan::AES_192, Botan::AES_192_SSSE3, Botan::Camellia_192, Botan::TripleDES, Botan::MessageAuthenticationCode, Botan::Lion, Botan::ChaCha, Botan::CTR_BE, Botan::OFB, Botan::Salsa20, Botan::Cascade_Cipher, Botan::RC2, Botan::Blowfish, Botan::AES_128_NI, Botan::Threefish_512, Botan::AES_128, Botan::AES_128_SSSE3, Botan::Camellia_128, Botan::CAST_128, Botan::CAST_256, Botan::DES, Botan::DESX, Botan::IDEA, Botan::KASUMI, Botan::MARS, Botan::MISTY1, Botan::Noekeon, Botan::RC5, Botan::RC6, Botan::SAFER_SK, Botan::SEED, Botan::Serpent, Botan::TEA, Botan::Twofish, Botan::XTEA, Botan::RC4, Botan::HMAC, Botan::Poly1305, Botan::ANSI_X919_MAC, Botan::CBC_MAC, Botan::CMAC, and Botan::SipHash.
Referenced by Botan::CBC_Mode::CBC_Mode(), Botan::ECB_Mode::ECB_Mode(), Botan::GCM_Mode::GCM_Mode(), Botan::XTS_Mode::name(), Botan::CFB_Mode::name(), Botan::ECB_Mode::name(), Botan::CBC_Mode::name(), and Botan::XTS_Mode::XTS_Mode().
| virtual void Botan::StreamCipher::set_iv | ( | const byte | [], |
| size_t | iv_len | ||
| ) | [inline, virtual] |
Resync the cipher using the IV
| iv | the initialization vector |
| iv_len | the length of the IV in bytes |
Reimplemented in Botan::CTR_BE, Botan::OFB, Botan::ChaCha, and Botan::Salsa20.
Definition at line 56 of file stream_cipher.h.
Referenced by Botan::SIV_Mode::set_ctr_iv().
{
if(iv_len)
throw Invalid_IV_Length(name(), iv_len);
}
| void Botan::SymmetricAlgorithm::set_key | ( | const SymmetricKey & | key | ) | [inline, inherited] |
Set the symmetric key of this object.
| key | the SymmetricKey to be set. |
Definition at line 63 of file sym_algo.h.
References Botan::OctetString::begin(), and Botan::OctetString::length().
Referenced by Botan::aont_package(), Botan::aont_unpackage(), botan_mac_set_key(), Botan::TLS::Session::decrypt(), Botan::TLS::Session::encrypt(), and Botan::pbkdf2().
{
set_key(key.begin(), key.length());
}
| void Botan::SymmetricAlgorithm::set_key | ( | const std::vector< byte, Alloc > & | key | ) | [inline, inherited] |
Definition at line 69 of file sym_algo.h.
{
set_key(&key[0], key.size());
}
| void Botan::SymmetricAlgorithm::set_key | ( | const byte | key[], |
| size_t | length | ||
| ) | [inline, inherited] |
Set the symmetric key of this object.
| key | the to be set as a byte array. |
| length | in bytes of key param |
Definition at line 79 of file sym_algo.h.
{
if(!valid_keylength(length))
throw Invalid_Key_Length(name(), length);
key_schedule(key, length);
}
| virtual bool Botan::StreamCipher::valid_iv_length | ( | size_t | iv_len | ) | const [inline, virtual] |
| iv_len | the length of the IV in bytes |
Reimplemented in Botan::CTR_BE, Botan::OFB, Botan::ChaCha, and Botan::Salsa20.
Definition at line 66 of file stream_cipher.h.
{ return (iv_len == 0); }
| bool Botan::SymmetricAlgorithm::valid_keylength | ( | size_t | length | ) | const [inline, inherited] |
Check whether a given key length is valid for this algorithm.
| length | the key length to be checked. |
Definition at line 54 of file sym_algo.h.
Referenced by Botan::aont_package(), and Botan::aont_unpackage().
{
return key_spec().valid_keylength(length);
}
1.7.6.1