aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstate')
-rw-r--r--src/libstate/info.txt8
-rw-r--r--src/libstate/look_pk.cpp74
-rw-r--r--src/libstate/look_pk.h76
3 files changed, 155 insertions, 3 deletions
diff --git a/src/libstate/info.txt b/src/libstate/info.txt
index 1ac76f1a4..f3111a31e 100644
--- a/src/libstate/info.txt
+++ b/src/libstate/info.txt
@@ -16,13 +16,15 @@ system_alloc
<add>
botan.h
get_enc.cpp
-init.h
init.cpp
+init.h
libstate.cpp
libstate.h
+look_pk.cpp
+look_pk.h
lookup.cpp
lookup.h
-policy.cpp
-pk_engine.h
pk_engine.cpp
+pk_engine.h
+policy.cpp
</add>
diff --git a/src/libstate/look_pk.cpp b/src/libstate/look_pk.cpp
new file mode 100644
index 000000000..d72c1ce0f
--- /dev/null
+++ b/src/libstate/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, get_eme(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, get_eme(eme));
+ }
+
+/*************************************************
+* Get a PK_Signer object *
+*************************************************/
+PK_Signer* get_pk_signer(const PK_Signing_Key& key,
+ const std::string& emsa,
+ Signature_Format sig_format)
+ {
+ PK_Signer* signer = new PK_Signer(key, get_emsa(emsa));
+ 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& emsa,
+ Signature_Format sig_format)
+ {
+ PK_Verifier* verifier = new PK_Verifier_with_MR(key, get_emsa(emsa));
+ 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& emsa,
+ Signature_Format sig_format)
+ {
+ PK_Verifier* verifier = new PK_Verifier_wo_MR(key, get_emsa(emsa));
+ 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, get_kdf(kdf));
+ }
+
+}
diff --git a/src/libstate/look_pk.h b/src/libstate/look_pk.h
new file mode 100644
index 000000000..926416a41
--- /dev/null
+++ b/src/libstate/look_pk.h
@@ -0,0 +1,76 @@
+/*************************************************
+* 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 {
+
+/**
+* Public key encryptor factory method.
+* @param key the key that will work inside the encryptor
+* @param pad determines the algorithm and encoding
+* @return the public key encryptor object
+*/
+BOTAN_DLL PK_Encryptor* get_pk_encryptor(const PK_Encrypting_Key& key,
+ const std::string& pad);
+
+/**
+* Public key decryptor factory method.
+* @param key the key that will work inside the decryptor
+* @param pad determines the algorithm and encoding
+* @return the public key decryptor object
+*/
+BOTAN_DLL PK_Decryptor* get_pk_decryptor(const PK_Decrypting_Key& key,
+ const std::string& pad);
+
+/**
+* Public key signer factory method.
+* @param key the key that will work inside the signer
+* @param pad determines the algorithm, encoding and hash algorithm
+* @param sig_format the signature format to be used
+* @return the public key signer object
+*/
+BOTAN_DLL PK_Signer* get_pk_signer(const PK_Signing_Key& key,
+ const std::string& pad,
+ Signature_Format = IEEE_1363);
+
+/**
+* Public key verifier factory method.
+* @param key the key that will work inside the verifier
+* @param pad determines the algorithm, encoding and hash algorithm
+* @param sig_format the signature format to be used
+* @return the public key verifier object
+*/
+BOTAN_DLL PK_Verifier* get_pk_verifier(const PK_Verifying_with_MR_Key& key,
+ const std::string& pad,
+ Signature_Format = IEEE_1363);
+
+/**
+* Public key verifier factory method.
+* @param key the key that will work inside the verifier
+* @param pad determines the algorithm, encoding and hash algorithm
+* @param sig_form the signature format to be used
+* @return the public key verifier object
+*/
+BOTAN_DLL PK_Verifier* get_pk_verifier(const PK_Verifying_wo_MR_Key& key,
+ const std::string& pad,
+ Signature_Format sig_form = IEEE_1363);
+
+/**
+* Public key key agreement factory method.
+* @param key the key that will work inside the key agreement
+* @param pad determines the algorithm, encoding and hash algorithm
+* @return the public key verifier object
+*/
+BOTAN_DLL PK_Key_Agreement* get_pk_kas(const PK_Key_Agreement_Key& key,
+ const std::string& pad);
+
+}
+
+#endif