Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

p11_slot.cpp
Go to the documentation of this file.
1 /*
2 * PKCS#11 Slot
3 * (C) 2016 Daniel Neus, Sirrix AG
4 * (C) 2016 Philipp Weber, Sirrix AG
5 *
6 * Botan is released under the Simplified BSD License (see license.txt)
7 */
8
9 #include <botan/p11_slot.h>
10
11 namespace Botan {
12
13 namespace PKCS11 {
14
15 Slot::Slot(Module& module, SlotId slot_id)
16 : m_module(module), m_slot_id(slot_id)
17 {}
18
19 SlotInfo Slot::get_slot_info() const
20 {
21 SlotInfo slot_info = {};
22 m_module.get()->C_GetSlotInfo(m_slot_id, &slot_info);
23 return slot_info;
24 }
25
26 std::vector<MechanismType> Slot::get_mechanism_list() const
27 {
28 std::vector<MechanismType> mechanism_list;
29 m_module.get()->C_GetMechanismList(m_slot_id, mechanism_list);
30 return mechanism_list;
31 }
32
33 MechanismInfo Slot::get_mechanism_info(MechanismType mechanism_type) const
34 {
35 MechanismInfo mechanism_info = {};
36 m_module.get()->C_GetMechanismInfo(m_slot_id, mechanism_type, &mechanism_info);
37 return mechanism_info;
38 }
39
40 std::vector<SlotId> Slot::get_available_slots(Module& module, bool token_present)
41 {
42 std::vector<SlotId> slot_vec;
43 module->C_GetSlotList(token_present, slot_vec);
44 return slot_vec;
45 }
46
47 TokenInfo Slot::get_token_info() const
48 {
49 TokenInfo token_info;
50 m_module.get()->C_GetTokenInfo(m_slot_id, &token_info);
51 return token_info;
52 }
53
54 void Slot::initialize(const std::string& label, const secure_string& so_pin) const
55 {
56 m_module.get()->C_InitToken(m_slot_id, so_pin, label);
57 }
58 }
59
60 }
Botan::PKCS11::Slot::initialize
void initialize(const std::string &label, const secure_string &so_pin) const
Definition: p11_slot.cpp:54
CK_TOKEN_INFO
Definition: pkcs11t.h:130
CK_SLOT_INFO
Definition: pkcs11t.h:110
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::get_mechanism_info
MechanismInfo get_mechanism_info(MechanismType mechanism_type) const
Obtains information about a particular mechanism possibly supported by a slot (C_GetMechanismInfo) ...
Definition: p11_slot.cpp:33
Botan::PKCS11::Module
Definition: p11_module.h:25
CK_MECHANISM_INFO
Definition: pkcs11t.h:995
Botan::PKCS11::Slot::get_available_slots
static std::vector< SlotId > get_available_slots(Module &module, bool token_present)
Definition: p11_slot.cpp:40
Botan::PKCS11::Slot::Slot
Slot(Module &module, SlotId slot_id)
Definition: p11_slot.cpp:15
Botan
Definition: alg_id.cpp:13
Botan::PKCS11::Slot::get_slot_info
SlotInfo get_slot_info() const
Definition: p11_slot.cpp:19
Botan::PKCS11::SlotId
CK_SLOT_ID SlotId
Definition: p11.h:835
Botan::PKCS11::MechanismType
MechanismType
Definition: p11.h:335
Botan::PKCS11::Slot::get_token_info
TokenInfo get_token_info() const
Obtains information about a particular token in the system (C_GetTokenInfo)
Definition: p11_slot.cpp:47
Botan::PKCS11::secure_string
secure_vector< uint8_t > secure_string
Definition: p11.h:61
Botan::PKCS11::Slot::get_mechanism_list
std::vector< MechanismType > get_mechanism_list() const
Obtains a list of mechanism types supported by the slot (C_GetMechanismList)
Definition: p11_slot.cpp:26