aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-01 15:41:43 +0000
committerlloyd <[email protected]>2008-10-01 15:41:43 +0000
commit97b4b23a88c27bc154a3751e8e99cd75b7ea8e84 (patch)
tree9ab607b9aee676e1d99f68cde9cae6ccc57a9da6 /src/pubkey
parentc4f77168873558a1e73587b9e405afab7282d859 (diff)
Move look_pk from libstate to pubkey/pubkey as more appropriate
Diffstat (limited to 'src/pubkey')
-rw-r--r--src/pubkey/pubkey/info.txt2
-rw-r--r--src/pubkey/pubkey/look_pk.cpp74
-rw-r--r--src/pubkey/pubkey/look_pk.h39
3 files changed, 115 insertions, 0 deletions
diff --git a/src/pubkey/pubkey/info.txt b/src/pubkey/pubkey/info.txt
index b02f2b5b1..f6bb64a41 100644
--- a/src/pubkey/pubkey/info.txt
+++ b/src/pubkey/pubkey/info.txt
@@ -11,6 +11,8 @@ asn1
</requires>
<add>
+look_pk.cpp
+look_pk.h
pk_algs.cpp
pk_algs.h
pk_keys.cpp
diff --git a/src/pubkey/pubkey/look_pk.cpp b/src/pubkey/pubkey/look_pk.cpp
new file mode 100644
index 000000000..a4062b57c
--- /dev/null
+++ b/src/pubkey/pubkey/look_pk.cpp
@@ -0,0 +1,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);
+ }
+
+}
diff --git a/src/pubkey/pubkey/look_pk.h b/src/pubkey/pubkey/look_pk.h
new file mode 100644
index 000000000..28a56f2b3
--- /dev/null
+++ b/src/pubkey/pubkey/look_pk.h
@@ -0,0 +1,39 @@
+/*************************************************
+* PK Algorithm Lookup Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_PK_LOOKUP_H__
+#define BOTAN_PK_LOOKUP_H__
+
+#include <botan/build.h>
+#include <botan/pubkey.h>
+
+namespace Botan {
+
+/*************************************************
+* Get an PK algorithm object *
+*************************************************/
+BOTAN_DLL PK_Encryptor* get_pk_encryptor(const PK_Encrypting_Key&,
+ const std::string&);
+
+BOTAN_DLL PK_Decryptor* get_pk_decryptor(const PK_Decrypting_Key&,
+ const std::string&);
+
+BOTAN_DLL PK_Signer* get_pk_signer(const PK_Signing_Key&,
+ const std::string&,
+ Signature_Format = IEEE_1363);
+
+BOTAN_DLL PK_Verifier* get_pk_verifier(const PK_Verifying_with_MR_Key&,
+ const std::string&,
+ Signature_Format = IEEE_1363);
+BOTAN_DLL PK_Verifier* get_pk_verifier(const PK_Verifying_wo_MR_Key&,
+ const std::string&,
+ Signature_Format = IEEE_1363);
+
+BOTAN_DLL PK_Key_Agreement* get_pk_kas(const PK_Key_Agreement_Key&,
+ const std::string&);
+
+}
+
+#endif