Botan 3.14.1
Crypto and TLS for C&
Botan::EME_Raw Class Referencefinal

#include <eme_raw.h>

Inheritance diagram for Botan::EME_Raw:
Botan::EncryptionPaddingScheme

Public Member Functions

 EME_Raw ()=default

Static Public Member Functions

static std::unique_ptr< EncryptionPaddingScheme > create_or_throw (const PK_Encryption_Options_Reader &options)

Detailed Description

Definition at line 14 of file eme_raw.h.

Constructor & Destructor Documentation

◆ EME_Raw()

Botan::EME_Raw::EME_Raw ( )
default

Member Function Documentation

◆ create_or_throw()

std::unique_ptr< EncryptionPaddingScheme > Botan::EncryptionPaddingScheme::create_or_throw ( const PK_Encryption_Options_Reader & options)
staticinherited

Factory method for encryption padding schemes

Parameters
optionsthe padding scheme and its parameters
Returns
pointer to newly allocated object of that type, or throws

Definition at line 26 of file enc_padding.cpp.

27 {
28 // Encrypting without padding is dangerous, so it must be requested explicitly
29 if(!options.using_padding()) {
30 throw Lookup_Error("Public key encryption requires specifying a padding scheme");
31 }
32
33 const std::string& padding = options.padding().value();
34
35 // Any option not examined by the selected scheme is rejected by the caller
36
37#if defined(BOTAN_HAS_EME_RAW)
38 if(padding == "Raw") {
39 return std::make_unique<EME_Raw>();
40 }
41#endif
42
43#if defined(BOTAN_HAS_EME_PKCS1)
44 if(padding == "PKCS1v15") {
45 return std::make_unique<EME_PKCS1v15>();
46 }
47#endif
48
49#if defined(BOTAN_HAS_EME_OAEP)
50 if(padding == "OAEP") {
51 return std::make_unique<OAEP>(options);
52 }
53#endif
54
55 throw Lookup_Error("Invalid or unavailable encryption padding scheme " + options.to_string());
56}

References Botan::PK_Encryption_Options_Reader::padding(), Botan::PK_Encryption_Options_Reader::to_string(), and Botan::PK_Encryption_Options_Reader::using_padding().

Referenced by ~EncryptionPaddingScheme().


The documentation for this class was generated from the following files: