aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/def_engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/def_engine')
-rw-r--r--src/engine/def_engine/def_pk_ops.cpp45
-rw-r--r--src/engine/def_engine/default_engine.h11
2 files changed, 37 insertions, 19 deletions
diff --git a/src/engine/def_engine/def_pk_ops.cpp b/src/engine/def_engine/def_pk_ops.cpp
index 7dd7e0219..e99908aa5 100644
--- a/src/engine/def_engine/def_pk_ops.cpp
+++ b/src/engine/def_engine/def_pk_ops.cpp
@@ -13,7 +13,6 @@
#endif
#if defined(BOTAN_HAS_RW)
- #include <botan/if_op.h>
#include <botan/rw.h>
#endif
@@ -27,7 +26,6 @@
#if defined(BOTAN_HAS_ELGAMAL)
#include <botan/elgamal.h>
- #include <botan/elg_op.h>
#endif
#if defined(BOTAN_HAS_GOST_3410_2001)
@@ -48,6 +46,38 @@
namespace Botan {
+PK_Ops::Encryption*
+Default_Engine::get_encryption_op(const Public_Key& key) const
+ {
+#if 0 && defined(BOTAN_HAS_RSA)
+ if(const RSA_PublicKey* s = dynamic_cast<const RSA_PublicKey*>(&key))
+ return new RSA_Encryption_Operation(*s);
+#endif
+
+#if defined(BOTAN_HAS_ELGAMAL)
+ if(const ElGamal_PublicKey* s = dynamic_cast<const ElGamal_PublicKey*>(&key))
+ return new ElGamal_Encryption_Operation(*s);
+#endif
+
+ return 0;
+ }
+
+PK_Ops::Decryption*
+Default_Engine::get_decryption_op(const Private_Key& key) const
+ {
+#if 0 && defined(BOTAN_HAS_RSA)
+ if(const RSA_PrivateKey* s = dynamic_cast<const RSA_PrivateKey*>(&key))
+ return new RSA_Decryption_Operation(*s);
+#endif
+
+#if defined(BOTAN_HAS_ELGAMAL)
+ if(const ElGamal_PrivateKey* s = dynamic_cast<const ElGamal_PrivateKey*>(&key))
+ return new ElGamal_Decryption_Operation(*s);
+#endif
+
+ return 0;
+ }
+
PK_Ops::Key_Agreement*
Default_Engine::get_key_agreement_op(const Private_Key& key) const
{
@@ -151,15 +181,4 @@ IF_Operation* Default_Engine::if_op(const BigInt& e, const BigInt& n,
}
#endif
-#if defined(BOTAN_HAS_ELGAMAL)
-/*
-* Acquire an ElGamal op
-*/
-ELG_Operation* Default_Engine::elg_op(const DL_Group& group, const BigInt& y,
- const BigInt& x) const
- {
- return new Default_ELG_Op(group, y, x);
- }
-#endif
-
}
diff --git a/src/engine/def_engine/default_engine.h b/src/engine/def_engine/default_engine.h
index b77f5ce91..9edd25d2b 100644
--- a/src/engine/def_engine/default_engine.h
+++ b/src/engine/def_engine/default_engine.h
@@ -28,18 +28,17 @@ class Default_Engine : public Engine
PK_Ops::Verification* get_verify_op(const Public_Key& key) const;
+ PK_Ops::Encryption* get_encryption_op(const Public_Key& key) const;
+
+ PK_Ops::Decryption* get_decryption_op(const Private_Key& key) const;
+
#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
const BigInt&, const BigInt&, const BigInt&,
const BigInt&, const BigInt&) const;
#endif
-#if defined(BOTAN_HAS_ELGAMAL)
- ELG_Operation* elg_op(const DL_Group&, const BigInt&,
- const BigInt&) const;
-#endif
-
- Modular_Exponentiator* mod_exp(const BigInt&,
+ Modular_Exponentiator* mod_exp(const BigInt& n,
Power_Mod::Usage_Hints) const;
virtual bool can_add_algorithms() { return true; }