aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/pk_algs.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-09-28 03:23:12 -0400
committerJack Lloyd <[email protected]>2016-10-20 22:45:47 -0400
commit6ceeab949aae9d53914838c542e7b156c80b4b57 (patch)
tree01d56f8570686eff1064b14c8e44c6654e626b11 /src/lib/pubkey/pk_algs.h
parent36e5b56eb4298e81e8413ac1ef0eada096df8abc (diff)
Add create_private_key, expose key loading functions in pk_algs.h
Diffstat (limited to 'src/lib/pubkey/pk_algs.h')
-rw-r--r--src/lib/pubkey/pk_algs.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/lib/pubkey/pk_algs.h b/src/lib/pubkey/pk_algs.h
index 804860ed1..c73f5365e 100644
--- a/src/lib/pubkey/pk_algs.h
+++ b/src/lib/pubkey/pk_algs.h
@@ -1,6 +1,6 @@
/*
* PK Key Factory
-* (C) 1999-2010 Jack Lloyd
+* (C) 1999-2010,2016 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -9,15 +9,32 @@
#define BOTAN_PK_KEY_FACTORY_H__
#include <botan/pk_keys.h>
+#include <botan/alg_id.h>
+#include <memory>
namespace Botan {
-Public_Key* make_public_key(const AlgorithmIdentifier& alg_id,
- const secure_vector<byte>& key_bits);
+BOTAN_DLL std::unique_ptr<Public_Key>
+load_public_key(const AlgorithmIdentifier& alg_id,
+ const secure_vector<byte>& key_bits);
-Private_Key* make_private_key(const AlgorithmIdentifier& alg_id,
- const secure_vector<byte>& key_bits,
- RandomNumberGenerator& rng);
+BOTAN_DLL std::unique_ptr<Private_Key>
+load_private_key(const AlgorithmIdentifier& alg_id,
+ const secure_vector<byte>& key_bits,
+ RandomNumberGenerator& rng);
+
+/**
+* Create a new key
+* For ECC keys, algo_params specifies EC group (eg, "secp256r1")
+* For DH/DSA/ElGamal keys, algo_params is DL group (eg, "modp/ietf/2048")
+* For RSA, algo_params is integer keylength
+* For McEliece, algo_params is n,t
+* If algo_params is left empty, suitable default parameters are chosen.
+*/
+BOTAN_DLL std::unique_ptr<Private_Key>
+create_private_key(const std::string& algo_name,
+ RandomNumberGenerator& rng,
+ const std::string& algo_params = "");
}