Botan  1.10.9
dyn_engine.h
Go to the documentation of this file.
1 /**
2 * Dynamically Loaded Engine
3 * (C) 2010 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_DYN_LOADED_ENGINE_H__
9 #define BOTAN_DYN_LOADED_ENGINE_H__
10 
11 #include <botan/engine.h>
12 
13 namespace Botan {
14 
15 /**
16 * Dynamically_Loaded_Engine just proxies the requests to the underlying
17 * Engine object, and handles load/unload details
18 */
19 class BOTAN_DLL Dynamically_Loaded_Engine : public Engine
20  {
21  public:
22  /**
23  * @param lib_path full pathname to DLL to load
24  */
25  Dynamically_Loaded_Engine(const std::string& lib_path);
26 
28 
29  std::string provider_name() const { return engine->provider_name(); }
30 
32  Algorithm_Factory& af) const
33  {
34  return engine->find_block_cipher(algo_spec, af);
35  }
36 
38  Algorithm_Factory& af) const
39  {
40  return engine->find_stream_cipher(algo_spec, af);
41  }
42 
43  HashFunction* find_hash(const SCAN_Name& algo_spec,
44  Algorithm_Factory& af) const
45  {
46  return engine->find_hash(algo_spec, af);
47  }
48 
50  Algorithm_Factory& af) const
51  {
52  return engine->find_mac(algo_spec, af);
53  }
54 
55  PBKDF* find_pbkdf(const SCAN_Name& algo_spec,
56  Algorithm_Factory& af) const
57  {
58  return engine->find_pbkdf(algo_spec, af);
59  }
60 
62  Power_Mod::Usage_Hints hints) const
63  {
64  return engine->mod_exp(n, hints);
65  }
66 
67  Keyed_Filter* get_cipher(const std::string& algo_spec,
68  Cipher_Dir dir,
70  {
71  return engine->get_cipher(algo_spec, dir, af);
72  }
73 
76  {
77  return engine->get_key_agreement_op(key);
78  }
79 
81  get_signature_op(const Private_Key& key) const
82  {
83  return engine->get_signature_op(key);
84  }
85 
87  get_verify_op(const Public_Key& key) const
88  {
89  return engine->get_verify_op(key);
90  }
91 
93  get_encryption_op(const Public_Key& key) const
94  {
95  return engine->get_encryption_op(key);
96  }
97 
99  get_decryption_op(const Private_Key& key) const
100  {
101  return engine->get_decryption_op(key);
102  }
103 
104  private:
105  class Dynamically_Loaded_Library* lib;
106  Engine* engine;
107  };
108 
109 }
110 
111 #endif
BigInt n
Definition: numthry.cpp:26
PK_Ops::Encryption * get_encryption_op(const Public_Key &key) const
Definition: dyn_engine.h:93
PBKDF * find_pbkdf(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: dyn_engine.h:55
std::string provider_name() const
Definition: dyn_engine.h:29
StreamCipher * find_stream_cipher(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: dyn_engine.h:37
PK_Ops::Signature * get_signature_op(const Private_Key &key) const
Definition: dyn_engine.h:81
Keyed_Filter * get_cipher(const std::string &algo_spec, Cipher_Dir dir, Algorithm_Factory &af)
Definition: dyn_engine.h:67
HashFunction * find_hash(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: dyn_engine.h:43
BlockCipher * find_block_cipher(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: dyn_engine.h:31
PK_Ops::Decryption * get_decryption_op(const Private_Key &key) const
Definition: dyn_engine.h:99
PK_Ops::Key_Agreement * get_key_agreement_op(const Private_Key &key) const
Definition: dyn_engine.h:75
Modular_Exponentiator * mod_exp(const BigInt &n, Power_Mod::Usage_Hints hints) const
Definition: dyn_engine.h:61
PK_Ops::Verification * get_verify_op(const Public_Key &key) const
Definition: dyn_engine.h:87
Cipher_Dir
Definition: sym_algo.h:87
MessageAuthenticationCode * find_mac(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: dyn_engine.h:49