Botan 2.19.5 Crypto and TLS for C&

p11.cpp
Go to the documentation of this file.
1/*
2* PKCS#11
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.h>
10#include <botan/p11_types.h>
11#include <botan/dyn_load.h>
12
13#include <cstdint>
14#include <string>
15#include <functional>
16
17 namespace Botan {
18 namespace PKCS11 {
19
20 ReturnValue* ThrowException = reinterpret_cast< ReturnValue* >(-1);
21
22 namespace {
23/// @param function_result Return value of the PKCS11 module function
24/// @param return_value if (`ThrowException`) is passed the function throws an exception, otherwise if a non-NULL pointer is passed:
25/// return_value receives the return value of the PKCS#11 function and no exception is thrown.
26/// @return true if function call was successful, false otherwise
27 bool handle_return_value(const CK_RV function_result, ReturnValue* return_value)
28 {
29 if(return_value == ThrowException)
30 {
31 if(static_cast< ReturnValue >(function_result) != ReturnValue::OK)
32 {
33 // caller wants exception
34 throw PKCS11_ReturnError(static_cast< ReturnValue >(function_result));
35 }
36 }
37 else if(return_value != nullptr)
38 {
39 // caller wants return value
40 *return_value = static_cast< ReturnValue >(function_result);
41 }
42
43 return static_cast< ReturnValue >(function_result) == ReturnValue::OK;
44 }
45}
46
47 void initialize_token(Slot& slot, const std::string& label, const secure_string& so_pin, const secure_string& pin)
48 {
49 slot.initialize(label, so_pin);
50 set_pin(slot, so_pin, pin);
51 }
52
53 void change_pin(Slot& slot, const secure_string& old_pin, const secure_string& new_pin)
54 {
55 Session session(slot, false);
56 session.login(UserType::User, old_pin);
57 session.set_pin(old_pin, new_pin);
58 }
59
60 void change_so_pin(Slot& slot, const secure_string& old_so_pin, const secure_string& new_so_pin)
61 {
62 Session session(slot, false);
63 session.login(UserType::SO, old_so_pin);
64 session.set_pin(old_so_pin, new_so_pin);
65 }
66
67 void set_pin(Slot& slot, const secure_string& so_pin, const secure_string& pin)
68 {
69 Session session(slot, false);
70 session.login(UserType::SO, so_pin);
71 session.init_pin(pin);
72 }
73
74 LowLevel::LowLevel(FunctionListPtr ptr) :
75 m_func_list_ptr(ptr)
76 {
77 if(m_func_list_ptr == nullptr)
78 {
79 throw Invalid_Argument("Invalid PKCS#11 function list ptr");
80 }
81 }
82
83/****************************** General purpose functions ******************************/
84
85 bool LowLevel::C_Initialize(VoidPtr init_args,
86 ReturnValue* return_value) const
87 {
88 return handle_return_value(m_func_list_ptr->C_Initialize(init_args), return_value);
89 }
90
91 bool LowLevel::C_Finalize(VoidPtr reserved,
92 ReturnValue* return_value) const
93 {
94 return handle_return_value(m_func_list_ptr->C_Finalize(reserved), return_value);
95 }
96
97 bool LowLevel::C_GetInfo(Info* info_ptr,
98 ReturnValue* return_value) const
99 {
100 return handle_return_value(m_func_list_ptr->C_GetInfo(info_ptr), return_value);
101 }
102
103 bool LowLevel::C_GetFunctionList(Dynamically_Loaded_Library& pkcs11_module, FunctionListPtr* function_list_ptr_ptr,
104 ReturnValue* return_value)
105 {
106 using get_function_list = CK_RV(*)(FunctionListPtr*);
107
108 get_function_list get_function_list_ptr = pkcs11_module.resolve<get_function_list>("C_GetFunctionList");
109
110 return handle_return_value(get_function_list_ptr(function_list_ptr_ptr), return_value);
111 }
112
113/****************************** Slot and token management functions ******************************/
114
115 bool LowLevel::C_GetSlotList(Bbool token_present,
116 SlotId* slot_list_ptr,
117 Ulong* count_ptr,
118 ReturnValue* return_value) const
119 {
120 return handle_return_value(m_func_list_ptr->C_GetSlotList(token_present, slot_list_ptr, count_ptr), return_value);
121 }
122
123 bool LowLevel::C_GetSlotList(bool token_present,
124 std::vector<SlotId>& slot_ids,
125 ReturnValue* return_value) const
126 {
127 slot_ids.clear();
128
129 // first get available slots
130 Ulong number_slots = 0;
131
132 bool success = C_GetSlotList(token_present, nullptr, &number_slots, return_value);
133
134 if(!success || !number_slots)
135 {
136 return success;
137 }
138
139 // get actual slot ids
140 slot_ids.resize(number_slots);
141 return C_GetSlotList(token_present, slot_ids.data(), &number_slots, return_value);
142 }
143
144 bool LowLevel::C_GetSlotInfo(SlotId slot_id,
145 SlotInfo* info_ptr,
146 ReturnValue* return_value) const
147 {
148 return handle_return_value(m_func_list_ptr->C_GetSlotInfo(slot_id, info_ptr), return_value);
149 }
150
151 bool LowLevel::C_GetTokenInfo(SlotId slot_id,
152 TokenInfo* info_ptr,
153 ReturnValue* return_value) const
154 {
155 return handle_return_value(m_func_list_ptr->C_GetTokenInfo(slot_id, info_ptr), return_value);
156 }
157
158 bool LowLevel::C_WaitForSlotEvent(Flags flags,
159 SlotId* slot_ptr,
160 VoidPtr reserved,
161 ReturnValue* return_value) const
162 {
163 return handle_return_value(m_func_list_ptr->C_WaitForSlotEvent(flags, slot_ptr, reserved), return_value);
164 }
165
166 bool LowLevel::C_GetMechanismList(SlotId slot_id,
167 MechanismType* mechanism_list_ptr,
168 Ulong* count_ptr,
169 ReturnValue* return_value) const
170 {
171 return handle_return_value(m_func_list_ptr->C_GetMechanismList(slot_id,
172 reinterpret_cast< CK_MECHANISM_TYPE_PTR >(mechanism_list_ptr), count_ptr), return_value);
173 }
174
175 bool LowLevel::C_GetMechanismList(SlotId slot_id,
176 std::vector<MechanismType>& mechanisms,
177 ReturnValue* return_value) const
178 {
179 mechanisms.clear();
180
181 // first get number of mechanisms
182 Ulong number_mechanisms = 0;
183
184 bool success = C_GetMechanismList(slot_id, nullptr, &number_mechanisms, return_value);
185
186 if(!success || !number_mechanisms)
187 {
188 return success;
189 }
190
191 // get actual mechanisms
192 mechanisms.resize(number_mechanisms);
193 return C_GetMechanismList(slot_id, reinterpret_cast< MechanismType* >(mechanisms.data()), &number_mechanisms,
194 return_value);
195 }
196
197 bool LowLevel::C_GetMechanismInfo(SlotId slot_id,
198 MechanismType type,
199 MechanismInfo* info_ptr,
200 ReturnValue* return_value) const
201 {
202 return handle_return_value(m_func_list_ptr->C_GetMechanismInfo(slot_id, static_cast< CK_MECHANISM_TYPE >(type),
203 info_ptr), return_value);
204 }
205
206 bool LowLevel::C_InitToken(SlotId slot_id,
207 Utf8Char* so_pin_ptr,
208 Ulong so_pin_len,
209 Utf8Char* label_ptr,
210 ReturnValue* return_value) const
211 {
212 return handle_return_value(m_func_list_ptr->C_InitToken(slot_id, so_pin_ptr, so_pin_len, label_ptr), return_value);
213 }
214
215 bool LowLevel::C_InitPIN(SessionHandle session,
216 Utf8Char* pin_ptr,
217 Ulong pin_len,
218 ReturnValue* return_value) const
219 {
220 return handle_return_value(m_func_list_ptr->C_InitPIN(session, pin_ptr, pin_len), return_value);
221 }
222
223 bool LowLevel::C_SetPIN(SessionHandle session,
224 Utf8Char* old_pin_ptr,
225 Ulong old_len,
226 Utf8Char* new_pin_ptr,
227 Ulong new_len,
228 ReturnValue* return_value) const
229 {
230 return handle_return_value(m_func_list_ptr->C_SetPIN(session, old_pin_ptr, old_len, new_pin_ptr, new_len),
231 return_value);
232 }
233
234/****************************** Session management ******************************/
235
236 bool LowLevel::C_OpenSession(SlotId slot_id,
237 Flags flags,
238 VoidPtr application,
239 Notify notify,
240 SessionHandle* session_ptr,
241 ReturnValue* return_value) const
242 {
243 return handle_return_value(m_func_list_ptr->C_OpenSession(slot_id, flags, application, notify, session_ptr),
244 return_value);
245 }
246
247 bool LowLevel::C_CloseSession(SessionHandle session,
248 ReturnValue* return_value) const
249 {
250 return handle_return_value(m_func_list_ptr->C_CloseSession(session), return_value);
251 }
252
253 bool LowLevel::C_CloseAllSessions(SlotId slot_id,
254 ReturnValue* return_value) const
255 {
256 return handle_return_value(m_func_list_ptr->C_CloseAllSessions(slot_id), return_value);
257 }
258
259 bool LowLevel::C_GetSessionInfo(SessionHandle session,
260 SessionInfo* info_ptr,
261 ReturnValue* return_value) const
262 {
263 return handle_return_value(m_func_list_ptr->C_GetSessionInfo(session, info_ptr), return_value);
264 }
265
266 bool LowLevel::C_GetOperationState(SessionHandle session,
267 Byte* operation_state_ptr,
268 Ulong* operation_state_len_ptr,
269 ReturnValue* return_value) const
270 {
271 return handle_return_value(m_func_list_ptr->C_GetOperationState(session, operation_state_ptr, operation_state_len_ptr),
272 return_value);
273 }
274
275 bool LowLevel::C_SetOperationState(SessionHandle session,
276 Byte* operation_state_ptr,
277 Ulong operation_state_len,
278 ObjectHandle encryption_key,
279 ObjectHandle authentication_key,
280 ReturnValue* return_value) const
281 {
282 return handle_return_value(m_func_list_ptr->C_SetOperationState(session, operation_state_ptr, operation_state_len,
283 encryption_key, authentication_key), return_value);
284 }
285
286 bool LowLevel::C_Login(SessionHandle session,
287 UserType user_type,
288 Utf8Char* pin_ptr,
289 Ulong pin_len,
290 ReturnValue* return_value) const
291 {
292 return handle_return_value(m_func_list_ptr->C_Login(session, static_cast< CK_USER_TYPE >(user_type), pin_ptr, pin_len),
293 return_value);
294 }
295
296 bool LowLevel::C_Logout(SessionHandle session,
297 ReturnValue* return_value) const
298 {
299 return handle_return_value(m_func_list_ptr->C_Logout(session), return_value);
300 }
301
302/****************************** Object management functions ******************************/
303
304 bool LowLevel::C_CreateObject(SessionHandle session,
305 Attribute* attribute_template_ptr,
306 Ulong count,
307 ObjectHandle* object_ptr,
308 ReturnValue* return_value) const
309 {
310 return handle_return_value(m_func_list_ptr->C_CreateObject(session, attribute_template_ptr, count, object_ptr),
311 return_value);
312 }
313
314 bool LowLevel::C_CopyObject(SessionHandle session,
315 ObjectHandle object,
316 Attribute* attribute_template_ptr,
317 Ulong count,
318 ObjectHandle* new_object_ptr,
319 ReturnValue* return_value) const
320 {
321 return handle_return_value(m_func_list_ptr->C_CopyObject(session, object, attribute_template_ptr, count,
322 new_object_ptr), return_value);
323 }
324
325 bool LowLevel::C_DestroyObject(SessionHandle session,
326 ObjectHandle object,
327 ReturnValue* return_value) const
328 {
329 return handle_return_value(m_func_list_ptr->C_DestroyObject(session, object), return_value);
330 }
331
332 bool LowLevel::C_GetObjectSize(SessionHandle session,
333 ObjectHandle object,
334 Ulong* size_ptr,
335 ReturnValue* return_value) const
336 {
337 return handle_return_value(m_func_list_ptr->C_GetObjectSize(session, object, size_ptr), return_value);
338 }
339
340 bool LowLevel::C_GetAttributeValue(SessionHandle session,
341 ObjectHandle object,
342 Attribute* attribute_template_ptr,
343 Ulong count,
344 ReturnValue* return_value) const
345 {
346 return handle_return_value(m_func_list_ptr->C_GetAttributeValue(session, object, attribute_template_ptr, count),
347 return_value);
348 }
349
350 bool LowLevel::C_SetAttributeValue(SessionHandle session,
351 ObjectHandle object,
352 Attribute* attribute_template_ptr,
353 Ulong count,
354 ReturnValue* return_value) const
355 {
356 return handle_return_value(m_func_list_ptr->C_SetAttributeValue(session, object, attribute_template_ptr, count),
357 return_value);
358 }
359
360 bool LowLevel::C_FindObjectsInit(SessionHandle session,
361 Attribute* attribute_template_ptr,
362 Ulong count,
363 ReturnValue* return_value) const
364 {
365 return handle_return_value(m_func_list_ptr->C_FindObjectsInit(session, attribute_template_ptr, count), return_value);
366 }
367
368 bool LowLevel::C_FindObjects(SessionHandle session,
369 ObjectHandle* object_ptr,
370 Ulong max_object_count,
371 Ulong* object_count_ptr,
372 ReturnValue* return_value) const
373 {
374 return handle_return_value(m_func_list_ptr->C_FindObjects(session, object_ptr, max_object_count, object_count_ptr),
375 return_value);
376 }
377
378 bool LowLevel::C_FindObjectsFinal(SessionHandle session,
379 ReturnValue* return_value) const
380 {
381 return handle_return_value(m_func_list_ptr->C_FindObjectsFinal(session), return_value);
382 }
383
384/****************************** Encryption functions ******************************/
385
386 bool LowLevel::C_EncryptInit(SessionHandle session,
387 Mechanism* mechanism_ptr,
388 ObjectHandle key,
389 ReturnValue* return_value) const
390 {
391 return handle_return_value(m_func_list_ptr->C_EncryptInit(session, mechanism_ptr, key), return_value);
392 }
393
394 bool LowLevel::C_Encrypt(SessionHandle session,
395 Byte* data_ptr,
396 Ulong data_len,
397 Byte* encrypted_data_ptr,
398 Ulong* encrypted_data_len_ptr,
399 ReturnValue* return_value) const
400 {
401 return handle_return_value(m_func_list_ptr->C_Encrypt(session, data_ptr, data_len, encrypted_data_ptr,
402 encrypted_data_len_ptr), return_value);
403 }
404
405 bool LowLevel::C_EncryptUpdate(SessionHandle session,
406 Byte* part_ptr,
407 Ulong part_len,
408 Byte* encrypted_part_ptr,
409 Ulong* encrypted_part_len_ptr,
410 ReturnValue* return_value) const
411 {
412 return handle_return_value(m_func_list_ptr->C_EncryptUpdate(session, part_ptr, part_len, encrypted_part_ptr,
413 encrypted_part_len_ptr), return_value);
414 }
415
416 bool LowLevel::C_EncryptFinal(SessionHandle session,
417 Byte* last_encrypted_part_ptr,
418 Ulong* last_encrypted_part_len_ptr,
419 ReturnValue* return_value) const
420 {
421 return handle_return_value(m_func_list_ptr->C_EncryptFinal(session, last_encrypted_part_ptr,
422 last_encrypted_part_len_ptr), return_value);
423 }
424
425/****************************** Decryption functions ******************************/
426
427 bool LowLevel::C_DecryptInit(SessionHandle session,
428 Mechanism* mechanism_ptr,
429 ObjectHandle key,
430 ReturnValue* return_value) const
431 {
432 return handle_return_value(m_func_list_ptr->C_DecryptInit(session, mechanism_ptr, key), return_value);
433 }
434
435 bool LowLevel::C_Decrypt(SessionHandle session,
436 Byte* encrypted_data_ptr,
437 Ulong encrypted_data_len,
438 Byte* data_ptr,
439 Ulong* data_len_ptr,
440 ReturnValue* return_value) const
441 {
442 return handle_return_value(m_func_list_ptr->C_Decrypt(session, encrypted_data_ptr, encrypted_data_len, data_ptr,
443 data_len_ptr), return_value);
444 }
445
446 bool LowLevel::C_DecryptUpdate(SessionHandle session,
447 Byte* encrypted_part_ptr,
448 Ulong encrypted_part_len,
449 Byte* part_ptr,
450 Ulong* part_len_ptr,
451 ReturnValue* return_value) const
452 {
453 return handle_return_value(m_func_list_ptr->C_DecryptUpdate(session, encrypted_part_ptr, encrypted_part_len, part_ptr,
454 part_len_ptr), return_value);
455 }
456
457 bool LowLevel::C_DecryptFinal(SessionHandle session,
458 Byte* last_part_ptr,
459 Ulong* last_part_len_ptr,
460 ReturnValue* return_value) const
461 {
462 return handle_return_value(m_func_list_ptr->C_DecryptFinal(session, last_part_ptr, last_part_len_ptr), return_value);
463 }
464
465/****************************** Message digesting functions ******************************/
466
467 bool LowLevel::C_DigestInit(SessionHandle session,
468 Mechanism* mechanism,
469 ReturnValue* return_value) const
470 {
471 return handle_return_value(m_func_list_ptr->C_DigestInit(session, mechanism), return_value);
472 }
473
474 bool LowLevel::C_Digest(SessionHandle session,
475 Byte* data_ptr,
476 Ulong data_len,
477 Byte* digest_ptr,
478 Ulong* digest_len_ptr,
479 ReturnValue* return_value) const
480 {
481 return handle_return_value(m_func_list_ptr->C_Digest(session, data_ptr, data_len, digest_ptr, digest_len_ptr),
482 return_value);
483 }
484
485 bool LowLevel::C_DigestUpdate(SessionHandle session,
486 Byte* part_ptr,
487 Ulong part_len,
488 ReturnValue* return_value) const
489 {
490 return handle_return_value(m_func_list_ptr->C_DigestUpdate(session, part_ptr, part_len), return_value);
491 }
492
493 bool LowLevel::C_DigestKey(SessionHandle session,
494 ObjectHandle key,
495 ReturnValue* return_value) const
496 {
497 return handle_return_value(m_func_list_ptr->C_DigestKey(session, key), return_value);
498 }
499
500 bool LowLevel::C_DigestFinal(SessionHandle session,
501 Byte* digest_ptr,
502 Ulong* digest_len_ptr,
503 ReturnValue* return_value) const
504 {
505 return handle_return_value(m_func_list_ptr->C_DigestFinal(session, digest_ptr, digest_len_ptr), return_value);
506 }
507
508/****************************** Signing and MACing functions ******************************/
509
510 bool LowLevel::C_SignInit(SessionHandle session,
511 Mechanism* mechanism_ptr,
512 ObjectHandle key,
513 ReturnValue* return_value) const
514 {
515 return handle_return_value(m_func_list_ptr->C_SignInit(session, mechanism_ptr, key), return_value);
516 }
517
518 bool LowLevel::C_Sign(SessionHandle session,
519 Byte* data_ptr,
520 Ulong data_len,
521 Byte* signature_ptr,
522 Ulong* signature_len_ptr,
523 ReturnValue* return_value) const
524 {
525 return handle_return_value(m_func_list_ptr->C_Sign(session, data_ptr, data_len, signature_ptr, signature_len_ptr),
526 return_value);
527 }
528
529 bool LowLevel::C_SignUpdate(SessionHandle session,
530 Byte* part_ptr,
531 Ulong part_len,
532 ReturnValue* return_value) const
533 {
534 return handle_return_value(m_func_list_ptr->C_SignUpdate(session, part_ptr, part_len), return_value);
535 }
536
537 bool LowLevel::C_SignFinal(SessionHandle session,
538 Byte* signature_ptr,
539 Ulong* signature_len_ptr,
540 ReturnValue* return_value) const
541 {
542 return handle_return_value(m_func_list_ptr->C_SignFinal(session, signature_ptr, signature_len_ptr), return_value);
543 }
544
545 bool LowLevel::C_SignRecoverInit(SessionHandle session,
546 Mechanism* mechanism_ptr,
547 ObjectHandle key,
548 ReturnValue* return_value) const
549 {
550 return handle_return_value(m_func_list_ptr->C_SignRecoverInit(session, mechanism_ptr, key), return_value);
551 }
552
553 bool LowLevel::C_SignRecover(SessionHandle session,
554 Byte* data,
555 Ulong data_len,
556 Byte* signature,
557 Ulong* signature_len,
558 ReturnValue* return_value) const
559 {
560 return handle_return_value(m_func_list_ptr->C_SignRecover(session, data, data_len, signature, signature_len),
561 return_value);
562 }
563
564/****************************** Functions for verifying signatures and MACs ******************************/
565
566 bool LowLevel::C_VerifyInit(SessionHandle session,
567 Mechanism* mechanism_ptr,
568 ObjectHandle key,
569 ReturnValue* return_value) const
570 {
571 return handle_return_value(m_func_list_ptr->C_VerifyInit(session, mechanism_ptr, key), return_value);
572 }
573
574 bool LowLevel::C_Verify(SessionHandle session,
575 Byte* data_ptr,
576 Ulong data_len,
577 Byte* signature_ptr,
578 Ulong signature_len,
579 ReturnValue* return_value) const
580 {
581 return handle_return_value(m_func_list_ptr->C_Verify(session, data_ptr, data_len, signature_ptr, signature_len),
582 return_value);
583 }
584
585 bool LowLevel::C_VerifyUpdate(SessionHandle session,
586 Byte* part_ptr,
587 Ulong part_len,
588 ReturnValue* return_value) const
589 {
590 return handle_return_value(m_func_list_ptr->C_VerifyUpdate(session, part_ptr, part_len), return_value);
591 }
592
593 bool LowLevel::C_VerifyFinal(SessionHandle session,
594 Byte* signature_ptr,
595 Ulong signature_len,
596 ReturnValue* return_value) const
597 {
598 return handle_return_value(m_func_list_ptr->C_VerifyFinal(session, signature_ptr, signature_len), return_value);
599 }
600
601 bool LowLevel::C_VerifyRecoverInit(SessionHandle session,
602 Mechanism* mechanism_ptr,
603 ObjectHandle key,
604 ReturnValue* return_value) const
605 {
606 return handle_return_value(m_func_list_ptr->C_VerifyRecoverInit(session, mechanism_ptr, key), return_value);
607 }
608
609 bool LowLevel::C_VerifyRecover(SessionHandle session,
610 Byte* signature_ptr,
611 Ulong signature_len,
612 Byte* data_ptr,
613 Ulong* data_len_ptr,
614 ReturnValue* return_value) const
615 {
616 return handle_return_value(m_func_list_ptr->C_VerifyRecover(session, signature_ptr, signature_len, data_ptr,
617 data_len_ptr), return_value);
618 }
619
620/****************************** Dual-purpose cryptographic functions ******************************/
621
622 bool LowLevel::C_DigestEncryptUpdate(SessionHandle session,
623 Byte* part_ptr,
624 Ulong part_len,
625 Byte* encrypted_part_ptr,
626 Ulong* encrypted_part_len_ptr,
627 ReturnValue* return_value) const
628 {
629 return handle_return_value(m_func_list_ptr->C_DigestEncryptUpdate(session, part_ptr, part_len, encrypted_part_ptr,
630 encrypted_part_len_ptr), return_value);
631 }
632
633 bool LowLevel::C_DecryptDigestUpdate(SessionHandle session,
634 Byte* encrypted_part_ptr,
635 Ulong encrypted_part_len,
636 Byte* part_ptr,
637 Ulong* part_len_ptr,
638 ReturnValue* return_value) const
639 {
640 return handle_return_value(m_func_list_ptr->C_DecryptDigestUpdate(session, encrypted_part_ptr, encrypted_part_len,
641 part_ptr, part_len_ptr), return_value);
642 }
643
644 bool LowLevel::C_SignEncryptUpdate(SessionHandle session,
645 Byte* part_ptr,
646 Ulong part_len,
647 Byte* encrypted_part_ptr,
648 Ulong* encrypted_part_len_ptr,
649 ReturnValue* return_value) const
650 {
651 return handle_return_value(m_func_list_ptr->C_SignEncryptUpdate(session, part_ptr, part_len, encrypted_part_ptr,
652 encrypted_part_len_ptr), return_value);
653 }
654
655 bool LowLevel::C_DecryptVerifyUpdate(SessionHandle session,
656 Byte* encrypted_part_ptr,
657 Ulong encrypted_part_len,
658 Byte* part_ptr,
659 Ulong* part_len_ptr,
660 ReturnValue* return_value) const
661 {
662 return handle_return_value(m_func_list_ptr->C_DecryptVerifyUpdate(session, encrypted_part_ptr, encrypted_part_len,
663 part_ptr, part_len_ptr), return_value);
664 }
665
666/****************************** Key management functions ******************************/
667
668 bool LowLevel::C_GenerateKey(SessionHandle session,
669 Mechanism* mechanism_ptr,
670 Attribute* attribute_template_ptr,
671 Ulong count,
672 ObjectHandle* key_ptr,
673 ReturnValue* return_value) const
674 {
675 return handle_return_value(m_func_list_ptr->C_GenerateKey(session, mechanism_ptr, attribute_template_ptr, count,
676 key_ptr), return_value);
677 }
678
679 bool LowLevel::C_GenerateKeyPair(SessionHandle session,
680 Mechanism* mechanism_ptr,
681 Attribute* public_key_template_ptr,
682 Ulong public_key_attribute_count,
683 Attribute* private_key_template_ptr,
684 Ulong private_key_attribute_count,
685 ObjectHandle* public_key_ptr,
686 ObjectHandle* private_key_ptr,
687 ReturnValue* return_value) const
688 {
689 return handle_return_value(m_func_list_ptr->C_GenerateKeyPair(session, mechanism_ptr, public_key_template_ptr,
690 public_key_attribute_count, private_key_template_ptr,
691 private_key_attribute_count, public_key_ptr, private_key_ptr), return_value);
692 }
693
694 bool LowLevel::C_WrapKey(SessionHandle session,
695 Mechanism* mechanism_ptr,
696 ObjectHandle wrapping_key,
697 ObjectHandle key,
698 Byte* wrapped_key_ptr,
699 Ulong* wrapped_key_len_ptr,
700 ReturnValue* return_value) const
701 {
702 return handle_return_value(m_func_list_ptr->C_WrapKey(session, mechanism_ptr, wrapping_key, key, wrapped_key_ptr,
703 wrapped_key_len_ptr), return_value);
704 }
705
706 bool LowLevel::C_UnwrapKey(SessionHandle session,
707 Mechanism* mechanism_ptr,
708 ObjectHandle unwrapping_key,
709 Byte* wrapped_key_ptr,
710 Ulong wrapped_key_len,
711 Attribute* attribute_template_ptr,
712 Ulong attribute_count,
713 ObjectHandle* key_ptr,
714 ReturnValue* return_value) const
715 {
716 return handle_return_value(m_func_list_ptr->C_UnwrapKey(session, mechanism_ptr, unwrapping_key, wrapped_key_ptr,
717 wrapped_key_len, attribute_template_ptr,
718 attribute_count, key_ptr), return_value);
719 }
720
721 bool LowLevel::C_DeriveKey(SessionHandle session,
722 Mechanism* mechanism_ptr,
723 ObjectHandle base_key,
724 Attribute* attribute_template_ptr,
725 Ulong attribute_count,
726 ObjectHandle* key_ptr,
727 ReturnValue* return_value) const
728 {
729 return handle_return_value(m_func_list_ptr->C_DeriveKey(session, mechanism_ptr, base_key, attribute_template_ptr,
730 attribute_count, key_ptr), return_value);
731 }
732
733/****************************** Random number generation functions ******************************/
734
735 bool LowLevel::C_SeedRandom(SessionHandle session,
736 Byte* seed_ptr,
737 Ulong seed_len,
738 ReturnValue* return_value) const
739 {
740 return handle_return_value(m_func_list_ptr->C_SeedRandom(session, seed_ptr, seed_len), return_value);
741 }
742
743 bool LowLevel::C_GenerateRandom(SessionHandle session,
744 Byte* random_data_ptr,
745 Ulong random_len,
746 ReturnValue* return_value) const
747 {
748 return handle_return_value(m_func_list_ptr->C_GenerateRandom(session, random_data_ptr, random_len), return_value);
749 }
750
751/****************************** Parallel function management functions ******************************/
752
753 bool LowLevel::C_GetFunctionStatus(SessionHandle session,
754 ReturnValue* return_value) const
755 {
756 return handle_return_value(m_func_list_ptr->C_GetFunctionStatus(session), return_value);
757 }
758
759 bool LowLevel::C_CancelFunction(SessionHandle session,
760 ReturnValue* return_value) const
761 {
762 return handle_return_value(m_func_list_ptr->C_CancelFunction(session), return_value);
763 }
764
765}
766
767}
Botan::Dynamically_Loaded_Library
Definition: dyn_load.h:20
Botan::Dynamically_Loaded_Library::resolve
T resolve(const std::string &symbol)
Definition: dyn_load.h:53
Botan::Invalid_Argument
Definition: exceptn.h:137
Botan::PKCS11::LowLevel::C_CancelFunction
bool C_CancelFunction(SessionHandle session, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:759
Botan::PKCS11::LowLevel::C_Finalize
bool C_Finalize(VoidPtr reserved, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:91
Botan::PKCS11::LowLevel::C_GetSessionInfo
bool C_GetSessionInfo(SessionHandle session, SessionInfo *info_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:259
Botan::PKCS11::LowLevel::C_DecryptUpdate
bool C_DecryptUpdate(SessionHandle session, Byte *encrypted_part_ptr, Ulong encrypted_part_len, Byte *part_ptr, Ulong *part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:446
Botan::PKCS11::LowLevel::C_Logout
bool C_Logout(SessionHandle session, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:296
Botan::PKCS11::LowLevel::C_GetOperationState
bool C_GetOperationState(SessionHandle session, Byte *operation_state_ptr, Ulong *operation_state_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:266
Botan::PKCS11::LowLevel::C_DigestKey
bool C_DigestKey(SessionHandle session, ObjectHandle key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:493
Botan::PKCS11::LowLevel::C_EncryptInit
bool C_EncryptInit(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:386
Botan::PKCS11::LowLevel::C_WaitForSlotEvent
bool C_WaitForSlotEvent(Flags flags, SlotId *slot_ptr, VoidPtr reserved, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:158
Botan::PKCS11::LowLevel::C_GetTokenInfo
bool C_GetTokenInfo(SlotId slot_id, TokenInfo *info_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:151
Botan::PKCS11::LowLevel::C_SetAttributeValue
bool C_SetAttributeValue(SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:350
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
Botan::PKCS11::LowLevel::C_DecryptFinal
bool C_DecryptFinal(SessionHandle session, Byte *last_part_ptr, Ulong *last_part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:457
Botan::PKCS11::LowLevel::C_SignInit
bool C_SignInit(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:510
Botan::PKCS11::LowLevel::LowLevel
LowLevel(FunctionListPtr ptr)
Definition: p11.cpp:74
Botan::PKCS11::LowLevel::C_GetSlotInfo
bool C_GetSlotInfo(SlotId slot_id, SlotInfo *info_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:144
Botan::PKCS11::LowLevel::C_EncryptFinal
bool C_EncryptFinal(SessionHandle session, Byte *last_encrypted_part_ptr, Ulong *last_encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:416
Botan::PKCS11::LowLevel::C_DecryptInit
bool C_DecryptInit(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:427
Botan::PKCS11::LowLevel::C_FindObjectsInit
bool C_FindObjectsInit(SessionHandle session, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:360
Botan::PKCS11::LowLevel::C_GetAttributeValue
bool C_GetAttributeValue(SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:340
Botan::PKCS11::LowLevel::C_DestroyObject
bool C_DestroyObject(SessionHandle session, ObjectHandle object, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:325
Botan::PKCS11::LowLevel::C_Digest
bool C_Digest(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *digest_ptr, Ulong *digest_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:474
Botan::PKCS11::LowLevel::C_OpenSession
bool C_OpenSession(SlotId slot_id, Flags flags, VoidPtr application, Notify notify, SessionHandle *session_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:236
Botan::PKCS11::LowLevel::C_VerifyUpdate
bool C_VerifyUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:585
Botan::PKCS11::LowLevel::C_DeriveKey
bool C_DeriveKey(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle base_key, Attribute *attribute_template_ptr, Ulong attribute_count, ObjectHandle *key_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:721
Botan::PKCS11::LowLevel::C_Sign
bool C_Sign(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:518
Botan::PKCS11::LowLevel::C_VerifyRecoverInit
bool C_VerifyRecoverInit(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:601
Botan::PKCS11::LowLevel::C_InitPIN
bool C_InitPIN(SessionHandle session, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:215
Botan::PKCS11::LowLevel::C_CopyObject
bool C_CopyObject(SessionHandle session, ObjectHandle object, Attribute *attribute_template_ptr, Ulong count, ObjectHandle *new_object_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:314
Botan::PKCS11::LowLevel::C_SignEncryptUpdate
bool C_SignEncryptUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, Byte *encrypted_part_ptr, Ulong *encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:644
Botan::PKCS11::LowLevel::C_Initialize
bool C_Initialize(VoidPtr init_args, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:85
Botan::PKCS11::LowLevel::C_GenerateRandom
bool C_GenerateRandom(SessionHandle session, Byte *random_data_ptr, Ulong random_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:743
Botan::PKCS11::LowLevel::C_DigestEncryptUpdate
bool C_DigestEncryptUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, Byte *encrypted_part_ptr, Ulong *encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:622
Botan::PKCS11::LowLevel::C_Verify
bool C_Verify(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong signature_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:574
Botan::PKCS11::LowLevel::C_VerifyInit
bool C_VerifyInit(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:566
Botan::PKCS11::LowLevel::C_GetFunctionStatus
bool C_GetFunctionStatus(SessionHandle session, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:753
Botan::PKCS11::LowLevel::C_CloseSession
bool C_CloseSession(SessionHandle session, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:247
Botan::PKCS11::LowLevel::C_SignUpdate
bool C_SignUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:529
Botan::PKCS11::LowLevel::C_DigestInit
bool C_DigestInit(SessionHandle session, Mechanism *mechanism_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:467
Botan::PKCS11::LowLevel::C_GenerateKeyPair
bool C_GenerateKeyPair(SessionHandle session, Mechanism *mechanism_ptr, Attribute *public_key_template_ptr, Ulong public_key_attribute_count, Attribute *private_key_template_ptr, Ulong private_key_attribute_count, ObjectHandle *public_key_ptr, ObjectHandle *private_key_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:679
Botan::PKCS11::LowLevel::C_SignRecoverInit
bool C_SignRecoverInit(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:545
Botan::PKCS11::LowLevel::C_GetInfo
bool C_GetInfo(Info *info_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:97
Botan::PKCS11::LowLevel::C_WrapKey
bool C_WrapKey(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle wrapping_key, ObjectHandle key, Byte *wrapped_key_ptr, Ulong *wrapped_key_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:694
Botan::PKCS11::LowLevel::C_SignRecover
bool C_SignRecover(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:553
Botan::PKCS11::LowLevel::C_GetMechanismList
bool C_GetMechanismList(SlotId slot_id, MechanismType *mechanism_list_ptr, Ulong *count_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:166
Botan::PKCS11::LowLevel::C_DigestUpdate
bool C_DigestUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:485
Botan::PKCS11::LowLevel::C_FindObjectsFinal
bool C_FindObjectsFinal(SessionHandle session, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:378
Botan::PKCS11::LowLevel::C_VerifyFinal
bool C_VerifyFinal(SessionHandle session, Byte *signature_ptr, Ulong signature_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:593
Botan::PKCS11::LowLevel::C_Decrypt
bool C_Decrypt(SessionHandle session, Byte *encrypted_data_ptr, Ulong encrypted_data_len, Byte *data_ptr, Ulong *data_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:435
Botan::PKCS11::LowLevel::C_SetOperationState
bool C_SetOperationState(SessionHandle session, Byte *operation_state_ptr, Ulong operation_state_len, ObjectHandle encryption_key, ObjectHandle authentication_key, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:275
Botan::PKCS11::LowLevel::C_CloseAllSessions
bool C_CloseAllSessions(SlotId slot_id, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:253
Botan::PKCS11::LowLevel::C_DecryptVerifyUpdate
bool C_DecryptVerifyUpdate(SessionHandle session, Byte *encrypted_part_ptr, Ulong encrypted_part_len, Byte *part_ptr, Ulong *part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:655
Botan::PKCS11::LowLevel::C_CreateObject
bool C_CreateObject(SessionHandle session, Attribute *attribute_template_ptr, Ulong count, ObjectHandle *object_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:304
Botan::PKCS11::LowLevel::C_VerifyRecover
bool C_VerifyRecover(SessionHandle session, Byte *signature_ptr, Ulong signature_len, Byte *data_ptr, Ulong *data_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:609
Botan::PKCS11::LowLevel::C_DecryptDigestUpdate
bool C_DecryptDigestUpdate(SessionHandle session, Byte *encrypted_part_ptr, Ulong encrypted_part_len, Byte *part_ptr, Ulong *part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:633
Botan::PKCS11::LowLevel::C_GenerateKey
bool C_GenerateKey(SessionHandle session, Mechanism *mechanism_ptr, Attribute *attribute_template_ptr, Ulong count, ObjectHandle *key_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:668
Botan::PKCS11::LowLevel::C_FindObjects
bool C_FindObjects(SessionHandle session, ObjectHandle *object_ptr, Ulong max_object_count, Ulong *object_count_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:368
Botan::PKCS11::LowLevel::C_Encrypt
bool C_Encrypt(SessionHandle session, Byte *data_ptr, Ulong data_len, Byte *encrypted_data, Ulong *encrypted_data_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:394
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:115
Botan::PKCS11::LowLevel::C_GetMechanismInfo
bool C_GetMechanismInfo(SlotId slot_id, MechanismType type, MechanismInfo *info_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:197
Botan::PKCS11::LowLevel::C_Login
bool C_Login(SessionHandle session, UserType user_type, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:286
Botan::PKCS11::LowLevel::C_SeedRandom
bool C_SeedRandom(SessionHandle session, Byte *seed_ptr, Ulong seed_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:735
Botan::PKCS11::LowLevel::C_SignFinal
bool C_SignFinal(SessionHandle session, Byte *signature_ptr, Ulong *signature_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:537
Botan::PKCS11::LowLevel::C_InitToken
bool C_InitToken(SlotId slot_id, Utf8Char *so_pin_ptr, Ulong so_pin_len, Utf8Char *label_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:206
Botan::PKCS11::LowLevel::C_DigestFinal
bool C_DigestFinal(SessionHandle session, Byte *digest_ptr, Ulong *digest_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:500
Botan::PKCS11::LowLevel::C_GetObjectSize
bool C_GetObjectSize(SessionHandle session, ObjectHandle object, Ulong *size_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:332
Botan::PKCS11::LowLevel::C_SetPIN
bool C_SetPIN(SessionHandle session, Utf8Char *old_pin_ptr, Ulong old_len, Utf8Char *new_pin_ptr, Ulong new_len, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:223
Botan::PKCS11::LowLevel::C_UnwrapKey
bool C_UnwrapKey(SessionHandle session, Mechanism *mechanism_ptr, ObjectHandle unwrapping_key, Byte *wrapped_key_ptr, Ulong wrapped_key_len, Attribute *attribute_template_ptr, Ulong attribute_count, ObjectHandle *key_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:706
Botan::PKCS11::LowLevel::C_EncryptUpdate
bool C_EncryptUpdate(SessionHandle session, Byte *part_ptr, Ulong part_len, Byte *encrypted_part_ptr, Ulong *encrypted_part_len_ptr, ReturnValue *return_value=ThrowException) const
Definition: p11.cpp:405
Botan::PKCS11::PKCS11_ReturnError
Definition: p11.h:2905
Botan::PKCS11::Session
Represents a PKCS#11 session.
Definition: p11_types.h:131
Botan::PKCS11::Session::set_pin
void set_pin(const secure_string &old_pin, const secure_string &new_pin) const
Calls C_SetPIN to change the PIN using the old PIN (requires a logged in session)
Definition: p11_session.cpp:85
Botan::PKCS11::Session::init_pin
void init_pin(const secure_string &new_pin)
Calls C_InitPIN to change or initialize the PIN using the SO_PIN (requires a logged in session)
Definition: p11_session.cpp:90
Botan::PKCS11::Session::login
void login(UserType userType, const secure_string &pin)
Definition: p11_session.cpp:66
Botan::PKCS11::Slot
Represents a PKCS#11 Slot, i.e., a card reader.
Definition: p11_types.h:77
Botan::PKCS11::Slot::initialize
void initialize(const std::string &label, const secure_string &so_pin) const
Definition: p11_slot.cpp:54
Botan::PKCS11::ThrowException
ReturnValue * ThrowException
Definition: p11.cpp:20
Botan::PKCS11::Bbool
CK_BBOOL Bbool
Definition: p11.h:836
Botan::PKCS11::Flags
CK_FLAGS Flags
Definition: p11.h:834
Botan::PKCS11::UserType
UserType
Definition: p11.h:815
Botan::PKCS11::UserType::User
@ User
Botan::PKCS11::UserType::SO
@ SO
Botan::PKCS11::Notify
CK_NOTIFY Notify
Definition: p11.h:844
Botan::PKCS11::change_pin
void change_pin(Slot &slot, const secure_string &old_pin, const secure_string &new_pin)
Definition: p11.cpp:53
Botan::PKCS11::change_so_pin
void change_so_pin(Slot &slot, const secure_string &old_so_pin, const secure_string &new_so_pin)
Definition: p11.cpp:60
Botan::PKCS11::MechanismType
MechanismType
Definition: p11.h:338
Botan::PKCS11::FunctionListPtr
CK_FUNCTION_LIST_PTR FunctionListPtr
Definition: p11.h:827
Botan::PKCS11::Ulong
CK_ULONG Ulong
Definition: p11.h:838
Botan::PKCS11::secure_string
secure_vector< uint8_t > secure_string
Definition: p11.h:63
Botan::PKCS11::initialize_token
void initialize_token(Slot &slot, const std::string &label, const secure_string &so_pin, const secure_string &pin)
Definition: p11.cpp:47
Botan::PKCS11::VoidPtr
CK_VOID_PTR VoidPtr
Definition: p11.h:828
Botan::PKCS11::SessionHandle
CK_SESSION_HANDLE SessionHandle
Definition: p11.h:845
Botan::PKCS11::set_pin
void set_pin(Slot &slot, const secure_string &so_pin, const secure_string &pin)
Definition: p11.cpp:67
Botan::PKCS11::ObjectHandle
CK_OBJECT_HANDLE ObjectHandle
Definition: p11.h:848
Botan::PKCS11::Byte
CK_BYTE Byte
Definition: p11.h:849
Botan::PKCS11::SlotId
CK_SLOT_ID SlotId
Definition: p11.h:837
Botan::PKCS11::flags
Flags flags(Flag flags)
Definition: p11.h:860
Botan::PKCS11::ReturnValue
ReturnValue
Definition: p11.h:716
Botan::PKCS11::ReturnValue::OK
@ OK
Botan::PKCS11::Utf8Char
CK_UTF8CHAR Utf8Char
Definition: p11.h:843
Botan
Definition: alg_id.cpp:13
type
MechanismType type
Definition: p11_mechanism.cpp:44
CK_RV
CK_ULONG CK_RV
Definition: pkcs11t.h:1036
CK_MECHANISM_TYPE_PTR
CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR
Definition: pkcs11t.h:977
CK_USER_TYPE
CK_ULONG CK_USER_TYPE
Definition: pkcs11t.h:262
CK_MECHANISM_TYPE
CK_ULONG CK_MECHANISM_TYPE
Definition: pkcs11t.h:583
CK_ATTRIBUTE
Definition: pkcs11t.h:564
CK_INFO
Definition: pkcs11t.h:86
CK_MECHANISM_INFO
Definition: pkcs11t.h:995
CK_MECHANISM
Definition: pkcs11t.h:983
CK_SESSION_INFO
Definition: pkcs11t.h:279
CK_SLOT_INFO
Definition: pkcs11t.h:110
CK_TOKEN_INFO
Definition: pkcs11t.h:130