28 {
29#if defined(BOTAN_HAS_EME_RAW)
30 if(algo_spec == "Raw")
31 return std::make_unique<EME_Raw>();
32#endif
33
34#if defined(BOTAN_HAS_EME_PKCS1)
35 if(algo_spec == "PKCS1v15" || algo_spec == "EME-PKCS1-v1_5")
36 return std::make_unique<EME_PKCS1v15>();
37#endif
38
39#if defined(BOTAN_HAS_EME_OAEP)
40 SCAN_Name req(algo_spec);
41
42 if(req.algo_name() == "OAEP" ||
43 req.algo_name() == "EME-OAEP" ||
44 req.algo_name() == "EME1")
45 {
46 if(req.arg_count() == 1 ||
47 ((req.arg_count() == 2 || req.arg_count() == 3) && req.arg(1) == "MGF1"))
48 {
50 return std::make_unique<OAEP>(std::move(hash), req.arg(2, ""));
51 }
52 else if(req.arg_count() == 2 || req.arg_count() == 3)
53 {
55
56 if(mgf_params.size() == 2 && mgf_params[0] == "MGF1")
57 {
60
61 if(hash && mgf1_hash)
62 {
63 return std::make_unique<OAEP>(std::move(hash),
64 std::move(mgf1_hash),
65 req.arg(2, ""));
66 }
67 }
68 }
69 }
70#endif
71
72 throw Algorithm_Not_Found(algo_spec);
73 }
static std::unique_ptr< HashFunction > create(std::string_view algo_spec, std::string_view provider="")
std::vector< std::string > parse_algorithm_name(std::string_view namex)