Botan  1.11.15
src/lib/pk_pad/get_pk_pad.cpp
Go to the documentation of this file.
00001 /*
00002 * EMSA/EME Retrieval
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #include <botan/emsa.h>
00009 #include <botan/eme.h>
00010 #include <botan/scan_name.h>
00011 #include <botan/internal/algo_registry.h>
00012 
00013 namespace Botan {
00014 
00015 EMSA* get_emsa(const std::string& algo_spec)
00016    {
00017    SCAN_Name request(algo_spec);
00018 
00019    if(EMSA* emsa = make_a<EMSA>(algo_spec))
00020       return emsa;
00021 
00022    throw Algorithm_Not_Found(algo_spec);
00023    }
00024 
00025 EME* get_eme(const std::string& algo_spec)
00026    {
00027    SCAN_Name request(algo_spec);
00028 
00029    if(EME* eme = make_a<EME>(algo_spec))
00030       return eme;
00031 
00032    if(request.algo_name() == "Raw")
00033       return nullptr; // No padding
00034 
00035    throw Algorithm_Not_Found(algo_spec);
00036    }
00037 
00038 }