Botan 1.10.17
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

◆ Dynamically_Loaded_Engine()

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.

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 }
Dynamically_Loaded_Library(const std::string &lib_name)
Definition dyn_load.cpp:31
std::string to_string(u64bit n, size_t min_len)
Definition parsing.cpp:42
unsigned int u32bit
Definition types.h:32

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

◆ ~Dynamically_Loaded_Engine()

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

◆ find_block_cipher()

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 }

◆ find_hash()

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 }

◆ find_mac()

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 }

◆ find_pbkdf()

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 }

◆ find_stream_cipher()

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 }

◆ get_cipher()

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 }

◆ get_decryption_op()

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 }

◆ get_encryption_op()

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 }

◆ get_key_agreement_op()

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 }

◆ get_signature_op()

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 }

◆ get_verify_op()

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 }

◆ mod_exp()

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 }

◆ provider_name()

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(); }

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