aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/def_engine/def_pk_ops.cpp67
-rw-r--r--src/engine/def_engine/default_engine.h6
-rw-r--r--src/engine/engine.h6
3 files changed, 77 insertions, 2 deletions
diff --git a/src/engine/def_engine/def_pk_ops.cpp b/src/engine/def_engine/def_pk_ops.cpp
index b2f53376d..d1ee454a2 100644
--- a/src/engine/def_engine/def_pk_ops.cpp
+++ b/src/engine/def_engine/def_pk_ops.cpp
@@ -1,6 +1,6 @@
/*
* PK Operations
-* (C) 1999-2007 Jack Lloyd
+* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -23,6 +23,34 @@
#include <botan/elg_op.h>
#endif
+#if defined(BOTAN_HAS_RSA)
+ #include <botan/rsa.h>
+#endif
+
+#if defined(BOTAN_HAS_RW)
+ #include <botan/rw.h>
+#endif
+
+#if defined(BOTAN_HAS_DSA)
+ #include <botan/dsa.h>
+#endif
+
+#if defined(BOTAN_HAS_ECDSA)
+ #include <botan/ecdsa.h>
+#endif
+
+#if defined(BOTAN_HAS_ELGAMAL)
+ #include <botan/elgamal.h>
+#endif
+
+#if defined(BOTAN_HAS_GOST_3410_2001)
+ #include <botan/gost_3410.h>
+#endif
+
+#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
+ #include <botan/nr.h>
+#endif
+
#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
#include <botan/dh.h>
#endif
@@ -49,6 +77,43 @@ Default_Engine::get_key_agreement_op(const Private_Key& key) const
return 0;
}
+PK_Ops::Signature_Operation*
+Default_Engine::get_signature_op(const Private_Key& key) const
+ {
+#if defined(BOTAN_HAS_RSA)
+ if(const RSA_PrivateKey* s = dynamic_cast<const RSA_PrivateKey*>(&key))
+ return new RSA_Signature_Operation(*s);
+#endif
+
+#if defined(BOTAN_HAS_RW)
+ if(const RW_PrivateKey* s = dynamic_cast<const RW_PrivateKey*>(&key))
+ return new RW_Signature_Operation(*s);
+#endif
+
+#if defined(BOTAN_HAS_DSA)
+ if(const DSA_PrivateKey* s = dynamic_cast<const DSA_PrivateKey*>(&key))
+ return new DSA_Signature_Operation(*s);
+#endif
+
+#if defined(BOTAN_HAS_ECDSA)
+ if(const ECDSA_PrivateKey* s = dynamic_cast<const ECDSA_PrivateKey*>(&key))
+ return new ECDSA_Signature_Operation(*s);
+#endif
+
+#if defined(BOTAN_HAS_GOST_3410_2001)
+ if(const GOST_3410_PrivateKey* s =
+ dynamic_cast<const GOST_3410_PrivateKey*>(&key))
+ return new GOST_3410_Signature_Operation(*s);
+#endif
+
+#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
+ if(const NR_PrivateKey* s = dynamic_cast<const NR_PrivateKey*>(&key))
+ return new NR_Signature_Operation(*s);
+#endif
+
+ return 0;
+ }
+
#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
/*
* Acquire an IF op
diff --git a/src/engine/def_engine/default_engine.h b/src/engine/def_engine/default_engine.h
index 918a42114..9f18ca469 100644
--- a/src/engine/def_engine/default_engine.h
+++ b/src/engine/def_engine/default_engine.h
@@ -20,7 +20,11 @@ class Default_Engine : public Engine
public:
std::string provider_name() const { return "core"; }
- PK_Ops::KA_Operation* get_key_agreement_op(const Private_Key&) const;
+ PK_Ops::KA_Operation*
+ get_key_agreement_op(const Private_Key& key) const;
+
+ PK_Ops::Signature_Operation*
+ get_signature_op(const Private_Key& key) const;
#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
diff --git a/src/engine/engine.h b/src/engine/engine.h
index ea9c05997..6087af52c 100644
--- a/src/engine/engine.h
+++ b/src/engine/engine.h
@@ -84,6 +84,12 @@ class BOTAN_DLL Engine
return 0;
}
+ virtual PK_Ops::Signature_Operation*
+ get_signature_op(const Private_Key&) const
+ {
+ return 0;
+ }
+
#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
virtual IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
const BigInt&, const BigInt&, const BigInt&,