pkcs11 0.2.5-x64-mingw32 → 0.2.6-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,912 +1,900 @@
1
- /* pkcs11f.h include file for PKCS #11. */
2
- /* $Revision: 1.4 $ */
3
-
4
- /* License to copy and use this software is granted provided that it is
5
- * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
6
- * (Cryptoki)" in all material mentioning or referencing this software.
7
-
8
- * License is also granted to make and use derivative works provided that
9
- * such works are identified as "derived from the RSA Security Inc. PKCS #11
10
- * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
11
- * referencing the derived work.
12
-
13
- * RSA Security Inc. makes no representations concerning either the
14
- * merchantability of this software or the suitability of this software for
15
- * any particular purpose. It is provided "as is" without express or implied
16
- * warranty of any kind.
17
- */
18
-
19
- /* This header file contains pretty much everything about all the */
20
- /* Cryptoki function prototypes. Because this information is */
21
- /* used for more than just declaring function prototypes, the */
22
- /* order of the functions appearing herein is important, and */
23
- /* should not be altered. */
24
-
25
- /* General-purpose */
26
-
27
- /* C_Initialize initializes the Cryptoki library. */
28
- CK_PKCS11_FUNCTION_INFO(C_Initialize)
29
- #ifdef CK_NEED_ARG_LIST
30
- (
31
- CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets
32
- * cast to CK_C_INITIALIZE_ARGS_PTR
33
- * and dereferenced */
34
- );
35
- #endif
36
-
37
-
38
- /* C_Finalize indicates that an application is done with the
39
- * Cryptoki library. */
40
- CK_PKCS11_FUNCTION_INFO(C_Finalize)
41
- #ifdef CK_NEED_ARG_LIST
42
- (
43
- CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */
44
- );
45
- #endif
46
-
47
-
48
- /* C_GetInfo returns general information about Cryptoki. */
49
- CK_PKCS11_FUNCTION_INFO(C_GetInfo)
50
- #ifdef CK_NEED_ARG_LIST
51
- (
52
- CK_INFO_PTR pInfo /* location that receives information */
53
- );
54
- #endif
55
-
56
-
57
- /* C_GetFunctionList returns the function list. */
58
- CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
59
- #ifdef CK_NEED_ARG_LIST
60
- (
61
- CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to
62
- * function list */
63
- );
64
- #endif
65
-
66
-
67
-
68
- /* Slot and token management */
69
-
70
- /* C_GetSlotList obtains a list of slots in the system. */
71
- CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
72
- #ifdef CK_NEED_ARG_LIST
73
- (
74
- CK_BBOOL tokenPresent, /* only slots with tokens? */
75
- CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */
76
- CK_ULONG_PTR pulCount /* receives number of slots */
77
- );
78
- #endif
79
-
80
-
81
- /* C_GetSlotInfo obtains information about a particular slot in
82
- * the system. */
83
- CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
84
- #ifdef CK_NEED_ARG_LIST
85
- (
86
- CK_SLOT_ID slotID, /* the ID of the slot */
87
- CK_SLOT_INFO_PTR pInfo /* receives the slot information */
88
- );
89
- #endif
90
-
91
-
92
- /* C_GetTokenInfo obtains information about a particular token
93
- * in the system. */
94
- CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
95
- #ifdef CK_NEED_ARG_LIST
96
- (
97
- CK_SLOT_ID slotID, /* ID of the token's slot */
98
- CK_TOKEN_INFO_PTR pInfo /* receives the token information */
99
- );
100
- #endif
101
-
102
-
103
- /* C_GetMechanismList obtains a list of mechanism types
104
- * supported by a token. */
105
- CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
106
- #ifdef CK_NEED_ARG_LIST
107
- (
108
- CK_SLOT_ID slotID, /* ID of token's slot */
109
- CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */
110
- CK_ULONG_PTR pulCount /* gets # of mechs. */
111
- );
112
- #endif
113
-
114
-
115
- /* C_GetMechanismInfo obtains information about a particular
116
- * mechanism possibly supported by a token. */
117
- CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
118
- #ifdef CK_NEED_ARG_LIST
119
- (
120
- CK_SLOT_ID slotID, /* ID of the token's slot */
121
- CK_MECHANISM_TYPE type, /* type of mechanism */
122
- CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */
123
- );
124
- #endif
125
-
126
-
127
- /* C_InitToken initializes a token. */
128
- CK_PKCS11_FUNCTION_INFO(C_InitToken)
129
- #ifdef CK_NEED_ARG_LIST
130
- /* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
131
- (
132
- CK_SLOT_ID slotID, /* ID of the token's slot */
133
- CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */
134
- CK_ULONG ulPinLen, /* length in bytes of the PIN */
135
- CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */
136
- );
137
- #endif
138
-
139
-
140
- /* C_InitPIN initializes the normal user's PIN. */
141
- CK_PKCS11_FUNCTION_INFO(C_InitPIN)
142
- #ifdef CK_NEED_ARG_LIST
143
- (
144
- CK_SESSION_HANDLE hSession, /* the session's handle */
145
- CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */
146
- CK_ULONG ulPinLen /* length in bytes of the PIN */
147
- );
148
- #endif
149
-
150
-
151
- /* C_SetPIN modifies the PIN of the user who is logged in. */
152
- CK_PKCS11_FUNCTION_INFO(C_SetPIN)
153
- #ifdef CK_NEED_ARG_LIST
154
- (
155
- CK_SESSION_HANDLE hSession, /* the session's handle */
156
- CK_UTF8CHAR_PTR pOldPin, /* the old PIN */
157
- CK_ULONG ulOldLen, /* length of the old PIN */
158
- CK_UTF8CHAR_PTR pNewPin, /* the new PIN */
159
- CK_ULONG ulNewLen /* length of the new PIN */
160
- );
161
- #endif
162
-
163
-
164
-
165
- /* Session management */
166
-
167
- /* C_OpenSession opens a session between an application and a
168
- * token. */
169
- CK_PKCS11_FUNCTION_INFO(C_OpenSession)
170
- #ifdef CK_NEED_ARG_LIST
171
- (
172
- CK_SLOT_ID slotID, /* the slot's ID */
173
- CK_FLAGS flags, /* from CK_SESSION_INFO */
174
- CK_VOID_PTR pApplication, /* passed to callback */
175
- CK_NOTIFY Notify, /* callback function */
176
- CK_SESSION_HANDLE_PTR phSession /* gets session handle */
177
- );
178
- #endif
179
-
180
-
181
- /* C_CloseSession closes a session between an application and a
182
- * token. */
183
- CK_PKCS11_FUNCTION_INFO(C_CloseSession)
184
- #ifdef CK_NEED_ARG_LIST
185
- (
186
- CK_SESSION_HANDLE hSession /* the session's handle */
187
- );
188
- #endif
189
-
190
-
191
- /* C_CloseAllSessions closes all sessions with a token. */
192
- CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
193
- #ifdef CK_NEED_ARG_LIST
194
- (
195
- CK_SLOT_ID slotID /* the token's slot */
196
- );
197
- #endif
198
-
199
-
200
- /* C_GetSessionInfo obtains information about the session. */
201
- CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
202
- #ifdef CK_NEED_ARG_LIST
203
- (
204
- CK_SESSION_HANDLE hSession, /* the session's handle */
205
- CK_SESSION_INFO_PTR pInfo /* receives session info */
206
- );
207
- #endif
208
-
209
-
210
- /* C_GetOperationState obtains the state of the cryptographic operation
211
- * in a session. */
212
- CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
213
- #ifdef CK_NEED_ARG_LIST
214
- (
215
- CK_SESSION_HANDLE hSession, /* session's handle */
216
- CK_BYTE_PTR pOperationState, /* gets state */
217
- CK_ULONG_PTR pulOperationStateLen /* gets state length */
218
- );
219
- #endif
220
-
221
-
222
- /* C_SetOperationState restores the state of the cryptographic
223
- * operation in a session. */
224
- CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
225
- #ifdef CK_NEED_ARG_LIST
226
- (
227
- CK_SESSION_HANDLE hSession, /* session's handle */
228
- CK_BYTE_PTR pOperationState, /* holds state */
229
- CK_ULONG ulOperationStateLen, /* holds state length */
230
- CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */
231
- CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */
232
- );
233
- #endif
234
-
235
-
236
- /* C_Login logs a user into a token. */
237
- CK_PKCS11_FUNCTION_INFO(C_Login)
238
- #ifdef CK_NEED_ARG_LIST
239
- (
240
- CK_SESSION_HANDLE hSession, /* the session's handle */
241
- CK_USER_TYPE userType, /* the user type */
242
- CK_UTF8CHAR_PTR pPin, /* the user's PIN */
243
- CK_ULONG ulPinLen /* the length of the PIN */
244
- );
245
- #endif
246
-
247
-
248
- /* C_Logout logs a user out from a token. */
249
- CK_PKCS11_FUNCTION_INFO(C_Logout)
250
- #ifdef CK_NEED_ARG_LIST
251
- (
252
- CK_SESSION_HANDLE hSession /* the session's handle */
253
- );
254
- #endif
255
-
256
-
257
-
258
- /* Object management */
259
-
260
- /* C_CreateObject creates a new object. */
261
- CK_PKCS11_FUNCTION_INFO(C_CreateObject)
262
- #ifdef CK_NEED_ARG_LIST
263
- (
264
- CK_SESSION_HANDLE hSession, /* the session's handle */
265
- CK_ATTRIBUTE_PTR pTemplate, /* the object's template */
266
- CK_ULONG ulCount, /* attributes in template */
267
- CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */
268
- );
269
- #endif
270
-
271
-
272
- /* C_CopyObject copies an object, creating a new object for the
273
- * copy. */
274
- CK_PKCS11_FUNCTION_INFO(C_CopyObject)
275
- #ifdef CK_NEED_ARG_LIST
276
- (
277
- CK_SESSION_HANDLE hSession, /* the session's handle */
278
- CK_OBJECT_HANDLE hObject, /* the object's handle */
279
- CK_ATTRIBUTE_PTR pTemplate, /* template for new object */
280
- CK_ULONG ulCount, /* attributes in template */
281
- CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */
282
- );
283
- #endif
284
-
285
-
286
- /* C_DestroyObject destroys an object. */
287
- CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
288
- #ifdef CK_NEED_ARG_LIST
289
- (
290
- CK_SESSION_HANDLE hSession, /* the session's handle */
291
- CK_OBJECT_HANDLE hObject /* the object's handle */
292
- );
293
- #endif
294
-
295
-
296
- /* C_GetObjectSize gets the size of an object in bytes. */
297
- CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
298
- #ifdef CK_NEED_ARG_LIST
299
- (
300
- CK_SESSION_HANDLE hSession, /* the session's handle */
301
- CK_OBJECT_HANDLE hObject, /* the object's handle */
302
- CK_ULONG_PTR pulSize /* receives size of object */
303
- );
304
- #endif
305
-
306
-
307
- /* C_GetAttributeValue obtains the value of one or more object
308
- * attributes. */
309
- CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
310
- #ifdef CK_NEED_ARG_LIST
311
- (
312
- CK_SESSION_HANDLE hSession, /* the session's handle */
313
- CK_OBJECT_HANDLE hObject, /* the object's handle */
314
- CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */
315
- CK_ULONG ulCount /* attributes in template */
316
- );
317
- #endif
318
-
319
-
320
- /* C_SetAttributeValue modifies the value of one or more object
321
- * attributes */
322
- CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
323
- #ifdef CK_NEED_ARG_LIST
324
- (
325
- CK_SESSION_HANDLE hSession, /* the session's handle */
326
- CK_OBJECT_HANDLE hObject, /* the object's handle */
327
- CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */
328
- CK_ULONG ulCount /* attributes in template */
329
- );
330
- #endif
331
-
332
-
333
- /* C_FindObjectsInit initializes a search for token and session
334
- * objects that match a template. */
335
- CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
336
- #ifdef CK_NEED_ARG_LIST
337
- (
338
- CK_SESSION_HANDLE hSession, /* the session's handle */
339
- CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */
340
- CK_ULONG ulCount /* attrs in search template */
341
- );
342
- #endif
343
-
344
-
345
- /* C_FindObjects continues a search for token and session
346
- * objects that match a template, obtaining additional object
347
- * handles. */
348
- CK_PKCS11_FUNCTION_INFO(C_FindObjects)
349
- #ifdef CK_NEED_ARG_LIST
350
- (
351
- CK_SESSION_HANDLE hSession, /* session's handle */
352
- CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */
353
- CK_ULONG ulMaxObjectCount, /* max handles to get */
354
- CK_ULONG_PTR pulObjectCount /* actual # returned */
355
- );
356
- #endif
357
-
358
-
359
- /* C_FindObjectsFinal finishes a search for token and session
360
- * objects. */
361
- CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
362
- #ifdef CK_NEED_ARG_LIST
363
- (
364
- CK_SESSION_HANDLE hSession /* the session's handle */
365
- );
366
- #endif
367
-
368
-
369
-
370
- /* Encryption and decryption */
371
-
372
- /* C_EncryptInit initializes an encryption operation. */
373
- CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
374
- #ifdef CK_NEED_ARG_LIST
375
- (
376
- CK_SESSION_HANDLE hSession, /* the session's handle */
377
- CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
378
- CK_OBJECT_HANDLE hKey /* handle of encryption key */
379
- );
380
- #endif
381
-
382
-
383
- /* C_Encrypt encrypts single-part data. */
384
- CK_PKCS11_FUNCTION_INFO(C_Encrypt)
385
- #ifdef CK_NEED_ARG_LIST
386
- (
387
- CK_SESSION_HANDLE hSession, /* session's handle */
388
- CK_BYTE_PTR pData, /* the plaintext data */
389
- CK_ULONG ulDataLen, /* bytes of plaintext */
390
- CK_BYTE_PTR pEncryptedData, /* gets ciphertext */
391
- CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */
392
- );
393
- #endif
394
-
395
-
396
- /* C_EncryptUpdate continues a multiple-part encryption
397
- * operation. */
398
- CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
399
- #ifdef CK_NEED_ARG_LIST
400
- (
401
- CK_SESSION_HANDLE hSession, /* session's handle */
402
- CK_BYTE_PTR pPart, /* the plaintext data */
403
- CK_ULONG ulPartLen, /* plaintext data len */
404
- CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
405
- CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */
406
- );
407
- #endif
408
-
409
-
410
- /* C_EncryptFinal finishes a multiple-part encryption
411
- * operation. */
412
- CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
413
- #ifdef CK_NEED_ARG_LIST
414
- (
415
- CK_SESSION_HANDLE hSession, /* session handle */
416
- CK_BYTE_PTR pLastEncryptedPart, /* last c-text */
417
- CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */
418
- );
419
- #endif
420
-
421
-
422
- /* C_DecryptInit initializes a decryption operation. */
423
- CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
424
- #ifdef CK_NEED_ARG_LIST
425
- (
426
- CK_SESSION_HANDLE hSession, /* the session's handle */
427
- CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
428
- CK_OBJECT_HANDLE hKey /* handle of decryption key */
429
- );
430
- #endif
431
-
432
-
433
- /* C_Decrypt decrypts encrypted data in a single part. */
434
- CK_PKCS11_FUNCTION_INFO(C_Decrypt)
435
- #ifdef CK_NEED_ARG_LIST
436
- (
437
- CK_SESSION_HANDLE hSession, /* session's handle */
438
- CK_BYTE_PTR pEncryptedData, /* ciphertext */
439
- CK_ULONG ulEncryptedDataLen, /* ciphertext length */
440
- CK_BYTE_PTR pData, /* gets plaintext */
441
- CK_ULONG_PTR pulDataLen /* gets p-text size */
442
- );
443
- #endif
444
-
445
-
446
- /* C_DecryptUpdate continues a multiple-part decryption
447
- * operation. */
448
- CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
449
- #ifdef CK_NEED_ARG_LIST
450
- (
451
- CK_SESSION_HANDLE hSession, /* session's handle */
452
- CK_BYTE_PTR pEncryptedPart, /* encrypted data */
453
- CK_ULONG ulEncryptedPartLen, /* input length */
454
- CK_BYTE_PTR pPart, /* gets plaintext */
455
- CK_ULONG_PTR pulPartLen /* p-text size */
456
- );
457
- #endif
458
-
459
-
460
- /* C_DecryptFinal finishes a multiple-part decryption
461
- * operation. */
462
- CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
463
- #ifdef CK_NEED_ARG_LIST
464
- (
465
- CK_SESSION_HANDLE hSession, /* the session's handle */
466
- CK_BYTE_PTR pLastPart, /* gets plaintext */
467
- CK_ULONG_PTR pulLastPartLen /* p-text size */
468
- );
469
- #endif
470
-
471
-
472
-
473
- /* Message digesting */
474
-
475
- /* C_DigestInit initializes a message-digesting operation. */
476
- CK_PKCS11_FUNCTION_INFO(C_DigestInit)
477
- #ifdef CK_NEED_ARG_LIST
478
- (
479
- CK_SESSION_HANDLE hSession, /* the session's handle */
480
- CK_MECHANISM_PTR pMechanism /* the digesting mechanism */
481
- );
482
- #endif
483
-
484
-
485
- /* C_Digest digests data in a single part. */
486
- CK_PKCS11_FUNCTION_INFO(C_Digest)
487
- #ifdef CK_NEED_ARG_LIST
488
- (
489
- CK_SESSION_HANDLE hSession, /* the session's handle */
490
- CK_BYTE_PTR pData, /* data to be digested */
491
- CK_ULONG ulDataLen, /* bytes of data to digest */
492
- CK_BYTE_PTR pDigest, /* gets the message digest */
493
- CK_ULONG_PTR pulDigestLen /* gets digest length */
494
- );
495
- #endif
496
-
497
-
498
- /* C_DigestUpdate continues a multiple-part message-digesting
499
- * operation. */
500
- CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
501
- #ifdef CK_NEED_ARG_LIST
502
- (
503
- CK_SESSION_HANDLE hSession, /* the session's handle */
504
- CK_BYTE_PTR pPart, /* data to be digested */
505
- CK_ULONG ulPartLen /* bytes of data to be digested */
506
- );
507
- #endif
508
-
509
-
510
- /* C_DigestKey continues a multi-part message-digesting
511
- * operation, by digesting the value of a secret key as part of
512
- * the data already digested. */
513
- CK_PKCS11_FUNCTION_INFO(C_DigestKey)
514
- #ifdef CK_NEED_ARG_LIST
515
- (
516
- CK_SESSION_HANDLE hSession, /* the session's handle */
517
- CK_OBJECT_HANDLE hKey /* secret key to digest */
518
- );
519
- #endif
520
-
521
-
522
- /* C_DigestFinal finishes a multiple-part message-digesting
523
- * operation. */
524
- CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
525
- #ifdef CK_NEED_ARG_LIST
526
- (
527
- CK_SESSION_HANDLE hSession, /* the session's handle */
528
- CK_BYTE_PTR pDigest, /* gets the message digest */
529
- CK_ULONG_PTR pulDigestLen /* gets byte count of digest */
530
- );
531
- #endif
532
-
533
-
534
-
535
- /* Signing and MACing */
536
-
537
- /* C_SignInit initializes a signature (private key encryption)
538
- * operation, where the signature is (will be) an appendix to
539
- * the data, and plaintext cannot be recovered from the
540
- *signature. */
541
- CK_PKCS11_FUNCTION_INFO(C_SignInit)
542
- #ifdef CK_NEED_ARG_LIST
543
- (
544
- CK_SESSION_HANDLE hSession, /* the session's handle */
545
- CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
546
- CK_OBJECT_HANDLE hKey /* handle of signature key */
547
- );
548
- #endif
549
-
550
-
551
- /* C_Sign signs (encrypts with private key) data in a single
552
- * part, where the signature is (will be) an appendix to the
553
- * data, and plaintext cannot be recovered from the signature. */
554
- CK_PKCS11_FUNCTION_INFO(C_Sign)
555
- #ifdef CK_NEED_ARG_LIST
556
- (
557
- CK_SESSION_HANDLE hSession, /* the session's handle */
558
- CK_BYTE_PTR pData, /* the data to sign */
559
- CK_ULONG ulDataLen, /* count of bytes to sign */
560
- CK_BYTE_PTR pSignature, /* gets the signature */
561
- CK_ULONG_PTR pulSignatureLen /* gets signature length */
562
- );
563
- #endif
564
-
565
-
566
- /* C_SignUpdate continues a multiple-part signature operation,
567
- * where the signature is (will be) an appendix to the data,
568
- * and plaintext cannot be recovered from the signature. */
569
- CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
570
- #ifdef CK_NEED_ARG_LIST
571
- (
572
- CK_SESSION_HANDLE hSession, /* the session's handle */
573
- CK_BYTE_PTR pPart, /* the data to sign */
574
- CK_ULONG ulPartLen /* count of bytes to sign */
575
- );
576
- #endif
577
-
578
-
579
- /* C_SignFinal finishes a multiple-part signature operation,
580
- * returning the signature. */
581
- CK_PKCS11_FUNCTION_INFO(C_SignFinal)
582
- #ifdef CK_NEED_ARG_LIST
583
- (
584
- CK_SESSION_HANDLE hSession, /* the session's handle */
585
- CK_BYTE_PTR pSignature, /* gets the signature */
586
- CK_ULONG_PTR pulSignatureLen /* gets signature length */
587
- );
588
- #endif
589
-
590
-
591
- /* C_SignRecoverInit initializes a signature operation, where
592
- * the data can be recovered from the signature. */
593
- CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
594
- #ifdef CK_NEED_ARG_LIST
595
- (
596
- CK_SESSION_HANDLE hSession, /* the session's handle */
597
- CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
598
- CK_OBJECT_HANDLE hKey /* handle of the signature key */
599
- );
600
- #endif
601
-
602
-
603
- /* C_SignRecover signs data in a single operation, where the
604
- * data can be recovered from the signature. */
605
- CK_PKCS11_FUNCTION_INFO(C_SignRecover)
606
- #ifdef CK_NEED_ARG_LIST
607
- (
608
- CK_SESSION_HANDLE hSession, /* the session's handle */
609
- CK_BYTE_PTR pData, /* the data to sign */
610
- CK_ULONG ulDataLen, /* count of bytes to sign */
611
- CK_BYTE_PTR pSignature, /* gets the signature */
612
- CK_ULONG_PTR pulSignatureLen /* gets signature length */
613
- );
614
- #endif
615
-
616
-
617
-
618
- /* Verifying signatures and MACs */
619
-
620
- /* C_VerifyInit initializes a verification operation, where the
621
- * signature is an appendix to the data, and plaintext cannot
622
- * cannot be recovered from the signature (e.g. DSA). */
623
- CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
624
- #ifdef CK_NEED_ARG_LIST
625
- (
626
- CK_SESSION_HANDLE hSession, /* the session's handle */
627
- CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
628
- CK_OBJECT_HANDLE hKey /* verification key */
629
- );
630
- #endif
631
-
632
-
633
- /* C_Verify verifies a signature in a single-part operation,
634
- * where the signature is an appendix to the data, and plaintext
635
- * cannot be recovered from the signature. */
636
- CK_PKCS11_FUNCTION_INFO(C_Verify)
637
- #ifdef CK_NEED_ARG_LIST
638
- (
639
- CK_SESSION_HANDLE hSession, /* the session's handle */
640
- CK_BYTE_PTR pData, /* signed data */
641
- CK_ULONG ulDataLen, /* length of signed data */
642
- CK_BYTE_PTR pSignature, /* signature */
643
- CK_ULONG ulSignatureLen /* signature length*/
644
- );
645
- #endif
646
-
647
-
648
- /* C_VerifyUpdate continues a multiple-part verification
649
- * operation, where the signature is an appendix to the data,
650
- * and plaintext cannot be recovered from the signature. */
651
- CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
652
- #ifdef CK_NEED_ARG_LIST
653
- (
654
- CK_SESSION_HANDLE hSession, /* the session's handle */
655
- CK_BYTE_PTR pPart, /* signed data */
656
- CK_ULONG ulPartLen /* length of signed data */
657
- );
658
- #endif
659
-
660
-
661
- /* C_VerifyFinal finishes a multiple-part verification
662
- * operation, checking the signature. */
663
- CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
664
- #ifdef CK_NEED_ARG_LIST
665
- (
666
- CK_SESSION_HANDLE hSession, /* the session's handle */
667
- CK_BYTE_PTR pSignature, /* signature to verify */
668
- CK_ULONG ulSignatureLen /* signature length */
669
- );
670
- #endif
671
-
672
-
673
- /* C_VerifyRecoverInit initializes a signature verification
674
- * operation, where the data is recovered from the signature. */
675
- CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
676
- #ifdef CK_NEED_ARG_LIST
677
- (
678
- CK_SESSION_HANDLE hSession, /* the session's handle */
679
- CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
680
- CK_OBJECT_HANDLE hKey /* verification key */
681
- );
682
- #endif
683
-
684
-
685
- /* C_VerifyRecover verifies a signature in a single-part
686
- * operation, where the data is recovered from the signature. */
687
- CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
688
- #ifdef CK_NEED_ARG_LIST
689
- (
690
- CK_SESSION_HANDLE hSession, /* the session's handle */
691
- CK_BYTE_PTR pSignature, /* signature to verify */
692
- CK_ULONG ulSignatureLen, /* signature length */
693
- CK_BYTE_PTR pData, /* gets signed data */
694
- CK_ULONG_PTR pulDataLen /* gets signed data len */
695
- );
696
- #endif
697
-
698
-
699
-
700
- /* Dual-function cryptographic operations */
701
-
702
- /* C_DigestEncryptUpdate continues a multiple-part digesting
703
- * and encryption operation. */
704
- CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
705
- #ifdef CK_NEED_ARG_LIST
706
- (
707
- CK_SESSION_HANDLE hSession, /* session's handle */
708
- CK_BYTE_PTR pPart, /* the plaintext data */
709
- CK_ULONG ulPartLen, /* plaintext length */
710
- CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
711
- CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
712
- );
713
- #endif
714
-
715
-
716
- /* C_DecryptDigestUpdate continues a multiple-part decryption and
717
- * digesting operation. */
718
- CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
719
- #ifdef CK_NEED_ARG_LIST
720
- (
721
- CK_SESSION_HANDLE hSession, /* session's handle */
722
- CK_BYTE_PTR pEncryptedPart, /* ciphertext */
723
- CK_ULONG ulEncryptedPartLen, /* ciphertext length */
724
- CK_BYTE_PTR pPart, /* gets plaintext */
725
- CK_ULONG_PTR pulPartLen /* gets plaintext len */
726
- );
727
- #endif
728
-
729
-
730
- /* C_SignEncryptUpdate continues a multiple-part signing and
731
- * encryption operation. */
732
- CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
733
- #ifdef CK_NEED_ARG_LIST
734
- (
735
- CK_SESSION_HANDLE hSession, /* session's handle */
736
- CK_BYTE_PTR pPart, /* the plaintext data */
737
- CK_ULONG ulPartLen, /* plaintext length */
738
- CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
739
- CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
740
- );
741
- #endif
742
-
743
-
744
- /* C_DecryptVerifyUpdate continues a multiple-part decryption and
745
- * verify operation. */
746
- CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
747
- #ifdef CK_NEED_ARG_LIST
748
- (
749
- CK_SESSION_HANDLE hSession, /* session's handle */
750
- CK_BYTE_PTR pEncryptedPart, /* ciphertext */
751
- CK_ULONG ulEncryptedPartLen, /* ciphertext length */
752
- CK_BYTE_PTR pPart, /* gets plaintext */
753
- CK_ULONG_PTR pulPartLen /* gets p-text length */
754
- );
755
- #endif
756
-
757
-
758
-
759
- /* Key management */
760
-
761
- /* C_GenerateKey generates a secret key, creating a new key
762
- * object. */
763
- CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
764
- #ifdef CK_NEED_ARG_LIST
765
- (
766
- CK_SESSION_HANDLE hSession, /* the session's handle */
767
- CK_MECHANISM_PTR pMechanism, /* key generation mech. */
768
- CK_ATTRIBUTE_PTR pTemplate, /* template for new key */
769
- CK_ULONG ulCount, /* # of attrs in template */
770
- CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */
771
- );
772
- #endif
773
-
774
-
775
- /* C_GenerateKeyPair generates a public-key/private-key pair,
776
- * creating new key objects. */
777
- CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
778
- #ifdef CK_NEED_ARG_LIST
779
- (
780
- CK_SESSION_HANDLE hSession, /* session
781
- * handle */
782
- CK_MECHANISM_PTR pMechanism, /* key-gen
783
- * mech. */
784
- CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template
785
- * for pub.
786
- * key */
787
- CK_ULONG ulPublicKeyAttributeCount, /* # pub.
788
- * attrs. */
789
- CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template
790
- * for priv.
791
- * key */
792
- CK_ULONG ulPrivateKeyAttributeCount, /* # priv.
793
- * attrs. */
794
- CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub.
795
- * key
796
- * handle */
797
- CK_OBJECT_HANDLE_PTR phPrivateKey /* gets
798
- * priv. key
799
- * handle */
800
- );
801
- #endif
802
-
803
-
804
- /* C_WrapKey wraps (i.e., encrypts) a key. */
805
- CK_PKCS11_FUNCTION_INFO(C_WrapKey)
806
- #ifdef CK_NEED_ARG_LIST
807
- (
808
- CK_SESSION_HANDLE hSession, /* the session's handle */
809
- CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */
810
- CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */
811
- CK_OBJECT_HANDLE hKey, /* key to be wrapped */
812
- CK_BYTE_PTR pWrappedKey, /* gets wrapped key */
813
- CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */
814
- );
815
- #endif
816
-
817
-
818
- /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
819
- * key object. */
820
- CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
821
- #ifdef CK_NEED_ARG_LIST
822
- (
823
- CK_SESSION_HANDLE hSession, /* session's handle */
824
- CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */
825
- CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */
826
- CK_BYTE_PTR pWrappedKey, /* the wrapped key */
827
- CK_ULONG ulWrappedKeyLen, /* wrapped key len */
828
- CK_ATTRIBUTE_PTR pTemplate, /* new key template */
829
- CK_ULONG ulAttributeCount, /* template length */
830
- CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
831
- );
832
- #endif
833
-
834
-
835
- /* C_DeriveKey derives a key from a base key, creating a new key
836
- * object. */
837
- CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
838
- #ifdef CK_NEED_ARG_LIST
839
- (
840
- CK_SESSION_HANDLE hSession, /* session's handle */
841
- CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */
842
- CK_OBJECT_HANDLE hBaseKey, /* base key */
843
- CK_ATTRIBUTE_PTR pTemplate, /* new key template */
844
- CK_ULONG ulAttributeCount, /* template length */
845
- CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
846
- );
847
- #endif
848
-
849
-
850
-
851
- /* Random number generation */
852
-
853
- /* C_SeedRandom mixes additional seed material into the token's
854
- * random number generator. */
855
- CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
856
- #ifdef CK_NEED_ARG_LIST
857
- (
858
- CK_SESSION_HANDLE hSession, /* the session's handle */
859
- CK_BYTE_PTR pSeed, /* the seed material */
860
- CK_ULONG ulSeedLen /* length of seed material */
861
- );
862
- #endif
863
-
864
-
865
- /* C_GenerateRandom generates random data. */
866
- CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
867
- #ifdef CK_NEED_ARG_LIST
868
- (
869
- CK_SESSION_HANDLE hSession, /* the session's handle */
870
- CK_BYTE_PTR RandomData, /* receives the random data */
871
- CK_ULONG ulRandomLen /* # of bytes to generate */
872
- );
873
- #endif
874
-
875
-
876
-
877
- /* Parallel function management */
878
-
879
- /* C_GetFunctionStatus is a legacy function; it obtains an
880
- * updated status of a function running in parallel with an
881
- * application. */
882
- CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
883
- #ifdef CK_NEED_ARG_LIST
884
- (
885
- CK_SESSION_HANDLE hSession /* the session's handle */
886
- );
887
- #endif
888
-
889
-
890
- /* C_CancelFunction is a legacy function; it cancels a function
891
- * running in parallel. */
892
- CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
893
- #ifdef CK_NEED_ARG_LIST
894
- (
895
- CK_SESSION_HANDLE hSession /* the session's handle */
896
- );
897
- #endif
898
-
899
-
900
-
901
- /* Functions added in for Cryptoki Version 2.01 or later */
902
-
903
- /* C_WaitForSlotEvent waits for a slot event (token insertion,
904
- * removal, etc.) to occur. */
905
- CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
906
- #ifdef CK_NEED_ARG_LIST
907
- (
908
- CK_FLAGS flags, /* blocking/nonblocking flag */
909
- CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
910
- CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */
911
- );
912
- #endif
1
+ /*
2
+ * Copyright (C) OASIS Open 2014. All rights reserved.
3
+ * OASIS trademark, IPR and other policies apply.
4
+ * http://www.oasis-open.org/policies-guidelines/ipr
5
+ */
6
+
7
+ /* This header file contains pretty much everything about all the */
8
+ /* Cryptoki function prototypes. Because this information is */
9
+ /* used for more than just declaring function prototypes, the */
10
+ /* order of the functions appearing herein is important, and */
11
+ /* should not be altered. */
12
+
13
+ /* General-purpose */
14
+
15
+ /* C_Initialize initializes the Cryptoki library. */
16
+ CK_PKCS11_FUNCTION_INFO(C_Initialize)
17
+ #ifdef CK_NEED_ARG_LIST
18
+ (
19
+ CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets
20
+ * cast to CK_C_INITIALIZE_ARGS_PTR
21
+ * and dereferenced */
22
+ );
23
+ #endif
24
+
25
+
26
+ /* C_Finalize indicates that an application is done with the
27
+ * Cryptoki library. */
28
+ CK_PKCS11_FUNCTION_INFO(C_Finalize)
29
+ #ifdef CK_NEED_ARG_LIST
30
+ (
31
+ CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */
32
+ );
33
+ #endif
34
+
35
+
36
+ /* C_GetInfo returns general information about Cryptoki. */
37
+ CK_PKCS11_FUNCTION_INFO(C_GetInfo)
38
+ #ifdef CK_NEED_ARG_LIST
39
+ (
40
+ CK_INFO_PTR pInfo /* location that receives information */
41
+ );
42
+ #endif
43
+
44
+
45
+ /* C_GetFunctionList returns the function list. */
46
+ CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
47
+ #ifdef CK_NEED_ARG_LIST
48
+ (
49
+ CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to
50
+ * function list */
51
+ );
52
+ #endif
53
+
54
+
55
+
56
+ /* Slot and token management */
57
+
58
+ /* C_GetSlotList obtains a list of slots in the system. */
59
+ CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
60
+ #ifdef CK_NEED_ARG_LIST
61
+ (
62
+ CK_BBOOL tokenPresent, /* only slots with tokens? */
63
+ CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */
64
+ CK_ULONG_PTR pulCount /* receives number of slots */
65
+ );
66
+ #endif
67
+
68
+
69
+ /* C_GetSlotInfo obtains information about a particular slot in
70
+ * the system. */
71
+ CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
72
+ #ifdef CK_NEED_ARG_LIST
73
+ (
74
+ CK_SLOT_ID slotID, /* the ID of the slot */
75
+ CK_SLOT_INFO_PTR pInfo /* receives the slot information */
76
+ );
77
+ #endif
78
+
79
+
80
+ /* C_GetTokenInfo obtains information about a particular token
81
+ * in the system. */
82
+ CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
83
+ #ifdef CK_NEED_ARG_LIST
84
+ (
85
+ CK_SLOT_ID slotID, /* ID of the token's slot */
86
+ CK_TOKEN_INFO_PTR pInfo /* receives the token information */
87
+ );
88
+ #endif
89
+
90
+
91
+ /* C_GetMechanismList obtains a list of mechanism types
92
+ * supported by a token. */
93
+ CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
94
+ #ifdef CK_NEED_ARG_LIST
95
+ (
96
+ CK_SLOT_ID slotID, /* ID of token's slot */
97
+ CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */
98
+ CK_ULONG_PTR pulCount /* gets # of mechs. */
99
+ );
100
+ #endif
101
+
102
+
103
+ /* C_GetMechanismInfo obtains information about a particular
104
+ * mechanism possibly supported by a token. */
105
+ CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
106
+ #ifdef CK_NEED_ARG_LIST
107
+ (
108
+ CK_SLOT_ID slotID, /* ID of the token's slot */
109
+ CK_MECHANISM_TYPE type, /* type of mechanism */
110
+ CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */
111
+ );
112
+ #endif
113
+
114
+
115
+ /* C_InitToken initializes a token. */
116
+ CK_PKCS11_FUNCTION_INFO(C_InitToken)
117
+ #ifdef CK_NEED_ARG_LIST
118
+ /* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
119
+ (
120
+ CK_SLOT_ID slotID, /* ID of the token's slot */
121
+ CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */
122
+ CK_ULONG ulPinLen, /* length in bytes of the PIN */
123
+ CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */
124
+ );
125
+ #endif
126
+
127
+
128
+ /* C_InitPIN initializes the normal user's PIN. */
129
+ CK_PKCS11_FUNCTION_INFO(C_InitPIN)
130
+ #ifdef CK_NEED_ARG_LIST
131
+ (
132
+ CK_SESSION_HANDLE hSession, /* the session's handle */
133
+ CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */
134
+ CK_ULONG ulPinLen /* length in bytes of the PIN */
135
+ );
136
+ #endif
137
+
138
+
139
+ /* C_SetPIN modifies the PIN of the user who is logged in. */
140
+ CK_PKCS11_FUNCTION_INFO(C_SetPIN)
141
+ #ifdef CK_NEED_ARG_LIST
142
+ (
143
+ CK_SESSION_HANDLE hSession, /* the session's handle */
144
+ CK_UTF8CHAR_PTR pOldPin, /* the old PIN */
145
+ CK_ULONG ulOldLen, /* length of the old PIN */
146
+ CK_UTF8CHAR_PTR pNewPin, /* the new PIN */
147
+ CK_ULONG ulNewLen /* length of the new PIN */
148
+ );
149
+ #endif
150
+
151
+
152
+
153
+ /* Session management */
154
+
155
+ /* C_OpenSession opens a session between an application and a
156
+ * token. */
157
+ CK_PKCS11_FUNCTION_INFO(C_OpenSession)
158
+ #ifdef CK_NEED_ARG_LIST
159
+ (
160
+ CK_SLOT_ID slotID, /* the slot's ID */
161
+ CK_FLAGS flags, /* from CK_SESSION_INFO */
162
+ CK_VOID_PTR pApplication, /* passed to callback */
163
+ CK_NOTIFY Notify, /* callback function */
164
+ CK_SESSION_HANDLE_PTR phSession /* gets session handle */
165
+ );
166
+ #endif
167
+
168
+
169
+ /* C_CloseSession closes a session between an application and a
170
+ * token. */
171
+ CK_PKCS11_FUNCTION_INFO(C_CloseSession)
172
+ #ifdef CK_NEED_ARG_LIST
173
+ (
174
+ CK_SESSION_HANDLE hSession /* the session's handle */
175
+ );
176
+ #endif
177
+
178
+
179
+ /* C_CloseAllSessions closes all sessions with a token. */
180
+ CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
181
+ #ifdef CK_NEED_ARG_LIST
182
+ (
183
+ CK_SLOT_ID slotID /* the token's slot */
184
+ );
185
+ #endif
186
+
187
+
188
+ /* C_GetSessionInfo obtains information about the session. */
189
+ CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
190
+ #ifdef CK_NEED_ARG_LIST
191
+ (
192
+ CK_SESSION_HANDLE hSession, /* the session's handle */
193
+ CK_SESSION_INFO_PTR pInfo /* receives session info */
194
+ );
195
+ #endif
196
+
197
+
198
+ /* C_GetOperationState obtains the state of the cryptographic operation
199
+ * in a session. */
200
+ CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
201
+ #ifdef CK_NEED_ARG_LIST
202
+ (
203
+ CK_SESSION_HANDLE hSession, /* session's handle */
204
+ CK_BYTE_PTR pOperationState, /* gets state */
205
+ CK_ULONG_PTR pulOperationStateLen /* gets state length */
206
+ );
207
+ #endif
208
+
209
+
210
+ /* C_SetOperationState restores the state of the cryptographic
211
+ * operation in a session. */
212
+ CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
213
+ #ifdef CK_NEED_ARG_LIST
214
+ (
215
+ CK_SESSION_HANDLE hSession, /* session's handle */
216
+ CK_BYTE_PTR pOperationState, /* holds state */
217
+ CK_ULONG ulOperationStateLen, /* holds state length */
218
+ CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */
219
+ CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */
220
+ );
221
+ #endif
222
+
223
+
224
+ /* C_Login logs a user into a token. */
225
+ CK_PKCS11_FUNCTION_INFO(C_Login)
226
+ #ifdef CK_NEED_ARG_LIST
227
+ (
228
+ CK_SESSION_HANDLE hSession, /* the session's handle */
229
+ CK_USER_TYPE userType, /* the user type */
230
+ CK_UTF8CHAR_PTR pPin, /* the user's PIN */
231
+ CK_ULONG ulPinLen /* the length of the PIN */
232
+ );
233
+ #endif
234
+
235
+
236
+ /* C_Logout logs a user out from a token. */
237
+ CK_PKCS11_FUNCTION_INFO(C_Logout)
238
+ #ifdef CK_NEED_ARG_LIST
239
+ (
240
+ CK_SESSION_HANDLE hSession /* the session's handle */
241
+ );
242
+ #endif
243
+
244
+
245
+
246
+ /* Object management */
247
+
248
+ /* C_CreateObject creates a new object. */
249
+ CK_PKCS11_FUNCTION_INFO(C_CreateObject)
250
+ #ifdef CK_NEED_ARG_LIST
251
+ (
252
+ CK_SESSION_HANDLE hSession, /* the session's handle */
253
+ CK_ATTRIBUTE_PTR pTemplate, /* the object's template */
254
+ CK_ULONG ulCount, /* attributes in template */
255
+ CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */
256
+ );
257
+ #endif
258
+
259
+
260
+ /* C_CopyObject copies an object, creating a new object for the
261
+ * copy. */
262
+ CK_PKCS11_FUNCTION_INFO(C_CopyObject)
263
+ #ifdef CK_NEED_ARG_LIST
264
+ (
265
+ CK_SESSION_HANDLE hSession, /* the session's handle */
266
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
267
+ CK_ATTRIBUTE_PTR pTemplate, /* template for new object */
268
+ CK_ULONG ulCount, /* attributes in template */
269
+ CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */
270
+ );
271
+ #endif
272
+
273
+
274
+ /* C_DestroyObject destroys an object. */
275
+ CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
276
+ #ifdef CK_NEED_ARG_LIST
277
+ (
278
+ CK_SESSION_HANDLE hSession, /* the session's handle */
279
+ CK_OBJECT_HANDLE hObject /* the object's handle */
280
+ );
281
+ #endif
282
+
283
+
284
+ /* C_GetObjectSize gets the size of an object in bytes. */
285
+ CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
286
+ #ifdef CK_NEED_ARG_LIST
287
+ (
288
+ CK_SESSION_HANDLE hSession, /* the session's handle */
289
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
290
+ CK_ULONG_PTR pulSize /* receives size of object */
291
+ );
292
+ #endif
293
+
294
+
295
+ /* C_GetAttributeValue obtains the value of one or more object
296
+ * attributes. */
297
+ CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
298
+ #ifdef CK_NEED_ARG_LIST
299
+ (
300
+ CK_SESSION_HANDLE hSession, /* the session's handle */
301
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
302
+ CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */
303
+ CK_ULONG ulCount /* attributes in template */
304
+ );
305
+ #endif
306
+
307
+
308
+ /* C_SetAttributeValue modifies the value of one or more object
309
+ * attributes */
310
+ CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
311
+ #ifdef CK_NEED_ARG_LIST
312
+ (
313
+ CK_SESSION_HANDLE hSession, /* the session's handle */
314
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
315
+ CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */
316
+ CK_ULONG ulCount /* attributes in template */
317
+ );
318
+ #endif
319
+
320
+
321
+ /* C_FindObjectsInit initializes a search for token and session
322
+ * objects that match a template. */
323
+ CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
324
+ #ifdef CK_NEED_ARG_LIST
325
+ (
326
+ CK_SESSION_HANDLE hSession, /* the session's handle */
327
+ CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */
328
+ CK_ULONG ulCount /* attrs in search template */
329
+ );
330
+ #endif
331
+
332
+
333
+ /* C_FindObjects continues a search for token and session
334
+ * objects that match a template, obtaining additional object
335
+ * handles. */
336
+ CK_PKCS11_FUNCTION_INFO(C_FindObjects)
337
+ #ifdef CK_NEED_ARG_LIST
338
+ (
339
+ CK_SESSION_HANDLE hSession, /* session's handle */
340
+ CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */
341
+ CK_ULONG ulMaxObjectCount, /* max handles to get */
342
+ CK_ULONG_PTR pulObjectCount /* actual # returned */
343
+ );
344
+ #endif
345
+
346
+
347
+ /* C_FindObjectsFinal finishes a search for token and session
348
+ * objects. */
349
+ CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
350
+ #ifdef CK_NEED_ARG_LIST
351
+ (
352
+ CK_SESSION_HANDLE hSession /* the session's handle */
353
+ );
354
+ #endif
355
+
356
+
357
+
358
+ /* Encryption and decryption */
359
+
360
+ /* C_EncryptInit initializes an encryption operation. */
361
+ CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
362
+ #ifdef CK_NEED_ARG_LIST
363
+ (
364
+ CK_SESSION_HANDLE hSession, /* the session's handle */
365
+ CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
366
+ CK_OBJECT_HANDLE hKey /* handle of encryption key */
367
+ );
368
+ #endif
369
+
370
+
371
+ /* C_Encrypt encrypts single-part data. */
372
+ CK_PKCS11_FUNCTION_INFO(C_Encrypt)
373
+ #ifdef CK_NEED_ARG_LIST
374
+ (
375
+ CK_SESSION_HANDLE hSession, /* session's handle */
376
+ CK_BYTE_PTR pData, /* the plaintext data */
377
+ CK_ULONG ulDataLen, /* bytes of plaintext */
378
+ CK_BYTE_PTR pEncryptedData, /* gets ciphertext */
379
+ CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */
380
+ );
381
+ #endif
382
+
383
+
384
+ /* C_EncryptUpdate continues a multiple-part encryption
385
+ * operation. */
386
+ CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
387
+ #ifdef CK_NEED_ARG_LIST
388
+ (
389
+ CK_SESSION_HANDLE hSession, /* session's handle */
390
+ CK_BYTE_PTR pPart, /* the plaintext data */
391
+ CK_ULONG ulPartLen, /* plaintext data len */
392
+ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
393
+ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */
394
+ );
395
+ #endif
396
+
397
+
398
+ /* C_EncryptFinal finishes a multiple-part encryption
399
+ * operation. */
400
+ CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
401
+ #ifdef CK_NEED_ARG_LIST
402
+ (
403
+ CK_SESSION_HANDLE hSession, /* session handle */
404
+ CK_BYTE_PTR pLastEncryptedPart, /* last c-text */
405
+ CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */
406
+ );
407
+ #endif
408
+
409
+
410
+ /* C_DecryptInit initializes a decryption operation. */
411
+ CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
412
+ #ifdef CK_NEED_ARG_LIST
413
+ (
414
+ CK_SESSION_HANDLE hSession, /* the session's handle */
415
+ CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
416
+ CK_OBJECT_HANDLE hKey /* handle of decryption key */
417
+ );
418
+ #endif
419
+
420
+
421
+ /* C_Decrypt decrypts encrypted data in a single part. */
422
+ CK_PKCS11_FUNCTION_INFO(C_Decrypt)
423
+ #ifdef CK_NEED_ARG_LIST
424
+ (
425
+ CK_SESSION_HANDLE hSession, /* session's handle */
426
+ CK_BYTE_PTR pEncryptedData, /* ciphertext */
427
+ CK_ULONG ulEncryptedDataLen, /* ciphertext length */
428
+ CK_BYTE_PTR pData, /* gets plaintext */
429
+ CK_ULONG_PTR pulDataLen /* gets p-text size */
430
+ );
431
+ #endif
432
+
433
+
434
+ /* C_DecryptUpdate continues a multiple-part decryption
435
+ * operation. */
436
+ CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
437
+ #ifdef CK_NEED_ARG_LIST
438
+ (
439
+ CK_SESSION_HANDLE hSession, /* session's handle */
440
+ CK_BYTE_PTR pEncryptedPart, /* encrypted data */
441
+ CK_ULONG ulEncryptedPartLen, /* input length */
442
+ CK_BYTE_PTR pPart, /* gets plaintext */
443
+ CK_ULONG_PTR pulPartLen /* p-text size */
444
+ );
445
+ #endif
446
+
447
+
448
+ /* C_DecryptFinal finishes a multiple-part decryption
449
+ * operation. */
450
+ CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
451
+ #ifdef CK_NEED_ARG_LIST
452
+ (
453
+ CK_SESSION_HANDLE hSession, /* the session's handle */
454
+ CK_BYTE_PTR pLastPart, /* gets plaintext */
455
+ CK_ULONG_PTR pulLastPartLen /* p-text size */
456
+ );
457
+ #endif
458
+
459
+
460
+
461
+ /* Message digesting */
462
+
463
+ /* C_DigestInit initializes a message-digesting operation. */
464
+ CK_PKCS11_FUNCTION_INFO(C_DigestInit)
465
+ #ifdef CK_NEED_ARG_LIST
466
+ (
467
+ CK_SESSION_HANDLE hSession, /* the session's handle */
468
+ CK_MECHANISM_PTR pMechanism /* the digesting mechanism */
469
+ );
470
+ #endif
471
+
472
+
473
+ /* C_Digest digests data in a single part. */
474
+ CK_PKCS11_FUNCTION_INFO(C_Digest)
475
+ #ifdef CK_NEED_ARG_LIST
476
+ (
477
+ CK_SESSION_HANDLE hSession, /* the session's handle */
478
+ CK_BYTE_PTR pData, /* data to be digested */
479
+ CK_ULONG ulDataLen, /* bytes of data to digest */
480
+ CK_BYTE_PTR pDigest, /* gets the message digest */
481
+ CK_ULONG_PTR pulDigestLen /* gets digest length */
482
+ );
483
+ #endif
484
+
485
+
486
+ /* C_DigestUpdate continues a multiple-part message-digesting
487
+ * operation. */
488
+ CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
489
+ #ifdef CK_NEED_ARG_LIST
490
+ (
491
+ CK_SESSION_HANDLE hSession, /* the session's handle */
492
+ CK_BYTE_PTR pPart, /* data to be digested */
493
+ CK_ULONG ulPartLen /* bytes of data to be digested */
494
+ );
495
+ #endif
496
+
497
+
498
+ /* C_DigestKey continues a multi-part message-digesting
499
+ * operation, by digesting the value of a secret key as part of
500
+ * the data already digested. */
501
+ CK_PKCS11_FUNCTION_INFO(C_DigestKey)
502
+ #ifdef CK_NEED_ARG_LIST
503
+ (
504
+ CK_SESSION_HANDLE hSession, /* the session's handle */
505
+ CK_OBJECT_HANDLE hKey /* secret key to digest */
506
+ );
507
+ #endif
508
+
509
+
510
+ /* C_DigestFinal finishes a multiple-part message-digesting
511
+ * operation. */
512
+ CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
513
+ #ifdef CK_NEED_ARG_LIST
514
+ (
515
+ CK_SESSION_HANDLE hSession, /* the session's handle */
516
+ CK_BYTE_PTR pDigest, /* gets the message digest */
517
+ CK_ULONG_PTR pulDigestLen /* gets byte count of digest */
518
+ );
519
+ #endif
520
+
521
+
522
+
523
+ /* Signing and MACing */
524
+
525
+ /* C_SignInit initializes a signature (private key encryption)
526
+ * operation, where the signature is (will be) an appendix to
527
+ * the data, and plaintext cannot be recovered from the
528
+ *signature. */
529
+ CK_PKCS11_FUNCTION_INFO(C_SignInit)
530
+ #ifdef CK_NEED_ARG_LIST
531
+ (
532
+ CK_SESSION_HANDLE hSession, /* the session's handle */
533
+ CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
534
+ CK_OBJECT_HANDLE hKey /* handle of signature key */
535
+ );
536
+ #endif
537
+
538
+
539
+ /* C_Sign signs (encrypts with private key) data in a single
540
+ * part, where the signature is (will be) an appendix to the
541
+ * data, and plaintext cannot be recovered from the signature. */
542
+ CK_PKCS11_FUNCTION_INFO(C_Sign)
543
+ #ifdef CK_NEED_ARG_LIST
544
+ (
545
+ CK_SESSION_HANDLE hSession, /* the session's handle */
546
+ CK_BYTE_PTR pData, /* the data to sign */
547
+ CK_ULONG ulDataLen, /* count of bytes to sign */
548
+ CK_BYTE_PTR pSignature, /* gets the signature */
549
+ CK_ULONG_PTR pulSignatureLen /* gets signature length */
550
+ );
551
+ #endif
552
+
553
+
554
+ /* C_SignUpdate continues a multiple-part signature operation,
555
+ * where the signature is (will be) an appendix to the data,
556
+ * and plaintext cannot be recovered from the signature. */
557
+ CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
558
+ #ifdef CK_NEED_ARG_LIST
559
+ (
560
+ CK_SESSION_HANDLE hSession, /* the session's handle */
561
+ CK_BYTE_PTR pPart, /* the data to sign */
562
+ CK_ULONG ulPartLen /* count of bytes to sign */
563
+ );
564
+ #endif
565
+
566
+
567
+ /* C_SignFinal finishes a multiple-part signature operation,
568
+ * returning the signature. */
569
+ CK_PKCS11_FUNCTION_INFO(C_SignFinal)
570
+ #ifdef CK_NEED_ARG_LIST
571
+ (
572
+ CK_SESSION_HANDLE hSession, /* the session's handle */
573
+ CK_BYTE_PTR pSignature, /* gets the signature */
574
+ CK_ULONG_PTR pulSignatureLen /* gets signature length */
575
+ );
576
+ #endif
577
+
578
+
579
+ /* C_SignRecoverInit initializes a signature operation, where
580
+ * the data can be recovered from the signature. */
581
+ CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
582
+ #ifdef CK_NEED_ARG_LIST
583
+ (
584
+ CK_SESSION_HANDLE hSession, /* the session's handle */
585
+ CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
586
+ CK_OBJECT_HANDLE hKey /* handle of the signature key */
587
+ );
588
+ #endif
589
+
590
+
591
+ /* C_SignRecover signs data in a single operation, where the
592
+ * data can be recovered from the signature. */
593
+ CK_PKCS11_FUNCTION_INFO(C_SignRecover)
594
+ #ifdef CK_NEED_ARG_LIST
595
+ (
596
+ CK_SESSION_HANDLE hSession, /* the session's handle */
597
+ CK_BYTE_PTR pData, /* the data to sign */
598
+ CK_ULONG ulDataLen, /* count of bytes to sign */
599
+ CK_BYTE_PTR pSignature, /* gets the signature */
600
+ CK_ULONG_PTR pulSignatureLen /* gets signature length */
601
+ );
602
+ #endif
603
+
604
+
605
+
606
+ /* Verifying signatures and MACs */
607
+
608
+ /* C_VerifyInit initializes a verification operation, where the
609
+ * signature is an appendix to the data, and plaintext cannot
610
+ * cannot be recovered from the signature (e.g. DSA). */
611
+ CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
612
+ #ifdef CK_NEED_ARG_LIST
613
+ (
614
+ CK_SESSION_HANDLE hSession, /* the session's handle */
615
+ CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
616
+ CK_OBJECT_HANDLE hKey /* verification key */
617
+ );
618
+ #endif
619
+
620
+
621
+ /* C_Verify verifies a signature in a single-part operation,
622
+ * where the signature is an appendix to the data, and plaintext
623
+ * cannot be recovered from the signature. */
624
+ CK_PKCS11_FUNCTION_INFO(C_Verify)
625
+ #ifdef CK_NEED_ARG_LIST
626
+ (
627
+ CK_SESSION_HANDLE hSession, /* the session's handle */
628
+ CK_BYTE_PTR pData, /* signed data */
629
+ CK_ULONG ulDataLen, /* length of signed data */
630
+ CK_BYTE_PTR pSignature, /* signature */
631
+ CK_ULONG ulSignatureLen /* signature length*/
632
+ );
633
+ #endif
634
+
635
+
636
+ /* C_VerifyUpdate continues a multiple-part verification
637
+ * operation, where the signature is an appendix to the data,
638
+ * and plaintext cannot be recovered from the signature. */
639
+ CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
640
+ #ifdef CK_NEED_ARG_LIST
641
+ (
642
+ CK_SESSION_HANDLE hSession, /* the session's handle */
643
+ CK_BYTE_PTR pPart, /* signed data */
644
+ CK_ULONG ulPartLen /* length of signed data */
645
+ );
646
+ #endif
647
+
648
+
649
+ /* C_VerifyFinal finishes a multiple-part verification
650
+ * operation, checking the signature. */
651
+ CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
652
+ #ifdef CK_NEED_ARG_LIST
653
+ (
654
+ CK_SESSION_HANDLE hSession, /* the session's handle */
655
+ CK_BYTE_PTR pSignature, /* signature to verify */
656
+ CK_ULONG ulSignatureLen /* signature length */
657
+ );
658
+ #endif
659
+
660
+
661
+ /* C_VerifyRecoverInit initializes a signature verification
662
+ * operation, where the data is recovered from the signature. */
663
+ CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
664
+ #ifdef CK_NEED_ARG_LIST
665
+ (
666
+ CK_SESSION_HANDLE hSession, /* the session's handle */
667
+ CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
668
+ CK_OBJECT_HANDLE hKey /* verification key */
669
+ );
670
+ #endif
671
+
672
+
673
+ /* C_VerifyRecover verifies a signature in a single-part
674
+ * operation, where the data is recovered from the signature. */
675
+ CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
676
+ #ifdef CK_NEED_ARG_LIST
677
+ (
678
+ CK_SESSION_HANDLE hSession, /* the session's handle */
679
+ CK_BYTE_PTR pSignature, /* signature to verify */
680
+ CK_ULONG ulSignatureLen, /* signature length */
681
+ CK_BYTE_PTR pData, /* gets signed data */
682
+ CK_ULONG_PTR pulDataLen /* gets signed data len */
683
+ );
684
+ #endif
685
+
686
+
687
+
688
+ /* Dual-function cryptographic operations */
689
+
690
+ /* C_DigestEncryptUpdate continues a multiple-part digesting
691
+ * and encryption operation. */
692
+ CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
693
+ #ifdef CK_NEED_ARG_LIST
694
+ (
695
+ CK_SESSION_HANDLE hSession, /* session's handle */
696
+ CK_BYTE_PTR pPart, /* the plaintext data */
697
+ CK_ULONG ulPartLen, /* plaintext length */
698
+ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
699
+ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
700
+ );
701
+ #endif
702
+
703
+
704
+ /* C_DecryptDigestUpdate continues a multiple-part decryption and
705
+ * digesting operation. */
706
+ CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
707
+ #ifdef CK_NEED_ARG_LIST
708
+ (
709
+ CK_SESSION_HANDLE hSession, /* session's handle */
710
+ CK_BYTE_PTR pEncryptedPart, /* ciphertext */
711
+ CK_ULONG ulEncryptedPartLen, /* ciphertext length */
712
+ CK_BYTE_PTR pPart, /* gets plaintext */
713
+ CK_ULONG_PTR pulPartLen /* gets plaintext len */
714
+ );
715
+ #endif
716
+
717
+
718
+ /* C_SignEncryptUpdate continues a multiple-part signing and
719
+ * encryption operation. */
720
+ CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
721
+ #ifdef CK_NEED_ARG_LIST
722
+ (
723
+ CK_SESSION_HANDLE hSession, /* session's handle */
724
+ CK_BYTE_PTR pPart, /* the plaintext data */
725
+ CK_ULONG ulPartLen, /* plaintext length */
726
+ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
727
+ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
728
+ );
729
+ #endif
730
+
731
+
732
+ /* C_DecryptVerifyUpdate continues a multiple-part decryption and
733
+ * verify operation. */
734
+ CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
735
+ #ifdef CK_NEED_ARG_LIST
736
+ (
737
+ CK_SESSION_HANDLE hSession, /* session's handle */
738
+ CK_BYTE_PTR pEncryptedPart, /* ciphertext */
739
+ CK_ULONG ulEncryptedPartLen, /* ciphertext length */
740
+ CK_BYTE_PTR pPart, /* gets plaintext */
741
+ CK_ULONG_PTR pulPartLen /* gets p-text length */
742
+ );
743
+ #endif
744
+
745
+
746
+
747
+ /* Key management */
748
+
749
+ /* C_GenerateKey generates a secret key, creating a new key
750
+ * object. */
751
+ CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
752
+ #ifdef CK_NEED_ARG_LIST
753
+ (
754
+ CK_SESSION_HANDLE hSession, /* the session's handle */
755
+ CK_MECHANISM_PTR pMechanism, /* key generation mech. */
756
+ CK_ATTRIBUTE_PTR pTemplate, /* template for new key */
757
+ CK_ULONG ulCount, /* # of attrs in template */
758
+ CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */
759
+ );
760
+ #endif
761
+
762
+
763
+ /* C_GenerateKeyPair generates a public-key/private-key pair,
764
+ * creating new key objects. */
765
+ CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
766
+ #ifdef CK_NEED_ARG_LIST
767
+ (
768
+ CK_SESSION_HANDLE hSession, /* session
769
+ * handle */
770
+ CK_MECHANISM_PTR pMechanism, /* key-gen
771
+ * mech. */
772
+ CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template
773
+ * for pub.
774
+ * key */
775
+ CK_ULONG ulPublicKeyAttributeCount, /* # pub.
776
+ * attrs. */
777
+ CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template
778
+ * for priv.
779
+ * key */
780
+ CK_ULONG ulPrivateKeyAttributeCount, /* # priv.
781
+ * attrs. */
782
+ CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub.
783
+ * key
784
+ * handle */
785
+ CK_OBJECT_HANDLE_PTR phPrivateKey /* gets
786
+ * priv. key
787
+ * handle */
788
+ );
789
+ #endif
790
+
791
+
792
+ /* C_WrapKey wraps (i.e., encrypts) a key. */
793
+ CK_PKCS11_FUNCTION_INFO(C_WrapKey)
794
+ #ifdef CK_NEED_ARG_LIST
795
+ (
796
+ CK_SESSION_HANDLE hSession, /* the session's handle */
797
+ CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */
798
+ CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */
799
+ CK_OBJECT_HANDLE hKey, /* key to be wrapped */
800
+ CK_BYTE_PTR pWrappedKey, /* gets wrapped key */
801
+ CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */
802
+ );
803
+ #endif
804
+
805
+
806
+ /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
807
+ * key object. */
808
+ CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
809
+ #ifdef CK_NEED_ARG_LIST
810
+ (
811
+ CK_SESSION_HANDLE hSession, /* session's handle */
812
+ CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */
813
+ CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */
814
+ CK_BYTE_PTR pWrappedKey, /* the wrapped key */
815
+ CK_ULONG ulWrappedKeyLen, /* wrapped key len */
816
+ CK_ATTRIBUTE_PTR pTemplate, /* new key template */
817
+ CK_ULONG ulAttributeCount, /* template length */
818
+ CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
819
+ );
820
+ #endif
821
+
822
+
823
+ /* C_DeriveKey derives a key from a base key, creating a new key
824
+ * object. */
825
+ CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
826
+ #ifdef CK_NEED_ARG_LIST
827
+ (
828
+ CK_SESSION_HANDLE hSession, /* session's handle */
829
+ CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */
830
+ CK_OBJECT_HANDLE hBaseKey, /* base key */
831
+ CK_ATTRIBUTE_PTR pTemplate, /* new key template */
832
+ CK_ULONG ulAttributeCount, /* template length */
833
+ CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
834
+ );
835
+ #endif
836
+
837
+
838
+
839
+ /* Random number generation */
840
+
841
+ /* C_SeedRandom mixes additional seed material into the token's
842
+ * random number generator. */
843
+ CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
844
+ #ifdef CK_NEED_ARG_LIST
845
+ (
846
+ CK_SESSION_HANDLE hSession, /* the session's handle */
847
+ CK_BYTE_PTR pSeed, /* the seed material */
848
+ CK_ULONG ulSeedLen /* length of seed material */
849
+ );
850
+ #endif
851
+
852
+
853
+ /* C_GenerateRandom generates random data. */
854
+ CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
855
+ #ifdef CK_NEED_ARG_LIST
856
+ (
857
+ CK_SESSION_HANDLE hSession, /* the session's handle */
858
+ CK_BYTE_PTR RandomData, /* receives the random data */
859
+ CK_ULONG ulRandomLen /* # of bytes to generate */
860
+ );
861
+ #endif
862
+
863
+
864
+
865
+ /* Parallel function management */
866
+
867
+ /* C_GetFunctionStatus is a legacy function; it obtains an
868
+ * updated status of a function running in parallel with an
869
+ * application. */
870
+ CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
871
+ #ifdef CK_NEED_ARG_LIST
872
+ (
873
+ CK_SESSION_HANDLE hSession /* the session's handle */
874
+ );
875
+ #endif
876
+
877
+
878
+ /* C_CancelFunction is a legacy function; it cancels a function
879
+ * running in parallel. */
880
+ CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
881
+ #ifdef CK_NEED_ARG_LIST
882
+ (
883
+ CK_SESSION_HANDLE hSession /* the session's handle */
884
+ );
885
+ #endif
886
+
887
+
888
+
889
+ /* Functions added in for Cryptoki Version 2.01 or later */
890
+
891
+ /* C_WaitForSlotEvent waits for a slot event (token insertion,
892
+ * removal, etc.) to occur. */
893
+ CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
894
+ #ifdef CK_NEED_ARG_LIST
895
+ (
896
+ CK_FLAGS flags, /* blocking/nonblocking flag */
897
+ CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
898
+ CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */
899
+ );
900
+ #endif