diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/def_engine/def_pk_ops.cpp | 37 | ||||
-rw-r--r-- | src/engine/def_engine/default_engine.h | 2 | ||||
-rw-r--r-- | src/engine/engine.h | 5 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/engine/def_engine/def_pk_ops.cpp b/src/engine/def_engine/def_pk_ops.cpp index d1ee454a2..57d17f662 100644 --- a/src/engine/def_engine/def_pk_ops.cpp +++ b/src/engine/def_engine/def_pk_ops.cpp @@ -114,6 +114,43 @@ Default_Engine::get_signature_op(const Private_Key& key) const return 0; } +PK_Ops::Verification* +Default_Engine::get_verify_op(const Public_Key& key) const + { +#if defined(BOTAN_HAS_RSA) + if(const RSA_PublicKey* s = dynamic_cast<const RSA_PublicKey*>(&key)) + return new RSA_Verification_Operation(*s); +#endif + +#if defined(BOTAN_HAS_RW) + if(const RW_PublicKey* s = dynamic_cast<const RW_PublicKey*>(&key)) + return new RW_Verification_Operation(*s); +#endif + +#if defined(BOTAN_HAS_DSA) + if(const DSA_PublicKey* s = dynamic_cast<const DSA_PublicKey*>(&key)) + return new DSA_Verification_Operation(*s); +#endif + +#if defined(BOTAN_HAS_ECDSA) + if(const ECDSA_PublicKey* s = dynamic_cast<const ECDSA_PublicKey*>(&key)) + return new ECDSA_Verification_Operation(*s); +#endif + +#if defined(BOTAN_HAS_GOST_3410_2001) + if(const GOST_3410_PublicKey* s = + dynamic_cast<const GOST_3410_PublicKey*>(&key)) + return new GOST_3410_Verification_Operation(*s); +#endif + +#if defined(BOTAN_HAS_NYBERG_RUEPPEL) + if(const NR_PublicKey* s = dynamic_cast<const NR_PublicKey*>(&key)) + return new NR_Verification_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 9f18ca469..4e21fb3a5 100644 --- a/src/engine/def_engine/default_engine.h +++ b/src/engine/def_engine/default_engine.h @@ -26,6 +26,8 @@ class Default_Engine : public Engine PK_Ops::Signature_Operation* get_signature_op(const Private_Key& key) const; + PK_Ops::Verification* get_verify_op(const Public_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&, diff --git a/src/engine/engine.h b/src/engine/engine.h index 6087af52c..b0bbf5b14 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -90,6 +90,11 @@ class BOTAN_DLL Engine return 0; } + virtual PK_Ops::Verification* get_verify_op(const Public_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&, |