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