diff options
Diffstat (limited to 'src/lib/stream')
-rw-r--r-- | src/lib/stream/ctr/ctr.cpp | 1 | ||||
-rw-r--r-- | src/lib/stream/ofb/ofb.cpp | 1 | ||||
-rw-r--r-- | src/lib/stream/stream_cipher.cpp | 12 | ||||
-rw-r--r-- | src/lib/stream/stream_cipher.h | 14 |
4 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/stream/ctr/ctr.cpp b/src/lib/stream/ctr/ctr.cpp index d025a03d3..e6d4b9d3e 100644 --- a/src/lib/stream/ctr/ctr.cpp +++ b/src/lib/stream/ctr/ctr.cpp @@ -7,6 +7,7 @@ #include <botan/internal/stream_utils.h> #include <botan/ctr.h> +#include <botan/lookup.h> namespace Botan { diff --git a/src/lib/stream/ofb/ofb.cpp b/src/lib/stream/ofb/ofb.cpp index 73ffef980..1979c676f 100644 --- a/src/lib/stream/ofb/ofb.cpp +++ b/src/lib/stream/ofb/ofb.cpp @@ -7,6 +7,7 @@ #include <botan/internal/stream_utils.h> #include <botan/ofb.h> +#include <botan/lookup.h> namespace Botan { diff --git a/src/lib/stream/stream_cipher.cpp b/src/lib/stream/stream_cipher.cpp index 2f1538914..3b8d35bc7 100644 --- a/src/lib/stream/stream_cipher.cpp +++ b/src/lib/stream/stream_cipher.cpp @@ -30,6 +30,18 @@ namespace Botan { +std::unique_ptr<StreamCipher> StreamCipher::create(const std::string& algo_spec, + const std::string& provider) + { + return std::unique_ptr<StreamCipher>(make_a<StreamCipher>(algo_spec, provider)); + } + +std::vector<std::string> StreamCipher::providers(const std::string& algo_spec) + { + return providers_of<StreamCipher>(StreamCipher::Spec(algo_spec)); + } + +StreamCipher::StreamCipher() {} StreamCipher::~StreamCipher() {} void StreamCipher::set_iv(const byte[], size_t iv_len) diff --git a/src/lib/stream/stream_cipher.h b/src/lib/stream/stream_cipher.h index 5500bca49..68c97f1c1 100644 --- a/src/lib/stream/stream_cipher.h +++ b/src/lib/stream/stream_cipher.h @@ -23,6 +23,19 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm typedef SCAN_Name Spec; /** + * Create an instance based on a name + * Will return a null pointer if the algo/provider combination cannot + * be found. If providers is empty then best available is chosen. + */ + static std::unique_ptr<StreamCipher> create(const std::string& algo_spec, + const std::string& provider = ""); + + /** + * Returns the list of available providers for this algorithm, empty if not available + */ + static std::vector<std::string> providers(const std::string& algo_spec); + + /** * Encrypt or decrypt a message * @param in the plaintext * @param out the byte array to hold the output, i.e. the ciphertext @@ -68,6 +81,7 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm */ virtual StreamCipher* clone() const = 0; + StreamCipher(); virtual ~StreamCipher(); }; |