aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/pk_lookup/look_pk.cpp
blob: a4062b57c6d2a7626c6479659e61debfaa08ceb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*************************************************
* PK Algorithm Lookup Source File                *
* (C) 1999-2007 Jack Lloyd                       *
*************************************************/

#include <botan/look_pk.h>
#include <botan/lookup.h>

namespace Botan {

/*************************************************
* Get a PK_Encryptor object                      *
*************************************************/
PK_Encryptor* get_pk_encryptor(const PK_Encrypting_Key& key,
                               const std::string& eme)
   {
   return new PK_Encryptor_MR_with_EME(key, eme);
   }

/*************************************************
* Get a PK_Decryptor object                      *
*************************************************/
PK_Decryptor* get_pk_decryptor(const PK_Decrypting_Key& key,
                               const std::string& eme)
   {
   return new PK_Decryptor_MR_with_EME(key, eme);
   }

/*************************************************
* Get a PK_Signer object                         *
*************************************************/
PK_Signer* get_pk_signer(const PK_Signing_Key& key,
                         const std::string& encoding,
                         Signature_Format sig_format)
   {
   PK_Signer* signer = new PK_Signer(key, encoding);
   signer->set_output_format(sig_format);
   return signer;
   }

/*************************************************
* Get a PK_Verifier object                       *
*************************************************/
PK_Verifier* get_pk_verifier(const PK_Verifying_with_MR_Key& key,
                             const std::string& encoding,
                             Signature_Format sig_format)
   {
   PK_Verifier* verifier = new PK_Verifier_with_MR(key, encoding);
   verifier->set_input_format(sig_format);
   return verifier;
   }

/*************************************************
* Get a PK_Verifier object                       *
*************************************************/
PK_Verifier* get_pk_verifier(const PK_Verifying_wo_MR_Key& key,
                             const std::string& encoding,
                             Signature_Format sig_format)
   {
   PK_Verifier* verifier = new PK_Verifier_wo_MR(key, encoding);
   verifier->set_input_format(sig_format);
   return verifier;
   }

/*************************************************
* Get a PK_Key_Agreement object                  *
*************************************************/
PK_Key_Agreement* get_pk_kas(const PK_Key_Agreement_Key& key,
                             const std::string& kdf)
   {
   return new PK_Key_Agreement(key, kdf);
   }

}