diff options
author | lloyd <[email protected]> | 2010-03-05 16:10:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-05 16:10:55 +0000 |
commit | df56028cad58fad04b9866326cb62700af8f2fbe (patch) | |
tree | dcaa1a80c9f20db7b7993ac54b1aaafd488354c0 /src/engine/def_engine | |
parent | 93873731f73e905d8714556f1ebe23acb32de0e1 (diff) |
Add verification ops for all signature key types
Diffstat (limited to 'src/engine/def_engine')
-rw-r--r-- | src/engine/def_engine/def_pk_ops.cpp | 37 | ||||
-rw-r--r-- | src/engine/def_engine/default_engine.h | 2 |
2 files changed, 39 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&, |