~ubuntu-branches/ubuntu/precise/botan1.8/precise

« back to all changes in this revision

Viewing changes to src/pubkey/pubkey/pk_algs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-08-04 00:47:32 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090804004732-bmf7f33nfoctocbz
Tags: 1.8.5-1
* Merging upstream version 1.8.5.
* Adding old changelog entries for separately uploaded botan packages
  in the past.
* Using correct rfc-2822 date formats in changelog.
* Wrapping build depends.
* Adding misc depends.
* Renaming local manpages directory to common name.
* Minimizing rules file.
* Doing some minor cosmetical updates in the manpage.
* Updating copyright file to reflect changes of upstream version
  1.8.0.
* Using new configure.py instread of configure.pl, updating necessary
  things to cope with that.
* Updating.
* Tidy debhelper install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
* PK Key
3
 
* (C) 1999-2007 Jack Lloyd
4
 
*
5
 
* Distributed under the terms of the Botan license
6
 
*/
7
 
 
8
 
#include <botan/pk_algs.h>
9
 
 
10
 
#if defined(BOTAN_HAS_RSA)
11
 
  #include <botan/rsa.h>
12
 
#endif
13
 
 
14
 
#if defined(BOTAN_HAS_DSA)
15
 
  #include <botan/dsa.h>
16
 
#endif
17
 
 
18
 
#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
19
 
  #include <botan/dh.h>
20
 
#endif
21
 
 
22
 
#if defined(BOTAN_HAS_ECDSA)
23
 
  #include <botan/ecdsa.h>
24
 
#endif
25
 
 
26
 
#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
27
 
  #include <botan/nr.h>
28
 
#endif
29
 
 
30
 
#if defined(BOTAN_HAS_RW)
31
 
  #include <botan/rw.h>
32
 
#endif
33
 
 
34
 
#if defined(BOTAN_HAS_ELGAMAL)
35
 
  #include <botan/elgamal.h>
36
 
#endif
37
 
 
38
 
namespace Botan {
39
 
 
40
 
/*
41
 
* Get an PK public key object
42
 
*/
43
 
Public_Key* get_public_key(const std::string& alg_name)
44
 
   {
45
 
#if defined(BOTAN_HAS_RSA)
46
 
   if(alg_name == "RSA") return new RSA_PublicKey;
47
 
#endif
48
 
 
49
 
#if defined(BOTAN_HAS_DSA)
50
 
   if(alg_name == "DSA") return new DSA_PublicKey;
51
 
#endif
52
 
 
53
 
#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
54
 
   if(alg_name == "DH")  return new DH_PublicKey;
55
 
#endif
56
 
 
57
 
#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
58
 
   if(alg_name == "NR")  return new NR_PublicKey;
59
 
#endif
60
 
 
61
 
#if defined(BOTAN_HAS_RW)
62
 
   if(alg_name == "RW")  return new RW_PublicKey;
63
 
#endif
64
 
 
65
 
#if defined(BOTAN_HAS_ELG)
66
 
   if(alg_name == "ELG") return new ElGamal_PublicKey;
67
 
#endif
68
 
 
69
 
#if defined(BOTAN_HAS_ECDSA)
70
 
   if(alg_name == "ECDSA") return new ECDSA_PublicKey;
71
 
#endif
72
 
 
73
 
   return 0;
74
 
   }
75
 
 
76
 
/*
77
 
* Get an PK private key object
78
 
*/
79
 
Private_Key* get_private_key(const std::string& alg_name)
80
 
   {
81
 
#if defined(BOTAN_HAS_RSA)
82
 
   if(alg_name == "RSA") return new RSA_PrivateKey;
83
 
#endif
84
 
 
85
 
#if defined(BOTAN_HAS_DSA)
86
 
   if(alg_name == "DSA") return new DSA_PrivateKey;
87
 
#endif
88
 
 
89
 
#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
90
 
   if(alg_name == "DH")  return new DH_PrivateKey;
91
 
#endif
92
 
 
93
 
#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
94
 
   if(alg_name == "NR")  return new NR_PrivateKey;
95
 
#endif
96
 
 
97
 
#if defined(BOTAN_HAS_RW)
98
 
   if(alg_name == "RW")  return new RW_PrivateKey;
99
 
#endif
100
 
 
101
 
#if defined(BOTAN_HAS_ELG)
102
 
   if(alg_name == "ELG") return new ElGamal_PrivateKey;
103
 
#endif
104
 
 
105
 
#if defined(BOTAN_HAS_ECDSA)
106
 
   if(alg_name == "ECDSA") return new ECDSA_PrivateKey;
107
 
#endif
108
 
 
109
 
   return 0;
110
 
   }
111
 
 
112
 
}