1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 * Copyright (C) 1994-1999 RSA Security Inc. Licence to copy this document
6 * is granted provided that it is identified as "RSA Security In.c Public-Key
7 * Cryptography Standards (PKCS)" in all material mentioning or referencing
10 /* This function contains pretty much everything about all the */
11 /* PKCS #11 function prototypes. Because this information is */
12 /* used for more than just declaring function prototypes, the */
13 /* order of the functions appearing herein is important, and */
14 /* should not be altered. */
18 /* C_Initialize initializes the PKCS #11 library. */
19 CK_PKCS11_FUNCTION_INFO(C_Initialize)
20 #ifdef CK_NEED_ARG_LIST
22 CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets
23 * cast to CK_C_INITIALIZE_ARGS_PTR
28 /* C_Finalize indicates that an application is done with the
29 * PKCS #11 library. */
30 CK_PKCS11_FUNCTION_INFO(C_Finalize)
31 #ifdef CK_NEED_ARG_LIST
33 CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */
37 /* C_GetInfo returns general information about PKCS #11. */
38 CK_PKCS11_FUNCTION_INFO(C_GetInfo)
39 #ifdef CK_NEED_ARG_LIST
41 CK_INFO_PTR pInfo /* location that receives information */
45 /* C_GetFunctionList returns the function list. */
46 CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
47 #ifdef CK_NEED_ARG_LIST
49 CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to
54 /* Slot and token management */
56 /* C_GetSlotList obtains a list of slots in the system. */
57 CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
58 #ifdef CK_NEED_ARG_LIST
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 */
66 /* C_GetSlotInfo obtains information about a particular slot in
68 CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
69 #ifdef CK_NEED_ARG_LIST
71 CK_SLOT_ID slotID, /* the ID of the slot */
72 CK_SLOT_INFO_PTR pInfo /* receives the slot information */
76 /* C_GetTokenInfo obtains information about a particular token
78 CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
79 #ifdef CK_NEED_ARG_LIST
81 CK_SLOT_ID slotID, /* ID of the token's slot */
82 CK_TOKEN_INFO_PTR pInfo /* receives the token information */
86 /* C_GetMechanismList obtains a list of mechanism types
87 * supported by a token. */
88 CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
89 #ifdef CK_NEED_ARG_LIST
91 CK_SLOT_ID slotID, /* ID of token's slot */
92 CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */
93 CK_ULONG_PTR pulCount /* gets # of mechs. */
97 /* C_GetMechanismInfo obtains information about a particular
98 * mechanism possibly supported by a token. */
99 CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
100 #ifdef CK_NEED_ARG_LIST
102 CK_SLOT_ID slotID, /* ID of the token's slot */
103 CK_MECHANISM_TYPE type, /* type of mechanism */
104 CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */
108 /* C_InitToken initializes a token. */
109 CK_PKCS11_FUNCTION_INFO(C_InitToken)
110 #ifdef CK_NEED_ARG_LIST
111 /* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
113 CK_SLOT_ID slotID, /* ID of the token's slot */
114 CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */
115 CK_ULONG ulPinLen, /* length in bytes of the PIN */
116 CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */
120 /* C_InitPIN initializes the normal user's PIN. */
121 CK_PKCS11_FUNCTION_INFO(C_InitPIN)
122 #ifdef CK_NEED_ARG_LIST
124 CK_SESSION_HANDLE hSession, /* the session's handle */
125 CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */
126 CK_ULONG ulPinLen /* length in bytes of the PIN */
130 /* C_SetPIN modifies the PIN of the user who is logged in. */
131 CK_PKCS11_FUNCTION_INFO(C_SetPIN)
132 #ifdef CK_NEED_ARG_LIST
134 CK_SESSION_HANDLE hSession, /* the session's handle */
135 CK_UTF8CHAR_PTR pOldPin, /* the old PIN */
136 CK_ULONG ulOldLen, /* length of the old PIN */
137 CK_UTF8CHAR_PTR pNewPin, /* the new PIN */
138 CK_ULONG ulNewLen /* length of the new PIN */
142 /* Session management */
144 /* C_OpenSession opens a session between an application and a
146 CK_PKCS11_FUNCTION_INFO(C_OpenSession)
147 #ifdef CK_NEED_ARG_LIST
149 CK_SLOT_ID slotID, /* the slot's ID */
150 CK_FLAGS flags, /* from CK_SESSION_INFO */
151 CK_VOID_PTR pApplication, /* passed to callback */
152 CK_NOTIFY Notify, /* callback function */
153 CK_SESSION_HANDLE_PTR phSession /* gets session handle */
157 /* C_CloseSession closes a session between an application and a
159 CK_PKCS11_FUNCTION_INFO(C_CloseSession)
160 #ifdef CK_NEED_ARG_LIST
162 CK_SESSION_HANDLE hSession /* the session's handle */
166 /* C_CloseAllSessions closes all sessions with a token. */
167 CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
168 #ifdef CK_NEED_ARG_LIST
170 CK_SLOT_ID slotID /* the token's slot */
174 /* C_GetSessionInfo obtains information about the session. */
175 CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
176 #ifdef CK_NEED_ARG_LIST
178 CK_SESSION_HANDLE hSession, /* the session's handle */
179 CK_SESSION_INFO_PTR pInfo /* receives session info */
183 /* C_GetOperationState obtains the state of the cryptographic operation
185 CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
186 #ifdef CK_NEED_ARG_LIST
188 CK_SESSION_HANDLE hSession, /* session's handle */
189 CK_BYTE_PTR pOperationState, /* gets state */
190 CK_ULONG_PTR pulOperationStateLen /* gets state length */
194 /* C_SetOperationState restores the state of the cryptographic
195 * operation in a session. */
196 CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
197 #ifdef CK_NEED_ARG_LIST
199 CK_SESSION_HANDLE hSession, /* session's handle */
200 CK_BYTE_PTR pOperationState, /* holds state */
201 CK_ULONG ulOperationStateLen, /* holds state length */
202 CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */
203 CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */
207 /* C_Login logs a user into a token. */
208 CK_PKCS11_FUNCTION_INFO(C_Login)
209 #ifdef CK_NEED_ARG_LIST
211 CK_SESSION_HANDLE hSession, /* the session's handle */
212 CK_USER_TYPE userType, /* the user type */
213 CK_UTF8CHAR_PTR pPin, /* the user's PIN */
214 CK_ULONG ulPinLen /* the length of the PIN */
218 /* C_Logout logs a user out from a token. */
219 CK_PKCS11_FUNCTION_INFO(C_Logout)
220 #ifdef CK_NEED_ARG_LIST
222 CK_SESSION_HANDLE hSession /* the session's handle */
226 /* Object management */
228 /* C_CreateObject creates a new object. */
229 CK_PKCS11_FUNCTION_INFO(C_CreateObject)
230 #ifdef CK_NEED_ARG_LIST
232 CK_SESSION_HANDLE hSession, /* the session's handle */
233 CK_ATTRIBUTE_PTR pTemplate, /* the object's template */
234 CK_ULONG ulCount, /* attributes in template */
235 CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */
239 /* C_CopyObject copies an object, creating a new object for the
241 CK_PKCS11_FUNCTION_INFO(C_CopyObject)
242 #ifdef CK_NEED_ARG_LIST
244 CK_SESSION_HANDLE hSession, /* the session's handle */
245 CK_OBJECT_HANDLE hObject, /* the object's handle */
246 CK_ATTRIBUTE_PTR pTemplate, /* template for new object */
247 CK_ULONG ulCount, /* attributes in template */
248 CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */
252 /* C_DestroyObject destroys an object. */
253 CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
254 #ifdef CK_NEED_ARG_LIST
256 CK_SESSION_HANDLE hSession, /* the session's handle */
257 CK_OBJECT_HANDLE hObject /* the object's handle */
261 /* C_GetObjectSize gets the size of an object in bytes. */
262 CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
263 #ifdef CK_NEED_ARG_LIST
265 CK_SESSION_HANDLE hSession, /* the session's handle */
266 CK_OBJECT_HANDLE hObject, /* the object's handle */
267 CK_ULONG_PTR pulSize /* receives size of object */
271 /* C_GetAttributeValue obtains the value of one or more object
273 CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
274 #ifdef CK_NEED_ARG_LIST
276 CK_SESSION_HANDLE hSession, /* the session's handle */
277 CK_OBJECT_HANDLE hObject, /* the object's handle */
278 CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */
279 CK_ULONG ulCount /* attributes in template */
283 /* C_SetAttributeValue modifies the value of one or more object
285 CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
286 #ifdef CK_NEED_ARG_LIST
288 CK_SESSION_HANDLE hSession, /* the session's handle */
289 CK_OBJECT_HANDLE hObject, /* the object's handle */
290 CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */
291 CK_ULONG ulCount /* attributes in template */
295 /* C_FindObjectsInit initializes a search for token and session
296 * objects that match a template. */
297 CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
298 #ifdef CK_NEED_ARG_LIST
300 CK_SESSION_HANDLE hSession, /* the session's handle */
301 CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */
302 CK_ULONG ulCount /* attrs in search template */
306 /* C_FindObjects continues a search for token and session
307 * objects that match a template, obtaining additional object
309 CK_PKCS11_FUNCTION_INFO(C_FindObjects)
310 #ifdef CK_NEED_ARG_LIST
312 CK_SESSION_HANDLE hSession, /* session's handle */
313 CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */
314 CK_ULONG ulMaxObjectCount, /* max handles to get */
315 CK_ULONG_PTR pulObjectCount /* actual # returned */
319 /* C_FindObjectsFinal finishes a search for token and session
321 CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
322 #ifdef CK_NEED_ARG_LIST
324 CK_SESSION_HANDLE hSession /* the session's handle */
328 /* Encryption and decryption */
330 /* C_EncryptInit initializes an encryption operation. */
331 CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
332 #ifdef CK_NEED_ARG_LIST
334 CK_SESSION_HANDLE hSession, /* the session's handle */
335 CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
336 CK_OBJECT_HANDLE hKey /* handle of encryption key */
340 /* C_Encrypt encrypts single-part data. */
341 CK_PKCS11_FUNCTION_INFO(C_Encrypt)
342 #ifdef CK_NEED_ARG_LIST
344 CK_SESSION_HANDLE hSession, /* session's handle */
345 CK_BYTE_PTR pData, /* the plaintext data */
346 CK_ULONG ulDataLen, /* bytes of plaintext */
347 CK_BYTE_PTR pEncryptedData, /* gets ciphertext */
348 CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */
352 /* C_EncryptUpdate continues a multiple-part encryption
354 CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
355 #ifdef CK_NEED_ARG_LIST
357 CK_SESSION_HANDLE hSession, /* session's handle */
358 CK_BYTE_PTR pPart, /* the plaintext data */
359 CK_ULONG ulPartLen, /* plaintext data len */
360 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
361 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */
365 /* C_EncryptFinal finishes a multiple-part encryption
367 CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
368 #ifdef CK_NEED_ARG_LIST
370 CK_SESSION_HANDLE hSession, /* session handle */
371 CK_BYTE_PTR pLastEncryptedPart, /* last c-text */
372 CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */
376 /* C_DecryptInit initializes a decryption operation. */
377 CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
378 #ifdef CK_NEED_ARG_LIST
380 CK_SESSION_HANDLE hSession, /* the session's handle */
381 CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
382 CK_OBJECT_HANDLE hKey /* handle of decryption key */
386 /* C_Decrypt decrypts encrypted data in a single part. */
387 CK_PKCS11_FUNCTION_INFO(C_Decrypt)
388 #ifdef CK_NEED_ARG_LIST
390 CK_SESSION_HANDLE hSession, /* session's handle */
391 CK_BYTE_PTR pEncryptedData, /* ciphertext */
392 CK_ULONG ulEncryptedDataLen, /* ciphertext length */
393 CK_BYTE_PTR pData, /* gets plaintext */
394 CK_ULONG_PTR pulDataLen /* gets p-text size */
398 /* C_DecryptUpdate continues a multiple-part decryption
400 CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
401 #ifdef CK_NEED_ARG_LIST
403 CK_SESSION_HANDLE hSession, /* session's handle */
404 CK_BYTE_PTR pEncryptedPart, /* encrypted data */
405 CK_ULONG ulEncryptedPartLen, /* input length */
406 CK_BYTE_PTR pPart, /* gets plaintext */
407 CK_ULONG_PTR pulPartLen /* p-text size */
411 /* C_DecryptFinal finishes a multiple-part decryption
413 CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
414 #ifdef CK_NEED_ARG_LIST
416 CK_SESSION_HANDLE hSession, /* the session's handle */
417 CK_BYTE_PTR pLastPart, /* gets plaintext */
418 CK_ULONG_PTR pulLastPartLen /* p-text size */
422 /* Message digesting */
424 /* C_DigestInit initializes a message-digesting operation. */
425 CK_PKCS11_FUNCTION_INFO(C_DigestInit)
426 #ifdef CK_NEED_ARG_LIST
428 CK_SESSION_HANDLE hSession, /* the session's handle */
429 CK_MECHANISM_PTR pMechanism /* the digesting mechanism */
433 /* C_Digest digests data in a single part. */
434 CK_PKCS11_FUNCTION_INFO(C_Digest)
435 #ifdef CK_NEED_ARG_LIST
437 CK_SESSION_HANDLE hSession, /* the session's handle */
438 CK_BYTE_PTR pData, /* data to be digested */
439 CK_ULONG ulDataLen, /* bytes of data to digest */
440 CK_BYTE_PTR pDigest, /* gets the message digest */
441 CK_ULONG_PTR pulDigestLen /* gets digest length */
445 /* C_DigestUpdate continues a multiple-part message-digesting
447 CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
448 #ifdef CK_NEED_ARG_LIST
450 CK_SESSION_HANDLE hSession, /* the session's handle */
451 CK_BYTE_PTR pPart, /* data to be digested */
452 CK_ULONG ulPartLen /* bytes of data to be digested */
456 /* C_DigestKey continues a multi-part message-digesting
457 * operation, by digesting the value of a secret key as part of
458 * the data already digested. */
459 CK_PKCS11_FUNCTION_INFO(C_DigestKey)
460 #ifdef CK_NEED_ARG_LIST
462 CK_SESSION_HANDLE hSession, /* the session's handle */
463 CK_OBJECT_HANDLE hKey /* secret key to digest */
467 /* C_DigestFinal finishes a multiple-part message-digesting
469 CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
470 #ifdef CK_NEED_ARG_LIST
472 CK_SESSION_HANDLE hSession, /* the session's handle */
473 CK_BYTE_PTR pDigest, /* gets the message digest */
474 CK_ULONG_PTR pulDigestLen /* gets byte count of digest */
478 /* Signing and MACing */
480 /* C_SignInit initializes a signature (private key encryption)
481 * operation, where the signature is (will be) an appendix to
482 * the data, and plaintext cannot be recovered from the
484 CK_PKCS11_FUNCTION_INFO(C_SignInit)
485 #ifdef CK_NEED_ARG_LIST
487 CK_SESSION_HANDLE hSession, /* the session's handle */
488 CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
489 CK_OBJECT_HANDLE hKey /* handle of signature key */
493 /* C_Sign signs (encrypts with private key) data in a single
494 * part, where the signature is (will be) an appendix to the
495 * data, and plaintext cannot be recovered from the signature. */
496 CK_PKCS11_FUNCTION_INFO(C_Sign)
497 #ifdef CK_NEED_ARG_LIST
499 CK_SESSION_HANDLE hSession, /* the session's handle */
500 CK_BYTE_PTR pData, /* the data to sign */
501 CK_ULONG ulDataLen, /* count of bytes to sign */
502 CK_BYTE_PTR pSignature, /* gets the signature */
503 CK_ULONG_PTR pulSignatureLen /* gets signature length */
507 /* C_SignUpdate continues a multiple-part signature operation,
508 * where the signature is (will be) an appendix to the data,
509 * and plaintext cannot be recovered from the signature. */
510 CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
511 #ifdef CK_NEED_ARG_LIST
513 CK_SESSION_HANDLE hSession, /* the session's handle */
514 CK_BYTE_PTR pPart, /* the data to sign */
515 CK_ULONG ulPartLen /* count of bytes to sign */
519 /* C_SignFinal finishes a multiple-part signature operation,
520 * returning the signature. */
521 CK_PKCS11_FUNCTION_INFO(C_SignFinal)
522 #ifdef CK_NEED_ARG_LIST
524 CK_SESSION_HANDLE hSession, /* the session's handle */
525 CK_BYTE_PTR pSignature, /* gets the signature */
526 CK_ULONG_PTR pulSignatureLen /* gets signature length */
530 /* C_SignRecoverInit initializes a signature operation, where
531 * the data can be recovered from the signature. */
532 CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
533 #ifdef CK_NEED_ARG_LIST
535 CK_SESSION_HANDLE hSession, /* the session's handle */
536 CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
537 CK_OBJECT_HANDLE hKey /* handle of the signature key */
541 /* C_SignRecover signs data in a single operation, where the
542 * data can be recovered from the signature. */
543 CK_PKCS11_FUNCTION_INFO(C_SignRecover)
544 #ifdef CK_NEED_ARG_LIST
546 CK_SESSION_HANDLE hSession, /* the session's handle */
547 CK_BYTE_PTR pData, /* the data to sign */
548 CK_ULONG ulDataLen, /* count of bytes to sign */
549 CK_BYTE_PTR pSignature, /* gets the signature */
550 CK_ULONG_PTR pulSignatureLen /* gets signature length */
554 /* Verifying signatures and MACs */
556 /* C_VerifyInit initializes a verification operation, where the
557 * signature is an appendix to the data, and plaintext cannot
558 * cannot be recovered from the signature (e.g. DSA). */
559 CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
560 #ifdef CK_NEED_ARG_LIST
562 CK_SESSION_HANDLE hSession, /* the session's handle */
563 CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
564 CK_OBJECT_HANDLE hKey /* verification key */
568 /* C_Verify verifies a signature in a single-part operation,
569 * where the signature is an appendix to the data, and plaintext
570 * cannot be recovered from the signature. */
571 CK_PKCS11_FUNCTION_INFO(C_Verify)
572 #ifdef CK_NEED_ARG_LIST
574 CK_SESSION_HANDLE hSession, /* the session's handle */
575 CK_BYTE_PTR pData, /* signed data */
576 CK_ULONG ulDataLen, /* length of signed data */
577 CK_BYTE_PTR pSignature, /* signature */
578 CK_ULONG ulSignatureLen /* signature length*/
582 /* C_VerifyUpdate continues a multiple-part verification
583 * operation, where the signature is an appendix to the data,
584 * and plaintext cannot be recovered from the signature. */
585 CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
586 #ifdef CK_NEED_ARG_LIST
588 CK_SESSION_HANDLE hSession, /* the session's handle */
589 CK_BYTE_PTR pPart, /* signed data */
590 CK_ULONG ulPartLen /* length of signed data */
594 /* C_VerifyFinal finishes a multiple-part verification
595 * operation, checking the signature. */
596 CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
597 #ifdef CK_NEED_ARG_LIST
599 CK_SESSION_HANDLE hSession, /* the session's handle */
600 CK_BYTE_PTR pSignature, /* signature to verify */
601 CK_ULONG ulSignatureLen /* signature length */
605 /* C_VerifyRecoverInit initializes a signature verification
606 * operation, where the data is recovered from the signature. */
607 CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
608 #ifdef CK_NEED_ARG_LIST
610 CK_SESSION_HANDLE hSession, /* the session's handle */
611 CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
612 CK_OBJECT_HANDLE hKey /* verification key */
616 /* C_VerifyRecover verifies a signature in a single-part
617 * operation, where the data is recovered from the signature. */
618 CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
619 #ifdef CK_NEED_ARG_LIST
621 CK_SESSION_HANDLE hSession, /* the session's handle */
622 CK_BYTE_PTR pSignature, /* signature to verify */
623 CK_ULONG ulSignatureLen, /* signature length */
624 CK_BYTE_PTR pData, /* gets signed data */
625 CK_ULONG_PTR pulDataLen /* gets signed data len */
629 /* Dual-function cryptographic operations */
631 /* C_DigestEncryptUpdate continues a multiple-part digesting
632 * and encryption operation. */
633 CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
634 #ifdef CK_NEED_ARG_LIST
636 CK_SESSION_HANDLE hSession, /* session's handle */
637 CK_BYTE_PTR pPart, /* the plaintext data */
638 CK_ULONG ulPartLen, /* plaintext length */
639 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
640 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
644 /* C_DecryptDigestUpdate continues a multiple-part decryption and
645 * digesting operation. */
646 CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
647 #ifdef CK_NEED_ARG_LIST
649 CK_SESSION_HANDLE hSession, /* session's handle */
650 CK_BYTE_PTR pEncryptedPart, /* ciphertext */
651 CK_ULONG ulEncryptedPartLen, /* ciphertext length */
652 CK_BYTE_PTR pPart, /* gets plaintext */
653 CK_ULONG_PTR pulPartLen /* gets plaintext len */
657 /* C_SignEncryptUpdate continues a multiple-part signing and
658 * encryption operation. */
659 CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
660 #ifdef CK_NEED_ARG_LIST
662 CK_SESSION_HANDLE hSession, /* session's handle */
663 CK_BYTE_PTR pPart, /* the plaintext data */
664 CK_ULONG ulPartLen, /* plaintext length */
665 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
666 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
670 /* C_DecryptVerifyUpdate continues a multiple-part decryption and
671 * verify operation. */
672 CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
673 #ifdef CK_NEED_ARG_LIST
675 CK_SESSION_HANDLE hSession, /* session's handle */
676 CK_BYTE_PTR pEncryptedPart, /* ciphertext */
677 CK_ULONG ulEncryptedPartLen, /* ciphertext length */
678 CK_BYTE_PTR pPart, /* gets plaintext */
679 CK_ULONG_PTR pulPartLen /* gets p-text length */
685 /* C_GenerateKey generates a secret key, creating a new key
687 CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
688 #ifdef CK_NEED_ARG_LIST
690 CK_SESSION_HANDLE hSession, /* the session's handle */
691 CK_MECHANISM_PTR pMechanism, /* key generation mech. */
692 CK_ATTRIBUTE_PTR pTemplate, /* template for new key */
693 CK_ULONG ulCount, /* # of attrs in template */
694 CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */
698 /* C_GenerateKeyPair generates a public-key/private-key pair,
699 * creating new key objects. */
700 CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
701 #ifdef CK_NEED_ARG_LIST
703 CK_SESSION_HANDLE hSession, /* session handle */
704 CK_MECHANISM_PTR pMechanism, /* key-gen mech. */
705 CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template for pub. key */
706 CK_ULONG ulPublicKeyAttributeCount, /* # pub. attrs. */
707 CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template for priv. key */
708 CK_ULONG ulPrivateKeyAttributeCount, /* # priv. attrs. */
709 CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. key handle */
710 CK_OBJECT_HANDLE_PTR phPrivateKey /* gets priv. key handle */
714 /* C_WrapKey wraps (i.e., encrypts) a key. */
715 CK_PKCS11_FUNCTION_INFO(C_WrapKey)
716 #ifdef CK_NEED_ARG_LIST
718 CK_SESSION_HANDLE hSession, /* the session's handle */
719 CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */
720 CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */
721 CK_OBJECT_HANDLE hKey, /* key to be wrapped */
722 CK_BYTE_PTR pWrappedKey, /* gets wrapped key */
723 CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */
727 /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
729 CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
730 #ifdef CK_NEED_ARG_LIST
732 CK_SESSION_HANDLE hSession, /* session's handle */
733 CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */
734 CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */
735 CK_BYTE_PTR pWrappedKey, /* the wrapped key */
736 CK_ULONG ulWrappedKeyLen, /* wrapped key len */
737 CK_ATTRIBUTE_PTR pTemplate, /* new key template */
738 CK_ULONG ulAttributeCount, /* template length */
739 CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
743 /* C_DeriveKey derives a key from a base key, creating a new key
745 CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
746 #ifdef CK_NEED_ARG_LIST
748 CK_SESSION_HANDLE hSession, /* session's handle */
749 CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */
750 CK_OBJECT_HANDLE hBaseKey, /* base key */
751 CK_ATTRIBUTE_PTR pTemplate, /* new key template */
752 CK_ULONG ulAttributeCount, /* template length */
753 CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
757 /* Random number generation */
759 /* C_SeedRandom mixes additional seed material into the token's
760 * random number generator. */
761 CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
762 #ifdef CK_NEED_ARG_LIST
764 CK_SESSION_HANDLE hSession, /* the session's handle */
765 CK_BYTE_PTR pSeed, /* the seed material */
766 CK_ULONG ulSeedLen /* length of seed material */
770 /* C_GenerateRandom generates random data. */
771 CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
772 #ifdef CK_NEED_ARG_LIST
774 CK_SESSION_HANDLE hSession, /* the session's handle */
775 CK_BYTE_PTR RandomData, /* receives the random data */
776 CK_ULONG ulRandomLen /* # of bytes to generate */
780 /* Parallel function management */
782 /* C_GetFunctionStatus is a legacy function; it obtains an
783 * updated status of a function running in parallel with an
785 CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
786 #ifdef CK_NEED_ARG_LIST
788 CK_SESSION_HANDLE hSession /* the session's handle */
792 /* C_CancelFunction is a legacy function; it cancels a function
793 * running in parallel. */
794 CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
795 #ifdef CK_NEED_ARG_LIST
797 CK_SESSION_HANDLE hSession /* the session's handle */
801 /* Functions added in for PKCS #11 Version 2.01 or later */
803 /* C_WaitForSlotEvent waits for a slot event (token insertion,
804 * removal, etc.) to occur. */
805 CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
806 #ifdef CK_NEED_ARG_LIST
808 CK_FLAGS flags, /* blocking/nonblocking flag */
809 CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
810 CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */