7#include <botan/internal/enc_padding.h>
9#include <botan/exceptn.h>
10#include <botan/pk_options_readers.h>
12#if defined(BOTAN_HAS_EME_OAEP)
13 #include <botan/internal/oaep.h>
16#if defined(BOTAN_HAS_EME_PKCS1)
17 #include <botan/internal/eme_pkcs.h>
20#if defined(BOTAN_HAS_EME_RAW)
21 #include <botan/internal/eme_raw.h>
30 throw Lookup_Error(
"Public key encryption requires specifying a padding scheme");
33 const std::string& padding = options.
padding().value();
37#if defined(BOTAN_HAS_EME_RAW)
38 if(padding ==
"Raw") {
39 return std::make_unique<EME_Raw>();
43#if defined(BOTAN_HAS_EME_PKCS1)
44 if(padding ==
"PKCS1v15") {
45 return std::make_unique<EME_PKCS1v15>();
49#if defined(BOTAN_HAS_EME_OAEP)
50 if(padding ==
"OAEP") {
51 return std::make_unique<OAEP>(options);
static std::unique_ptr< EncryptionPaddingScheme > create_or_throw(const PK_Encryption_Options_Reader &options)
virtual ~EncryptionPaddingScheme()
bool using_padding() const
std::string to_string() const
Format the options as a string, for error messages.
const std::optional< std::string > & padding() const