|
void | cipher (const uint8_t in[], uint8_t out[], size_t length) override |
|
void | cipher1 (uint8_t buf[], size_t len) |
|
void | clear () override |
|
CTR_BE * | clone () const override |
|
| CTR_BE (BlockCipher *cipher) |
|
| CTR_BE (BlockCipher *cipher, size_t ctr_size) |
|
template<typename Alloc > |
void | decrypt (std::vector< uint8_t, Alloc > &inout) |
|
template<typename Alloc > |
void | encipher (std::vector< uint8_t, Alloc > &inout) |
|
template<typename Alloc > |
void | encrypt (std::vector< uint8_t, Alloc > &inout) |
|
Key_Length_Specification | key_spec () const override |
|
size_t | maximum_keylength () const |
|
size_t | minimum_keylength () const |
|
std::string | name () const override |
|
virtual std::string | provider () const |
|
void | seek (uint64_t offset) override |
|
void | set_iv (const uint8_t iv[], size_t iv_len) override |
|
void | set_key (const SymmetricKey &key) |
|
template<typename Alloc > |
void | set_key (const std::vector< uint8_t, Alloc > &key) |
|
void | set_key (const uint8_t key[], size_t length) |
|
bool | valid_iv_length (size_t iv_len) const override |
|
bool | valid_keylength (size_t length) const |
|
CTR-BE (Counter mode, big-endian)
Definition at line 19 of file ctr.h.
std::unique_ptr< StreamCipher > Botan::StreamCipher::create |
( |
const std::string & |
algo_spec, |
|
|
const std::string & |
provider = "" |
|
) |
| |
|
staticinherited |
Create an instance based on a name If provider is empty then best available is chosen.
- Parameters
-
algo_spec | algorithm name |
provider | provider implementation to use |
- Returns
- a null pointer if the algo/provider combination cannot be found
Definition at line 41 of file stream_cipher.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), BOTAN_UNUSED, and Botan::BlockCipher::create().
Referenced by Botan::BlockCipher::create(), Botan::StreamCipher::create_or_throw(), Botan::get_cipher_mode(), and Botan::get_stream_cipher().
44 const SCAN_Name req(algo_spec);
46 #if defined(BOTAN_HAS_CTR_BE)
47 if(req.algo_name() ==
"CTR-BE" && req.arg_count() == 1)
52 return std::unique_ptr<StreamCipher>(
new CTR_BE(c.release()));
57 #if defined(BOTAN_HAS_CHACHA)
58 if(req.algo_name() ==
"ChaCha")
61 return std::unique_ptr<StreamCipher>(
new ChaCha(req.arg_as_integer(0, 20)));
65 #if defined(BOTAN_HAS_SALSA20)
66 if(req.algo_name() ==
"Salsa20")
69 return std::unique_ptr<StreamCipher>(
new Salsa20);
73 #if defined(BOTAN_HAS_SHAKE_CIPHER)
74 if(req.algo_name() ==
"SHAKE-128")
77 return std::unique_ptr<StreamCipher>(
new SHAKE_128_Cipher);
81 #if defined(BOTAN_HAS_OFB)
82 if(req.algo_name() ==
"OFB" && req.arg_count() == 1)
87 return std::unique_ptr<StreamCipher>(
new OFB(c.release()));
92 #if defined(BOTAN_HAS_RC4)
94 if(req.algo_name() ==
"RC4" ||
95 req.algo_name() ==
"ARC4" ||
96 req.algo_name() ==
"MARK-4")
98 const size_t skip = (req.algo_name() ==
"MARK-4") ? 256 : req.arg_as_integer(0, 0);
100 #if defined(BOTAN_HAS_OPENSSL)
103 return std::unique_ptr<StreamCipher>(make_openssl_rc4(skip));
109 return std::unique_ptr<StreamCipher>(
new RC4(skip));
virtual std::string provider() const
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")