Botan  1.10.9
Public Member Functions | List of all members
Botan::Dynamically_Loaded_Engine Class Reference

#include <dyn_engine.h>

Inheritance diagram for Botan::Dynamically_Loaded_Engine:
Botan::Engine

Public Member Functions

 Dynamically_Loaded_Engine (const std::string &lib_path)
 
BlockCipherfind_block_cipher (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
 
HashFunctionfind_hash (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
 
MessageAuthenticationCodefind_mac (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
 
PBKDFfind_pbkdf (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
 
StreamCipherfind_stream_cipher (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
 
Keyed_Filterget_cipher (const std::string &algo_spec, Cipher_Dir dir, Algorithm_Factory &af)
 
PK_Ops::Decryptionget_decryption_op (const Private_Key &key) const
 
PK_Ops::Encryptionget_encryption_op (const Public_Key &key) const
 
PK_Ops::Key_Agreementget_key_agreement_op (const Private_Key &key) const
 
PK_Ops::Signatureget_signature_op (const Private_Key &key) const
 
PK_Ops::Verificationget_verify_op (const Public_Key &key) const
 
Modular_Exponentiatormod_exp (const BigInt &n, Power_Mod::Usage_Hints hints) const
 
std::string provider_name () const
 
 ~Dynamically_Loaded_Engine ()
 

Detailed Description

Dynamically_Loaded_Engine just proxies the requests to the underlying Engine object, and handles load/unload details

Definition at line 19 of file dyn_engine.h.

Constructor & Destructor Documentation

Botan::Dynamically_Loaded_Engine::Dynamically_Loaded_Engine ( const std::string &  lib_path)
Parameters
lib_pathfull pathname to DLL to load

Definition at line 22 of file dyn_engine.cpp.

References Botan::Dynamically_Loaded_Library::resolve(), and Botan::to_string().

23  :
24  engine(0)
25  {
26  lib = new Dynamically_Loaded_Library(library_path);
27 
28  try
29  {
30  module_version_func get_version =
31  lib->resolve<module_version_func>("module_version");
32 
33  const u32bit mod_version = get_version();
34 
35  if(mod_version != 20101003)
36  throw std::runtime_error("Incompatible version in " +
37  library_path + " of " +
38  to_string(mod_version));
39 
40  creator_func creator =
41  lib->resolve<creator_func>("create_engine");
42 
43  engine = creator();
44 
45  if(!engine)
46  throw std::runtime_error("Creator function in " +
47  library_path + " failed");
48  }
49  catch(...)
50  {
51  delete lib;
52  lib = 0;
53  throw;
54  }
55  }
T resolve(const std::string &symbol)
Definition: dyn_load.h:52
std::string to_string(u64bit n, size_t min_len)
Definition: parsing.cpp:42
unsigned int u32bit
Definition: types.h:32
Botan::Dynamically_Loaded_Engine::~Dynamically_Loaded_Engine ( )

Definition at line 57 of file dyn_engine.cpp.

58  {
59  delete engine;
60  delete lib;
61  }

Member Function Documentation

BlockCipher* Botan::Dynamically_Loaded_Engine::find_block_cipher ( const SCAN_Name algo_spec,
Algorithm_Factory af 
) const
inlinevirtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 31 of file dyn_engine.h.

33  {
34  return engine->find_block_cipher(algo_spec, af);
35  }
virtual BlockCipher * find_block_cipher(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:13
HashFunction* Botan::Dynamically_Loaded_Engine::find_hash ( const SCAN_Name algo_spec,
Algorithm_Factory af 
) const
inlinevirtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 43 of file dyn_engine.h.

45  {
46  return engine->find_hash(algo_spec, af);
47  }
virtual HashFunction * find_hash(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:27
MessageAuthenticationCode* Botan::Dynamically_Loaded_Engine::find_mac ( const SCAN_Name algo_spec,
Algorithm_Factory af 
) const
inlinevirtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 49 of file dyn_engine.h.

51  {
52  return engine->find_mac(algo_spec, af);
53  }
virtual MessageAuthenticationCode * find_mac(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:34
PBKDF* Botan::Dynamically_Loaded_Engine::find_pbkdf ( const SCAN_Name algo_spec,
Algorithm_Factory af 
) const
inlinevirtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 55 of file dyn_engine.h.

57  {
58  return engine->find_pbkdf(algo_spec, af);
59  }
virtual PBKDF * find_pbkdf(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:41
StreamCipher* Botan::Dynamically_Loaded_Engine::find_stream_cipher ( const SCAN_Name algo_spec,
Algorithm_Factory af 
) const
inlinevirtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 37 of file dyn_engine.h.

39  {
40  return engine->find_stream_cipher(algo_spec, af);
41  }
virtual StreamCipher * find_stream_cipher(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:20
Keyed_Filter* Botan::Dynamically_Loaded_Engine::get_cipher ( const std::string &  algo_spec,
Cipher_Dir  dir,
Algorithm_Factory af 
)
inlinevirtual

Return a new cipher object

Parameters
algo_specthe algorithm name/specification
dirspecifies if encryption or decryption is desired
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 67 of file dyn_engine.h.

70  {
71  return engine->get_cipher(algo_spec, dir, af);
72  }
virtual Keyed_Filter * get_cipher(const std::string &algo_spec, Cipher_Dir dir, Algorithm_Factory &af)
Definition: engine.cpp:54
PK_Ops::Decryption* Botan::Dynamically_Loaded_Engine::get_decryption_op ( const Private_Key key) const
inlinevirtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 99 of file dyn_engine.h.

100  {
101  return engine->get_decryption_op(key);
102  }
virtual PK_Ops::Decryption * get_decryption_op(const Private_Key &key) const
Definition: engine.cpp:86
PK_Ops::Encryption* Botan::Dynamically_Loaded_Engine::get_encryption_op ( const Public_Key key) const
inlinevirtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 93 of file dyn_engine.h.

94  {
95  return engine->get_encryption_op(key);
96  }
virtual PK_Ops::Encryption * get_encryption_op(const Public_Key &key) const
Definition: engine.cpp:80
PK_Ops::Key_Agreement* Botan::Dynamically_Loaded_Engine::get_key_agreement_op ( const Private_Key key) const
inlinevirtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 75 of file dyn_engine.h.

76  {
77  return engine->get_key_agreement_op(key);
78  }
virtual PK_Ops::Key_Agreement * get_key_agreement_op(const Private_Key &key) const
Definition: engine.cpp:62
PK_Ops::Signature* Botan::Dynamically_Loaded_Engine::get_signature_op ( const Private_Key key) const
inlinevirtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 81 of file dyn_engine.h.

82  {
83  return engine->get_signature_op(key);
84  }
virtual PK_Ops::Signature * get_signature_op(const Private_Key &key) const
Definition: engine.cpp:68
PK_Ops::Verification* Botan::Dynamically_Loaded_Engine::get_verify_op ( const Public_Key key) const
inlinevirtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 87 of file dyn_engine.h.

88  {
89  return engine->get_verify_op(key);
90  }
virtual PK_Ops::Verification * get_verify_op(const Public_Key &key) const
Definition: engine.cpp:74
Modular_Exponentiator* Botan::Dynamically_Loaded_Engine::mod_exp ( const BigInt n,
Power_Mod::Usage_Hints  hints 
) const
inlinevirtual
Parameters
nthe modulus
hintsany use hints
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 61 of file dyn_engine.h.

63  {
64  return engine->mod_exp(n, hints);
65  }
BigInt n
Definition: numthry.cpp:26
virtual Modular_Exponentiator * mod_exp(const BigInt &n, Power_Mod::Usage_Hints hints) const
Definition: engine.cpp:48
std::string Botan::Dynamically_Loaded_Engine::provider_name ( ) const
inlinevirtual
Returns
name of this engine

Implements Botan::Engine.

Definition at line 29 of file dyn_engine.h.

29 { return engine->provider_name(); }
virtual std::string provider_name() const =0

The documentation for this class was generated from the following files: