Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

Represents a PKCS#11 Slot, i.e., a card reader. More...

`#include <p11_slot.h>`

## Public Member Functions
MechanismInfo | get_mechanism_info (MechanismType mechanism_type) const
| Obtains information about a particular mechanism possibly supported by a slot (`C_GetMechanismInfo`) More...
std::vector< MechanismType > | get_mechanism_list () const
| Obtains a list of mechanism types supported by the slot (`C_GetMechanismList`) More...
SlotInfo | get_slot_info () const
TokenInfo | get_token_info () const
| Obtains information about a particular token in the system (`C_GetTokenInfo`) More...
void | initialize (const std::string &label, const secure_string &so_pin) const
Module & | module () const
| Slot (Module &module, SlotId slot_id)
SlotId | slot_id () const

## Static Public Member Functions
static std::vector< SlotId > | get_available_slots (Module &module, bool token_present)

## Detailed Description

Represents a PKCS#11 Slot, i.e., a card reader.

Definition at line 23 of file p11_slot.h.

## Constructor & Destructor Documentation

Botan::PKCS11::Slot::Slot | ( | Module & | module,
|  | SlotId | slot_id
| ) |  |

Parameters

  module | the PKCS#11 module to use
  slot_id | the slot id to use

Definition at line 15 of file p11_slot.cpp.

16 : m_module(module), m_slot_id(slot_id)
17 {}
Botan::PKCS11::Slot::slot_id
SlotId slot_id() const
Definition: p11_slot.h:39
Botan::PKCS11::Slot::module
Module & module() const
Definition: p11_slot.h:33

## Member Function Documentation

std::vector< SlotId > Botan::PKCS11::Slot::get_available_slots | ( | Module & | module,
|  | bool | token_present
| ) |  |
| static

Get available slots

Parameters

  module | the module to use
  token_present | true if only slots with attached tokens should be returned, false for all slots

Returns
  a list of available slots (calls C_GetSlotList)

Definition at line 40 of file p11_slot.cpp.

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

41 {
42 std::vector<SlotId> slot_vec;
43 module->C_GetSlotList(token_present, slot_vec);
44 return slot_vec;
45 }
Botan::PKCS11::LowLevel::C_GetSlotList
bool C_GetSlotList(Bbool token_present, SlotId *slot_list_ptr, Ulong *count_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:114
Botan::PKCS11::Slot::module
Module & module() const
Definition: p11_slot.h:33

MechanismInfo Botan::PKCS11::Slot::get_mechanism_info | ( | MechanismType | mechanism_type | ) | const

Obtains information about a particular mechanism possibly supported by a slot (`C_GetMechanismInfo`)

Definition at line 33 of file p11_slot.cpp.

34 {
35 MechanismInfo mechanism_info = {};
36 m_module.get()->C_GetMechanismInfo(m_slot_id, mechanism_type, &mechanism_info);
37 return mechanism_info;
38 }
Botan::PKCS11::MechanismInfo
CK_MECHANISM_INFO MechanismInfo
Definition: p11.h:840

std::vector< MechanismType > Botan::PKCS11::Slot::get_mechanism_list | ( |  | ) | const

Obtains a list of mechanism types supported by the slot (`C_GetMechanismList`)

Definition at line 26 of file p11_slot.cpp.

27 {
28 std::vector<MechanismType> mechanism_list;
29 m_module.get()->C_GetMechanismList(m_slot_id, mechanism_list);
30 return mechanism_list;
31 }

SlotInfo Botan::PKCS11::Slot::get_slot_info | ( |  | ) | const

Returns
  information about the slot (`C_GetSlotInfo`)

Definition at line 19 of file p11_slot.cpp.

20 {
21 SlotInfo slot_info = {};
22 m_module.get()->C_GetSlotInfo(m_slot_id, &slot_info);
23 return slot_info;
24 }
Botan::PKCS11::SlotInfo
CK_SLOT_INFO SlotInfo
Definition: p11.h:837

TokenInfo Botan::PKCS11::Slot::get_token_info | ( |  | ) | const

Obtains information about a particular token in the system (`C_GetTokenInfo`)

Definition at line 47 of file p11_slot.cpp.

48 {
49 TokenInfo token_info;
50 m_module.get()->C_GetTokenInfo(m_slot_id, &token_info);
51 return token_info;
52 }
Botan::PKCS11::TokenInfo
CK_TOKEN_INFO TokenInfo
Definition: p11.h:838

void Botan::PKCS11::Slot::initialize | ( | const std::string & | label,
|  | const secure_string & | so_pin
| ) |  | const

Calls `C_InitToken` to initialize the token

Parameters

  label | the label for the token (must not exceed 32 bytes according to PKCS#11)
  so_pin | the PIN of the security officer

Definition at line 54 of file p11_slot.cpp.

Referenced by Botan::PKCS11::initialize_token().

55 {
56 m_module.get()->C_InitToken(m_slot_id, so_pin, label);
57 }

Module& Botan::PKCS11::Slot::module | ( |  | ) | const
| inline

Returns
  a reference to the module that is used

Definition at line 33 of file p11_slot.h.

34 {
35 return m_module;
36 }

SlotId Botan::PKCS11::Slot::slot_id | ( |  | ) | const
| inline

Returns
  the slot id

Definition at line 39 of file p11_slot.h.

Referenced by Botan::PKCS11::Session::Session().

40 {
41 return m_slot_id;
42 }

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

- src/lib/prov/pkcs11/p11_slot.h
- src/lib/prov/pkcs11/p11_slot.cpp