aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_algs.cpp
blob: 6a76b11c39f71402fae28c291da47deba1fecd53 (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
/*************************************************
* PK Key Source File                             *
* (C) 1999-2007 Jack Lloyd                       *
*************************************************/

#include <botan/pk_algs.h>
#include <botan/rsa.h>
#include <botan/dsa.h>
#include <botan/dh.h>
#include <botan/nr.h>
#include <botan/rw.h>
#include <botan/elgamal.h>

namespace Botan {

/*************************************************
* Get an PK public key object                    *
*************************************************/
Public_Key* get_public_key(const std::string& alg_name)
   {
   if(alg_name == "RSA")      return new RSA_PublicKey;
   else if(alg_name == "DSA") return new DSA_PublicKey;
   else if(alg_name == "DH")  return new DH_PublicKey;
   else if(alg_name == "NR")  return new NR_PublicKey;
   else if(alg_name == "RW")  return new RW_PublicKey;
   else if(alg_name == "ELG") return new ElGamal_PublicKey;
   else
      return 0;
   }

/*************************************************
* Get an PK private key object                   *
*************************************************/
Private_Key* get_private_key(const std::string& alg_name)
   {
   if(alg_name == "RSA")      return new RSA_PrivateKey;
   else if(alg_name == "DSA") return new DSA_PrivateKey;
   else if(alg_name == "DH")  return new DH_PrivateKey;
   else if(alg_name == "NR")  return new NR_PrivateKey;
   else if(alg_name == "RW")  return new RW_PrivateKey;
   else if(alg_name == "ELG") return new ElGamal_PrivateKey;
   else
      return 0;
   }

}