aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/look_pk.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-11 20:54:18 +0000
committerlloyd <[email protected]>2008-11-11 20:54:18 +0000
commit8986f83af617d76e54ae40348d0a77ea1e5e51e4 (patch)
tree419cebf489bd28084615290bccd63516b4ca2696 /src/libstate/look_pk.cpp
parente7e3551e44f8defc6d78be4e513ea5ee2631933b (diff)
Remove pk_lookup - half of it (look_pk.{cpp,h}) depended on libstate directly,
the other half was relied upon by pubkey. Move the contents into those two modules. Update deps.
Diffstat (limited to 'src/libstate/look_pk.cpp')
-rw-r--r--src/libstate/look_pk.cpp74
1 files changed, 74 insertions, 0 deletions
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));
+ }
+
+}