From a2c99d3270eb73ef2db5704fc54356c6b75096f8 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 18 May 2006 18:33:19 +0000 Subject: Initial checkin --- src/pk_algs.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/pk_algs.cpp (limited to 'src/pk_algs.cpp') diff --git a/src/pk_algs.cpp b/src/pk_algs.cpp new file mode 100644 index 000000000..e042a84f4 --- /dev/null +++ b/src/pk_algs.cpp @@ -0,0 +1,46 @@ +/************************************************* +* PK Key Source File * +* (C) 1999-2006 The Botan Project * +*************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace Botan { + +/************************************************* +* Get an PK public key object * +*************************************************/ +X509_PublicKey* 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 * +*************************************************/ +PKCS8_PrivateKey* 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; + } + +} -- cgit v1.2.3