diff options
author | lloyd <[email protected]> | 2010-03-05 15:05:23 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-05 15:05:23 +0000 |
commit | af96b73070182dacbfee77659c282852c7e4d507 (patch) | |
tree | fc66507f37d4143fe2d0346ab1a1dadc308bfebe /src/libstate/look_pk.h | |
parent | 1b68d7e53c4bc5e6b2938194b0f7eda78a72ce43 (diff) |
Inline look_pk funcs
Diffstat (limited to 'src/libstate/look_pk.h')
-rw-r--r-- | src/libstate/look_pk.h | 74 |
1 files changed, 49 insertions, 25 deletions
diff --git a/src/libstate/look_pk.h b/src/libstate/look_pk.h index 27b67dc5b..d2a056523 100644 --- a/src/libstate/look_pk.h +++ b/src/libstate/look_pk.h @@ -1,6 +1,6 @@ /* * PK Algorithm Lookup -* (C) 1999-2007 Jack Lloyd +* (C) 1999-2010 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -8,7 +8,7 @@ #ifndef BOTAN_PK_LOOKUP_H__ #define BOTAN_PK_LOOKUP_H__ -#include <botan/build.h> +#include <botan/lookup.h> #include <botan/pubkey.h> namespace Botan { @@ -16,62 +16,86 @@ namespace Botan { /** * Public key encryptor factory method. * @param key the key that will work inside the encryptor -* @param pad determines the algorithm and encoding +* @param eme determines the algorithm and encoding * @return the public key encryptor object */ -BOTAN_DLL PK_Encryptor* get_pk_encryptor(const PK_Encrypting_Key& key, - const std::string& pad); +inline PK_Encryptor* get_pk_encryptor(const PK_Encrypting_Key& key, + const std::string& eme) + { + return new PK_Encryptor_MR_with_EME(key, get_eme(eme)); + } /** * Public key decryptor factory method. * @param key the key that will work inside the decryptor -* @param pad determines the algorithm and encoding +* @param eme determines the algorithm and encoding * @return the public key decryptor object */ -BOTAN_DLL PK_Decryptor* get_pk_decryptor(const PK_Decrypting_Key& key, - const std::string& pad); +inline PK_Decryptor* get_pk_decryptor(const PK_Decrypting_Key& key, + const std::string& eme) + { + return new PK_Decryptor_MR_with_EME(key, get_eme(eme)); + } /** * Public key signer factory method. * @param key the key that will work inside the signer -* @param pad determines the algorithm, encoding and hash algorithm +* @param emsa determines the algorithm, encoding and hash algorithm * @param sig_format the signature format to be used * @return the public key signer object */ -BOTAN_DLL PK_Signer* get_pk_signer(const PK_Signing_Key& key, - const std::string& pad, - Signature_Format = IEEE_1363); +inline PK_Signer* get_pk_signer(const PK_Signing_Key& key, + const std::string& emsa, + Signature_Format sig_format = IEEE_1363) + { + PK_Signer* signer = new PK_Signer(key, get_emsa(emsa)); + signer->set_output_format(sig_format); + return signer; + } /** * Public key verifier factory method. * @param key the key that will work inside the verifier -* @param pad determines the algorithm, encoding and hash algorithm +* @param emsa determines the algorithm, encoding and hash algorithm * @param sig_format the signature format to be used * @return the public key verifier object */ -BOTAN_DLL PK_Verifier* get_pk_verifier(const PK_Verifying_with_MR_Key& key, - const std::string& pad, - Signature_Format = IEEE_1363); +inline PK_Verifier* get_pk_verifier(const PK_Verifying_with_MR_Key& key, + const std::string& emsa, + Signature_Format sig_format = IEEE_1363) + { + PK_Verifier* verifier = new PK_Verifier_with_MR(key, get_emsa(emsa)); + verifier->set_input_format(sig_format); + return verifier; + } /** * Public key verifier factory method. * @param key the key that will work inside the verifier -* @param pad determines the algorithm, encoding and hash algorithm -* @param sig_form the signature format to be used +* @param emsa determines the algorithm, encoding and hash algorithm +* @param sig_format the signature format to be used * @return the public key verifier object */ -BOTAN_DLL PK_Verifier* get_pk_verifier(const PK_Verifying_wo_MR_Key& key, - const std::string& pad, - Signature_Format sig_form = IEEE_1363); +inline PK_Verifier* get_pk_verifier(const PK_Verifying_wo_MR_Key& key, + const std::string& emsa, + Signature_Format sig_format = IEEE_1363) + { + PK_Verifier* verifier = new PK_Verifier_wo_MR(key, get_emsa(emsa)); + verifier->set_input_format(sig_format); + return verifier; + } /** * Public key key agreement factory method. * @param key the key that will work inside the key agreement -* @param pad determines the algorithm, encoding and hash algorithm -* @return the public key verifier object +* @param kdf the kdf algorithm to use +* @return the key agreement algorithm */ -BOTAN_DLL PK_Key_Agreement* get_pk_kas(const PK_Key_Agreement_Key& key, - const std::string& pad); +inline PK_Key_Agreement* get_pk_kas(const PK_Key_Agreement_Key& key, + const std::string& kdf) + { + return new PK_Key_Agreement(key, get_kdf(kdf)); + } } |