Botan 1.10.17

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

`#include <dyn_engine.h>`

Inheritance diagram for Botan::Dynamically_Loaded_Engine:

## Public Member Functions
| Dynamically_Loaded_Engine (const std::string &lib_path)
BlockCipher * | find_block_cipher (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
HashFunction * | find_hash (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
MessageAuthenticationCode * | find_mac (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
PBKDF * | find_pbkdf (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
StreamCipher * | find_stream_cipher (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Keyed_Filter * | get_cipher (const std::string &algo_spec, Cipher_Dir dir, Algorithm_Factory &af)
PK_Ops::Decryption * | get_decryption_op (const Private_Key &key) const
PK_Ops::Encryption * | get_encryption_op (const Public_Key &key) const
PK_Ops::Key_Agreement * | get_key_agreement_op (const Private_Key &key) const
PK_Ops::Signature * | get_signature_op (const Private_Key &key) const
PK_Ops::Verification * | get_verify_op (const Public_Key &key) const
Modular_Exponentiator * | mod_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_path | full 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 }
Botan::Dynamically_Loaded_Library::resolve
T resolve(const std::string &symbol)
Definition: dyn_load.h:52
Botan::to_string
std::string to_string(u64bit n, size_t min_len)
Definition: parsing.cpp:42
Botan::u32bit
unsigned int u32bit
Definition: types.h:32

## ◆ ~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
| inline virtual

Parameters

  algo_spec | the algorithm name/specification
  af | an 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 }
Botan::Engine::find_block_cipher
virtual BlockCipher * find_block_cipher(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:13

## ◆ find_hash()

HashFunction* Botan::Dynamically_Loaded_Engine::find_hash | ( | const SCAN_Name & | algo_spec,
|  | Algorithm_Factory & | af
| ) |  | const
| inline virtual

Parameters

  algo_spec | the algorithm name/specification
  af | an 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 }
Botan::Engine::find_hash
virtual HashFunction * find_hash(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:27

## ◆ find_mac()

MessageAuthenticationCode* Botan::Dynamically_Loaded_Engine::find_mac | ( | const SCAN_Name & | algo_spec,
|  | Algorithm_Factory & | af
| ) |  | const
| inline virtual

Parameters

  algo_spec | the algorithm name/specification
  af | an 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 }
Botan::Engine::find_mac
virtual MessageAuthenticationCode * find_mac(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:34

## ◆ find_pbkdf()

PBKDF* Botan::Dynamically_Loaded_Engine::find_pbkdf | ( | const SCAN_Name & | algo_spec,
|  | Algorithm_Factory & | af
| ) |  | const
| inline virtual

Parameters

  algo_spec | the algorithm name/specification
  af | an 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 }
Botan::Engine::find_pbkdf
virtual PBKDF * find_pbkdf(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:41

## ◆ find_stream_cipher()

StreamCipher* Botan::Dynamically_Loaded_Engine::find_stream_cipher | ( | const SCAN_Name & | algo_spec,
|  | Algorithm_Factory & | af
| ) |  | const
| inline virtual

Parameters

  algo_spec | the algorithm name/specification
  af | an 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 }
Botan::Engine::find_stream_cipher
virtual StreamCipher * find_stream_cipher(const SCAN_Name &algo_spec, Algorithm_Factory &af) const
Definition: engine.cpp:20

## ◆ get_cipher()

Keyed_Filter* Botan::Dynamically_Loaded_Engine::get_cipher | ( | const std::string & | algo_spec,
|  | Cipher_Dir | dir,
|  | Algorithm_Factory & | af
| ) |  |
| inline virtual

Return a new cipher object

Parameters

  algo_spec | the algorithm name/specification
  dir | specifies if encryption or decryption is desired
  af | an 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 }
Botan::Engine::get_cipher
virtual Keyed_Filter * get_cipher(const std::string &algo_spec, Cipher_Dir dir, Algorithm_Factory &af)
Definition: engine.cpp:54

## ◆ get_decryption_op()

PK_Ops::Decryption* Botan::Dynamically_Loaded_Engine::get_decryption_op | ( | const Private_Key & | key | ) | const
| inline virtual

Return a new operator object for this key, if possible

Parameters

  key | the 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 }
Botan::Engine::get_decryption_op
virtual PK_Ops::Decryption * get_decryption_op(const Private_Key &key) const
Definition: engine.cpp:86

## ◆ get_encryption_op()

PK_Ops::Encryption* Botan::Dynamically_Loaded_Engine::get_encryption_op | ( | const Public_Key & | key | ) | const
| inline virtual

Return a new operator object for this key, if possible

Parameters

  key | the 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 }
Botan::Engine::get_encryption_op
virtual PK_Ops::Encryption * get_encryption_op(const Public_Key &key) const
Definition: engine.cpp:80

## ◆ get_key_agreement_op()

PK_Ops::Key_Agreement* Botan::Dynamically_Loaded_Engine::get_key_agreement_op | ( | const Private_Key & | key | ) | const
| inline virtual

Return a new operator object for this key, if possible

Parameters

  key | the 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 }
Botan::Engine::get_key_agreement_op
virtual PK_Ops::Key_Agreement * get_key_agreement_op(const Private_Key &key) const
Definition: engine.cpp:62

## ◆ get_signature_op()

PK_Ops::Signature* Botan::Dynamically_Loaded_Engine::get_signature_op | ( | const Private_Key & | key | ) | const
| inline virtual

Return a new operator object for this key, if possible

Parameters

  key | the 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 }
Botan::Engine::get_signature_op
virtual PK_Ops::Signature * get_signature_op(const Private_Key &key) const
Definition: engine.cpp:68

## ◆ get_verify_op()

PK_Ops::Verification* Botan::Dynamically_Loaded_Engine::get_verify_op | ( | const Public_Key & | key | ) | const
| inline virtual

Return a new operator object for this key, if possible

Parameters

  key | the 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 }
Botan::Engine::get_verify_op
virtual PK_Ops::Verification * get_verify_op(const Public_Key &key) const
Definition: engine.cpp:74

## ◆ mod_exp()

Modular_Exponentiator* Botan::Dynamically_Loaded_Engine::mod_exp | ( | const BigInt & | n,
|  | Power_Mod::Usage_Hints | hints
| ) |  | const
| inline virtual

Parameters

  n | the modulus
  hints | any 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 }
Botan::Engine::mod_exp
virtual Modular_Exponentiator * mod_exp(const BigInt &n, Power_Mod::Usage_Hints hints) const
Definition: engine.cpp:48

## ◆ provider_name()

std::string Botan::Dynamically_Loaded_Engine::provider_name | ( |  | ) | const
| inline virtual

Returns
  name of this engine

Implements Botan::Engine.

Definition at line 29 of file dyn_engine.h.

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

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

- src/engine/dyn_engine/dyn_engine.h
- src/engine/dyn_engine/dyn_engine.cpp