Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | List of all members
Botan::PKCS11::Module Class Referencefinal

`#include <p11_types.h>`

## Public Member Functions
Info | get_info () const
| Module (const Module &other)=delete
| Module (const std::string &file_path, C_InitializeArgs init_args={ nullptr, nullptr, nullptr, nullptr, static_cast< CK_FLAGS >(Flag::OsLockingOk), nullptr })
| Module (Module &&other)
LowLevel * | operator-> () const
Module & | operator= (const Module &other)=delete
Module & | operator= (Module &&other)=delete
void | reload (C_InitializeArgs init_args={ nullptr, nullptr, nullptr, nullptr, static_cast< CK_FLAGS >(Flag::OsLockingOk), nullptr })
| ~Module () noexcept
| Calls C_Finalize() More...

## Detailed Description

Loads the PKCS#11 shared library Calls C_Initialize on load and C_Finalize on destruction

Definition at line 28 of file p11_types.h.

## Constructor & Destructor Documentation

## ◆ Module() [1/3]

Botan::PKCS11::Module::Module | ( | const std::string & | file_path,
|  | C_InitializeArgs | init_args = `{ nullptr, nullptr, nullptr, nullptr, static_cast< CK_FLAGS >(Flag::OsLockingOk), nullptr }`
| ) |  |

Loads the shared library and calls C_Initialize

Parameters

  file_path | the path to the PKCS#11 shared library
  init_args | flags to use for `C_Initialize`

Definition at line 18 of file p11_module.cpp.

19 : m_file_path(file_path)
20 {
21 if(file_path.empty())
22 throw Invalid_Argument("PKCS11 no module path specified");
23 reload(init_args);
24 }
Botan::PKCS11::Module::reload
void reload(C_InitializeArgs init_args={ nullptr, nullptr, nullptr, nullptr, static_cast< CK_FLAGS >(Flag::OsLockingOk), nullptr })
Definition: p11_module.cpp:38

References reload().

## ◆ Module() [2/3]

Botan::PKCS11::Module::Module | ( | Module && | other | ) |
| default

## ◆ Module() [3/3]

Botan::PKCS11::Module::Module | ( | const Module & | other | ) |
| delete

## ◆ ~Module()

Botan::PKCS11::Module::~Module | ( |  | ) |
| noexcept

Calls C_Finalize()

Definition at line 26 of file p11_module.cpp.

27 {
28 try
29 {
30 m_low_level->C_Finalize(nullptr, nullptr);
31 }
32 catch(...)
33 {
34 // we are noexcept and must swallow any exception here
35 }
36 }

## Member Function Documentation

## ◆ get_info()

Info Botan::PKCS11::Module::get_info | ( |  | ) | const
| inline

Returns
  general information about Cryptoki

Definition at line 61 of file p11_types.h.

62 {
63 Info info;
64 m_low_level->C_GetInfo(&info);
65 return info;
66 }
Botan::PKCS11::Info
CK_INFO Info
Definition: p11.h:835

## ◆ operator->()

LowLevel * Botan::PKCS11::Module::operator-> | ( |  | ) | const
| inline

Definition at line 55 of file p11_types.h.

56 {
57 return m_low_level.get();
58 }

## ◆ operator=() [1/2]

Module & Botan::PKCS11::Module::operator= | ( | const Module & | other | ) |
| delete

References Botan::PKCS11::OsLockingOk.

## ◆ operator=() [2/2]

Module & Botan::PKCS11::Module::operator= | ( | Module && | other | ) |
| delete

## ◆ reload()

void Botan::PKCS11::Module::reload | ( | C_InitializeArgs | init_args = `{ nullptr, nullptr, nullptr, nullptr, static_cast< CK_FLAGS >(Flag::OsLockingOk), nullptr }` | ) |

Reloads the module and reinitializes it

Parameters

  init_args | flags to use for `C_Initialize`

Definition at line 38 of file p11_module.cpp.

39 {
40 if(m_low_level)
41 {
42 m_low_level->C_Finalize(nullptr);
43 }
44
45 m_library.reset(new Dynamically_Loaded_Library(m_file_path));
46 LowLevel::C_GetFunctionList(*m_library, &m_func_list);
47 m_low_level.reset(new LowLevel(m_func_list));
48
49 m_low_level->C_Initialize(&init_args);
50 }
Botan::PKCS11::LowLevel::C_GetFunctionList
static bool C_GetFunctionList(Dynamically_Loaded_Library &pkcs11_module, FunctionListPtr *function_list_ptr_ptr, ReturnValue *return_value=ThrowException)
Definition: p11.cpp:103

References Botan::PKCS11::LowLevel::C_GetFunctionList().

Referenced by Module().

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

- src/lib/prov/pkcs11/p11_types.h
- src/lib/prov/pkcs11/p11_module.cpp