diff options
Diffstat (limited to 'src/lib/pk_pad/eme.cpp')
-rw-r--r-- | src/lib/pk_pad/eme.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/pk_pad/eme.cpp b/src/lib/pk_pad/eme.cpp index 9398b4c83..153ef8922 100644 --- a/src/lib/pk_pad/eme.cpp +++ b/src/lib/pk_pad/eme.cpp @@ -6,9 +6,47 @@ */ #include <botan/eme.h> +#include <botan/internal/pad_utils.h> + +#if defined(BOTAN_HAS_EME_OAEP) +#include <botan/oaep.h> +#endif + +#if defined(BOTAN_HAS_EME_PKCS1v15) +#include <botan/eme_pkcs.h> +#endif + +#if defined(BOTAN_HAS_EME_RAW) +#include <botan/eme_raw.h> +#endif namespace Botan { +#if defined(BOTAN_HAS_EME_OAEP) +BOTAN_REGISTER_NAMED_T(EME, "OAEP", OAEP, OAEP::make); +#endif + +#if defined(BOTAN_HAS_EME_PKCS1v15) +BOTAN_REGISTER_EME_NAMED_NOARGS(EME_PKCS1v15, "PKCS1v15"); +#endif + +#if defined(BOTAN_HAS_EME_RAW) +BOTAN_REGISTER_EME_NAMED_NOARGS(EME_Raw, "Raw"); +#endif + +EME* get_eme(const std::string& algo_spec) + { + SCAN_Name request(algo_spec); + + if(EME* eme = make_a<EME>(algo_spec)) + return eme; + + if(request.algo_name() == "Raw") + return nullptr; // No padding + + throw Algorithm_Not_Found(algo_spec); + } + /* * Encode a message */ |