1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
37 * Copyright (C) 1994-1999 RSA Security Inc. Licence to copy this document
38 * is granted provided that it is identified as "RSA Security In.c Public-Key
39 * Cryptography Standards (PKCS)" in all material mentioning or referencing
42 /* This function contains pretty much everything about all the */
43 /* PKCS #11 function prototypes. Because this information is */
44 /* used for more than just declaring function prototypes, the */
45 /* order of the functions appearing herein is important, and */
46 /* should not be altered. */
52 /* C_Initialize initializes the PKCS #11 library. */
53 CK_PKCS11_FUNCTION_INFO(C_Initialize
)
54 #ifdef CK_NEED_ARG_LIST
56 CK_VOID_PTR pInitArgs
/* if this is not NULL_PTR, it gets
57 * cast to CK_C_INITIALIZE_ARGS_PTR
63 /* C_Finalize indicates that an application is done with the
64 * PKCS #11 library. */
65 CK_PKCS11_FUNCTION_INFO(C_Finalize
)
66 #ifdef CK_NEED_ARG_LIST
68 CK_VOID_PTR pReserved
/* reserved. Should be NULL_PTR */
73 /* C_GetInfo returns general information about PKCS #11. */
74 CK_PKCS11_FUNCTION_INFO(C_GetInfo
)
75 #ifdef CK_NEED_ARG_LIST
77 CK_INFO_PTR pInfo
/* location that receives information */
82 /* C_GetFunctionList returns the function list. */
83 CK_PKCS11_FUNCTION_INFO(C_GetFunctionList
)
84 #ifdef CK_NEED_ARG_LIST
86 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
/* receives pointer to
93 /* Slot and token management */
95 /* C_GetSlotList obtains a list of slots in the system. */
96 CK_PKCS11_FUNCTION_INFO(C_GetSlotList
)
97 #ifdef CK_NEED_ARG_LIST
99 CK_BBOOL tokenPresent
, /* only slots with tokens? */
100 CK_SLOT_ID_PTR pSlotList
, /* receives array of slot IDs */
101 CK_ULONG_PTR pulCount
/* receives number of slots */
106 /* C_GetSlotInfo obtains information about a particular slot in
108 CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo
)
109 #ifdef CK_NEED_ARG_LIST
111 CK_SLOT_ID slotID
, /* the ID of the slot */
112 CK_SLOT_INFO_PTR pInfo
/* receives the slot information */
117 /* C_GetTokenInfo obtains information about a particular token
119 CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo
)
120 #ifdef CK_NEED_ARG_LIST
122 CK_SLOT_ID slotID
, /* ID of the token's slot */
123 CK_TOKEN_INFO_PTR pInfo
/* receives the token information */
128 /* C_GetMechanismList obtains a list of mechanism types
129 * supported by a token. */
130 CK_PKCS11_FUNCTION_INFO(C_GetMechanismList
)
131 #ifdef CK_NEED_ARG_LIST
133 CK_SLOT_ID slotID
, /* ID of token's slot */
134 CK_MECHANISM_TYPE_PTR pMechanismList
, /* gets mech. array */
135 CK_ULONG_PTR pulCount
/* gets # of mechs. */
140 /* C_GetMechanismInfo obtains information about a particular
141 * mechanism possibly supported by a token. */
142 CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo
)
143 #ifdef CK_NEED_ARG_LIST
145 CK_SLOT_ID slotID
, /* ID of the token's slot */
146 CK_MECHANISM_TYPE type
, /* type of mechanism */
147 CK_MECHANISM_INFO_PTR pInfo
/* receives mechanism info */
152 /* C_InitToken initializes a token. */
153 CK_PKCS11_FUNCTION_INFO(C_InitToken
)
154 #ifdef CK_NEED_ARG_LIST
155 /* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
157 CK_SLOT_ID slotID
, /* ID of the token's slot */
158 CK_UTF8CHAR_PTR pPin
, /* the SO's initial PIN */
159 CK_ULONG ulPinLen
, /* length in bytes of the PIN */
160 CK_UTF8CHAR_PTR pLabel
/* 32-byte token label (blank padded) */
165 /* C_InitPIN initializes the normal user's PIN. */
166 CK_PKCS11_FUNCTION_INFO(C_InitPIN
)
167 #ifdef CK_NEED_ARG_LIST
169 CK_SESSION_HANDLE hSession
, /* the session's handle */
170 CK_UTF8CHAR_PTR pPin
, /* the normal user's PIN */
171 CK_ULONG ulPinLen
/* length in bytes of the PIN */
176 /* C_SetPIN modifies the PIN of the user who is logged in. */
177 CK_PKCS11_FUNCTION_INFO(C_SetPIN
)
178 #ifdef CK_NEED_ARG_LIST
180 CK_SESSION_HANDLE hSession
, /* the session's handle */
181 CK_UTF8CHAR_PTR pOldPin
, /* the old PIN */
182 CK_ULONG ulOldLen
, /* length of the old PIN */
183 CK_UTF8CHAR_PTR pNewPin
, /* the new PIN */
184 CK_ULONG ulNewLen
/* length of the new PIN */
190 /* Session management */
192 /* C_OpenSession opens a session between an application and a
194 CK_PKCS11_FUNCTION_INFO(C_OpenSession
)
195 #ifdef CK_NEED_ARG_LIST
197 CK_SLOT_ID slotID
, /* the slot's ID */
198 CK_FLAGS flags
, /* from CK_SESSION_INFO */
199 CK_VOID_PTR pApplication
, /* passed to callback */
200 CK_NOTIFY Notify
, /* callback function */
201 CK_SESSION_HANDLE_PTR phSession
/* gets session handle */
206 /* C_CloseSession closes a session between an application and a
208 CK_PKCS11_FUNCTION_INFO(C_CloseSession
)
209 #ifdef CK_NEED_ARG_LIST
211 CK_SESSION_HANDLE hSession
/* the session's handle */
216 /* C_CloseAllSessions closes all sessions with a token. */
217 CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions
)
218 #ifdef CK_NEED_ARG_LIST
220 CK_SLOT_ID slotID
/* the token's slot */
225 /* C_GetSessionInfo obtains information about the session. */
226 CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo
)
227 #ifdef CK_NEED_ARG_LIST
229 CK_SESSION_HANDLE hSession
, /* the session's handle */
230 CK_SESSION_INFO_PTR pInfo
/* receives session info */
235 /* C_GetOperationState obtains the state of the cryptographic operation
237 CK_PKCS11_FUNCTION_INFO(C_GetOperationState
)
238 #ifdef CK_NEED_ARG_LIST
240 CK_SESSION_HANDLE hSession
, /* session's handle */
241 CK_BYTE_PTR pOperationState
, /* gets state */
242 CK_ULONG_PTR pulOperationStateLen
/* gets state length */
247 /* C_SetOperationState restores the state of the cryptographic
248 * operation in a session. */
249 CK_PKCS11_FUNCTION_INFO(C_SetOperationState
)
250 #ifdef CK_NEED_ARG_LIST
252 CK_SESSION_HANDLE hSession
, /* session's handle */
253 CK_BYTE_PTR pOperationState
, /* holds state */
254 CK_ULONG ulOperationStateLen
, /* holds state length */
255 CK_OBJECT_HANDLE hEncryptionKey
, /* en/decryption key */
256 CK_OBJECT_HANDLE hAuthenticationKey
/* sign/verify key */
261 /* C_Login logs a user into a token. */
262 CK_PKCS11_FUNCTION_INFO(C_Login
)
263 #ifdef CK_NEED_ARG_LIST
265 CK_SESSION_HANDLE hSession
, /* the session's handle */
266 CK_USER_TYPE userType
, /* the user type */
267 CK_UTF8CHAR_PTR pPin
, /* the user's PIN */
268 CK_ULONG ulPinLen
/* the length of the PIN */
273 /* C_Logout logs a user out from a token. */
274 CK_PKCS11_FUNCTION_INFO(C_Logout
)
275 #ifdef CK_NEED_ARG_LIST
277 CK_SESSION_HANDLE hSession
/* the session's handle */
283 /* Object management */
285 /* C_CreateObject creates a new object. */
286 CK_PKCS11_FUNCTION_INFO(C_CreateObject
)
287 #ifdef CK_NEED_ARG_LIST
289 CK_SESSION_HANDLE hSession
, /* the session's handle */
290 CK_ATTRIBUTE_PTR pTemplate
, /* the object's template */
291 CK_ULONG ulCount
, /* attributes in template */
292 CK_OBJECT_HANDLE_PTR phObject
/* gets new object's handle. */
297 /* C_CopyObject copies an object, creating a new object for the
299 CK_PKCS11_FUNCTION_INFO(C_CopyObject
)
300 #ifdef CK_NEED_ARG_LIST
302 CK_SESSION_HANDLE hSession
, /* the session's handle */
303 CK_OBJECT_HANDLE hObject
, /* the object's handle */
304 CK_ATTRIBUTE_PTR pTemplate
, /* template for new object */
305 CK_ULONG ulCount
, /* attributes in template */
306 CK_OBJECT_HANDLE_PTR phNewObject
/* receives handle of copy */
311 /* C_DestroyObject destroys an object. */
312 CK_PKCS11_FUNCTION_INFO(C_DestroyObject
)
313 #ifdef CK_NEED_ARG_LIST
315 CK_SESSION_HANDLE hSession
, /* the session's handle */
316 CK_OBJECT_HANDLE hObject
/* the object's handle */
321 /* C_GetObjectSize gets the size of an object in bytes. */
322 CK_PKCS11_FUNCTION_INFO(C_GetObjectSize
)
323 #ifdef CK_NEED_ARG_LIST
325 CK_SESSION_HANDLE hSession
, /* the session's handle */
326 CK_OBJECT_HANDLE hObject
, /* the object's handle */
327 CK_ULONG_PTR pulSize
/* receives size of object */
332 /* C_GetAttributeValue obtains the value of one or more object
334 CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue
)
335 #ifdef CK_NEED_ARG_LIST
337 CK_SESSION_HANDLE hSession
, /* the session's handle */
338 CK_OBJECT_HANDLE hObject
, /* the object's handle */
339 CK_ATTRIBUTE_PTR pTemplate
, /* specifies attrs; gets vals */
340 CK_ULONG ulCount
/* attributes in template */
345 /* C_SetAttributeValue modifies the value of one or more object
347 CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue
)
348 #ifdef CK_NEED_ARG_LIST
350 CK_SESSION_HANDLE hSession
, /* the session's handle */
351 CK_OBJECT_HANDLE hObject
, /* the object's handle */
352 CK_ATTRIBUTE_PTR pTemplate
, /* specifies attrs and values */
353 CK_ULONG ulCount
/* attributes in template */
358 /* C_FindObjectsInit initializes a search for token and session
359 * objects that match a template. */
360 CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit
)
361 #ifdef CK_NEED_ARG_LIST
363 CK_SESSION_HANDLE hSession
, /* the session's handle */
364 CK_ATTRIBUTE_PTR pTemplate
, /* attribute values to match */
365 CK_ULONG ulCount
/* attrs in search template */
370 /* C_FindObjects continues a search for token and session
371 * objects that match a template, obtaining additional object
373 CK_PKCS11_FUNCTION_INFO(C_FindObjects
)
374 #ifdef CK_NEED_ARG_LIST
376 CK_SESSION_HANDLE hSession
, /* session's handle */
377 CK_OBJECT_HANDLE_PTR phObject
, /* gets obj. handles */
378 CK_ULONG ulMaxObjectCount
, /* max handles to get */
379 CK_ULONG_PTR pulObjectCount
/* actual # returned */
384 /* C_FindObjectsFinal finishes a search for token and session
386 CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal
)
387 #ifdef CK_NEED_ARG_LIST
389 CK_SESSION_HANDLE hSession
/* the session's handle */
395 /* Encryption and decryption */
397 /* C_EncryptInit initializes an encryption operation. */
398 CK_PKCS11_FUNCTION_INFO(C_EncryptInit
)
399 #ifdef CK_NEED_ARG_LIST
401 CK_SESSION_HANDLE hSession
, /* the session's handle */
402 CK_MECHANISM_PTR pMechanism
, /* the encryption mechanism */
403 CK_OBJECT_HANDLE hKey
/* handle of encryption key */
408 /* C_Encrypt encrypts single-part data. */
409 CK_PKCS11_FUNCTION_INFO(C_Encrypt
)
410 #ifdef CK_NEED_ARG_LIST
412 CK_SESSION_HANDLE hSession
, /* session's handle */
413 CK_BYTE_PTR pData
, /* the plaintext data */
414 CK_ULONG ulDataLen
, /* bytes of plaintext */
415 CK_BYTE_PTR pEncryptedData
, /* gets ciphertext */
416 CK_ULONG_PTR pulEncryptedDataLen
/* gets c-text size */
421 /* C_EncryptUpdate continues a multiple-part encryption
423 CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate
)
424 #ifdef CK_NEED_ARG_LIST
426 CK_SESSION_HANDLE hSession
, /* session's handle */
427 CK_BYTE_PTR pPart
, /* the plaintext data */
428 CK_ULONG ulPartLen
, /* plaintext data len */
429 CK_BYTE_PTR pEncryptedPart
, /* gets ciphertext */
430 CK_ULONG_PTR pulEncryptedPartLen
/* gets c-text size */
435 /* C_EncryptFinal finishes a multiple-part encryption
437 CK_PKCS11_FUNCTION_INFO(C_EncryptFinal
)
438 #ifdef CK_NEED_ARG_LIST
440 CK_SESSION_HANDLE hSession
, /* session handle */
441 CK_BYTE_PTR pLastEncryptedPart
, /* last c-text */
442 CK_ULONG_PTR pulLastEncryptedPartLen
/* gets last size */
447 /* C_DecryptInit initializes a decryption operation. */
448 CK_PKCS11_FUNCTION_INFO(C_DecryptInit
)
449 #ifdef CK_NEED_ARG_LIST
451 CK_SESSION_HANDLE hSession
, /* the session's handle */
452 CK_MECHANISM_PTR pMechanism
, /* the decryption mechanism */
453 CK_OBJECT_HANDLE hKey
/* handle of decryption key */
458 /* C_Decrypt decrypts encrypted data in a single part. */
459 CK_PKCS11_FUNCTION_INFO(C_Decrypt
)
460 #ifdef CK_NEED_ARG_LIST
462 CK_SESSION_HANDLE hSession
, /* session's handle */
463 CK_BYTE_PTR pEncryptedData
, /* ciphertext */
464 CK_ULONG ulEncryptedDataLen
, /* ciphertext length */
465 CK_BYTE_PTR pData
, /* gets plaintext */
466 CK_ULONG_PTR pulDataLen
/* gets p-text size */
471 /* C_DecryptUpdate continues a multiple-part decryption
473 CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate
)
474 #ifdef CK_NEED_ARG_LIST
476 CK_SESSION_HANDLE hSession
, /* session's handle */
477 CK_BYTE_PTR pEncryptedPart
, /* encrypted data */
478 CK_ULONG ulEncryptedPartLen
, /* input length */
479 CK_BYTE_PTR pPart
, /* gets plaintext */
480 CK_ULONG_PTR pulPartLen
/* p-text size */
485 /* C_DecryptFinal finishes a multiple-part decryption
487 CK_PKCS11_FUNCTION_INFO(C_DecryptFinal
)
488 #ifdef CK_NEED_ARG_LIST
490 CK_SESSION_HANDLE hSession
, /* the session's handle */
491 CK_BYTE_PTR pLastPart
, /* gets plaintext */
492 CK_ULONG_PTR pulLastPartLen
/* p-text size */
498 /* Message digesting */
500 /* C_DigestInit initializes a message-digesting operation. */
501 CK_PKCS11_FUNCTION_INFO(C_DigestInit
)
502 #ifdef CK_NEED_ARG_LIST
504 CK_SESSION_HANDLE hSession
, /* the session's handle */
505 CK_MECHANISM_PTR pMechanism
/* the digesting mechanism */
510 /* C_Digest digests data in a single part. */
511 CK_PKCS11_FUNCTION_INFO(C_Digest
)
512 #ifdef CK_NEED_ARG_LIST
514 CK_SESSION_HANDLE hSession
, /* the session's handle */
515 CK_BYTE_PTR pData
, /* data to be digested */
516 CK_ULONG ulDataLen
, /* bytes of data to digest */
517 CK_BYTE_PTR pDigest
, /* gets the message digest */
518 CK_ULONG_PTR pulDigestLen
/* gets digest length */
523 /* C_DigestUpdate continues a multiple-part message-digesting
525 CK_PKCS11_FUNCTION_INFO(C_DigestUpdate
)
526 #ifdef CK_NEED_ARG_LIST
528 CK_SESSION_HANDLE hSession
, /* the session's handle */
529 CK_BYTE_PTR pPart
, /* data to be digested */
530 CK_ULONG ulPartLen
/* bytes of data to be digested */
535 /* C_DigestKey continues a multi-part message-digesting
536 * operation, by digesting the value of a secret key as part of
537 * the data already digested. */
538 CK_PKCS11_FUNCTION_INFO(C_DigestKey
)
539 #ifdef CK_NEED_ARG_LIST
541 CK_SESSION_HANDLE hSession
, /* the session's handle */
542 CK_OBJECT_HANDLE hKey
/* secret key to digest */
547 /* C_DigestFinal finishes a multiple-part message-digesting
549 CK_PKCS11_FUNCTION_INFO(C_DigestFinal
)
550 #ifdef CK_NEED_ARG_LIST
552 CK_SESSION_HANDLE hSession
, /* the session's handle */
553 CK_BYTE_PTR pDigest
, /* gets the message digest */
554 CK_ULONG_PTR pulDigestLen
/* gets byte count of digest */
560 /* Signing and MACing */
562 /* C_SignInit initializes a signature (private key encryption)
563 * operation, where the signature is (will be) an appendix to
564 * the data, and plaintext cannot be recovered from the
566 CK_PKCS11_FUNCTION_INFO(C_SignInit
)
567 #ifdef CK_NEED_ARG_LIST
569 CK_SESSION_HANDLE hSession
, /* the session's handle */
570 CK_MECHANISM_PTR pMechanism
, /* the signature mechanism */
571 CK_OBJECT_HANDLE hKey
/* handle of signature key */
576 /* C_Sign signs (encrypts with private key) data in a single
577 * part, where the signature is (will be) an appendix to the
578 * data, and plaintext cannot be recovered from the signature. */
579 CK_PKCS11_FUNCTION_INFO(C_Sign
)
580 #ifdef CK_NEED_ARG_LIST
582 CK_SESSION_HANDLE hSession
, /* the session's handle */
583 CK_BYTE_PTR pData
, /* the data to sign */
584 CK_ULONG ulDataLen
, /* count of bytes to sign */
585 CK_BYTE_PTR pSignature
, /* gets the signature */
586 CK_ULONG_PTR pulSignatureLen
/* gets signature length */
591 /* C_SignUpdate continues a multiple-part signature operation,
592 * where the signature is (will be) an appendix to the data,
593 * and plaintext cannot be recovered from the signature. */
594 CK_PKCS11_FUNCTION_INFO(C_SignUpdate
)
595 #ifdef CK_NEED_ARG_LIST
597 CK_SESSION_HANDLE hSession
, /* the session's handle */
598 CK_BYTE_PTR pPart
, /* the data to sign */
599 CK_ULONG ulPartLen
/* count of bytes to sign */
604 /* C_SignFinal finishes a multiple-part signature operation,
605 * returning the signature. */
606 CK_PKCS11_FUNCTION_INFO(C_SignFinal
)
607 #ifdef CK_NEED_ARG_LIST
609 CK_SESSION_HANDLE hSession
, /* the session's handle */
610 CK_BYTE_PTR pSignature
, /* gets the signature */
611 CK_ULONG_PTR pulSignatureLen
/* gets signature length */
616 /* C_SignRecoverInit initializes a signature operation, where
617 * the data can be recovered from the signature. */
618 CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit
)
619 #ifdef CK_NEED_ARG_LIST
621 CK_SESSION_HANDLE hSession
, /* the session's handle */
622 CK_MECHANISM_PTR pMechanism
, /* the signature mechanism */
623 CK_OBJECT_HANDLE hKey
/* handle of the signature key */
628 /* C_SignRecover signs data in a single operation, where the
629 * data can be recovered from the signature. */
630 CK_PKCS11_FUNCTION_INFO(C_SignRecover
)
631 #ifdef CK_NEED_ARG_LIST
633 CK_SESSION_HANDLE hSession
, /* the session's handle */
634 CK_BYTE_PTR pData
, /* the data to sign */
635 CK_ULONG ulDataLen
, /* count of bytes to sign */
636 CK_BYTE_PTR pSignature
, /* gets the signature */
637 CK_ULONG_PTR pulSignatureLen
/* gets signature length */
643 /* Verifying signatures and MACs */
645 /* C_VerifyInit initializes a verification operation, where the
646 * signature is an appendix to the data, and plaintext cannot
647 * cannot be recovered from the signature (e.g. DSA). */
648 CK_PKCS11_FUNCTION_INFO(C_VerifyInit
)
649 #ifdef CK_NEED_ARG_LIST
651 CK_SESSION_HANDLE hSession
, /* the session's handle */
652 CK_MECHANISM_PTR pMechanism
, /* the verification mechanism */
653 CK_OBJECT_HANDLE hKey
/* verification key */
658 /* C_Verify verifies a signature in a single-part operation,
659 * where the signature is an appendix to the data, and plaintext
660 * cannot be recovered from the signature. */
661 CK_PKCS11_FUNCTION_INFO(C_Verify
)
662 #ifdef CK_NEED_ARG_LIST
664 CK_SESSION_HANDLE hSession
, /* the session's handle */
665 CK_BYTE_PTR pData
, /* signed data */
666 CK_ULONG ulDataLen
, /* length of signed data */
667 CK_BYTE_PTR pSignature
, /* signature */
668 CK_ULONG ulSignatureLen
/* signature length*/
673 /* C_VerifyUpdate continues a multiple-part verification
674 * operation, where the signature is an appendix to the data,
675 * and plaintext cannot be recovered from the signature. */
676 CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate
)
677 #ifdef CK_NEED_ARG_LIST
679 CK_SESSION_HANDLE hSession
, /* the session's handle */
680 CK_BYTE_PTR pPart
, /* signed data */
681 CK_ULONG ulPartLen
/* length of signed data */
686 /* C_VerifyFinal finishes a multiple-part verification
687 * operation, checking the signature. */
688 CK_PKCS11_FUNCTION_INFO(C_VerifyFinal
)
689 #ifdef CK_NEED_ARG_LIST
691 CK_SESSION_HANDLE hSession
, /* the session's handle */
692 CK_BYTE_PTR pSignature
, /* signature to verify */
693 CK_ULONG ulSignatureLen
/* signature length */
698 /* C_VerifyRecoverInit initializes a signature verification
699 * operation, where the data is recovered from the signature. */
700 CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit
)
701 #ifdef CK_NEED_ARG_LIST
703 CK_SESSION_HANDLE hSession
, /* the session's handle */
704 CK_MECHANISM_PTR pMechanism
, /* the verification mechanism */
705 CK_OBJECT_HANDLE hKey
/* verification key */
710 /* C_VerifyRecover verifies a signature in a single-part
711 * operation, where the data is recovered from the signature. */
712 CK_PKCS11_FUNCTION_INFO(C_VerifyRecover
)
713 #ifdef CK_NEED_ARG_LIST
715 CK_SESSION_HANDLE hSession
, /* the session's handle */
716 CK_BYTE_PTR pSignature
, /* signature to verify */
717 CK_ULONG ulSignatureLen
, /* signature length */
718 CK_BYTE_PTR pData
, /* gets signed data */
719 CK_ULONG_PTR pulDataLen
/* gets signed data len */
725 /* Dual-function cryptographic operations */
727 /* C_DigestEncryptUpdate continues a multiple-part digesting
728 * and encryption operation. */
729 CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate
)
730 #ifdef CK_NEED_ARG_LIST
732 CK_SESSION_HANDLE hSession
, /* session's handle */
733 CK_BYTE_PTR pPart
, /* the plaintext data */
734 CK_ULONG ulPartLen
, /* plaintext length */
735 CK_BYTE_PTR pEncryptedPart
, /* gets ciphertext */
736 CK_ULONG_PTR pulEncryptedPartLen
/* gets c-text length */
741 /* C_DecryptDigestUpdate continues a multiple-part decryption and
742 * digesting operation. */
743 CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate
)
744 #ifdef CK_NEED_ARG_LIST
746 CK_SESSION_HANDLE hSession
, /* session's handle */
747 CK_BYTE_PTR pEncryptedPart
, /* ciphertext */
748 CK_ULONG ulEncryptedPartLen
, /* ciphertext length */
749 CK_BYTE_PTR pPart
, /* gets plaintext */
750 CK_ULONG_PTR pulPartLen
/* gets plaintext len */
755 /* C_SignEncryptUpdate continues a multiple-part signing and
756 * encryption operation. */
757 CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate
)
758 #ifdef CK_NEED_ARG_LIST
760 CK_SESSION_HANDLE hSession
, /* session's handle */
761 CK_BYTE_PTR pPart
, /* the plaintext data */
762 CK_ULONG ulPartLen
, /* plaintext length */
763 CK_BYTE_PTR pEncryptedPart
, /* gets ciphertext */
764 CK_ULONG_PTR pulEncryptedPartLen
/* gets c-text length */
769 /* C_DecryptVerifyUpdate continues a multiple-part decryption and
770 * verify operation. */
771 CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate
)
772 #ifdef CK_NEED_ARG_LIST
774 CK_SESSION_HANDLE hSession
, /* session's handle */
775 CK_BYTE_PTR pEncryptedPart
, /* ciphertext */
776 CK_ULONG ulEncryptedPartLen
, /* ciphertext length */
777 CK_BYTE_PTR pPart
, /* gets plaintext */
778 CK_ULONG_PTR pulPartLen
/* gets p-text length */
786 /* C_GenerateKey generates a secret key, creating a new key
788 CK_PKCS11_FUNCTION_INFO(C_GenerateKey
)
789 #ifdef CK_NEED_ARG_LIST
791 CK_SESSION_HANDLE hSession
, /* the session's handle */
792 CK_MECHANISM_PTR pMechanism
, /* key generation mech. */
793 CK_ATTRIBUTE_PTR pTemplate
, /* template for new key */
794 CK_ULONG ulCount
, /* # of attrs in template */
795 CK_OBJECT_HANDLE_PTR phKey
/* gets handle of new key */
800 /* C_GenerateKeyPair generates a public-key/private-key pair,
801 * creating new key objects. */
802 CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair
)
803 #ifdef CK_NEED_ARG_LIST
805 CK_SESSION_HANDLE hSession
, /* session
807 CK_MECHANISM_PTR pMechanism
, /* key-gen
809 CK_ATTRIBUTE_PTR pPublicKeyTemplate
, /* template
812 CK_ULONG ulPublicKeyAttributeCount
, /* # pub.
814 CK_ATTRIBUTE_PTR pPrivateKeyTemplate
, /* template
817 CK_ULONG ulPrivateKeyAttributeCount
, /* # priv.
819 CK_OBJECT_HANDLE_PTR phPublicKey
, /* gets pub.
822 CK_OBJECT_HANDLE_PTR phPrivateKey
/* gets
829 /* C_WrapKey wraps (i.e., encrypts) a key. */
830 CK_PKCS11_FUNCTION_INFO(C_WrapKey
)
831 #ifdef CK_NEED_ARG_LIST
833 CK_SESSION_HANDLE hSession
, /* the session's handle */
834 CK_MECHANISM_PTR pMechanism
, /* the wrapping mechanism */
835 CK_OBJECT_HANDLE hWrappingKey
, /* wrapping key */
836 CK_OBJECT_HANDLE hKey
, /* key to be wrapped */
837 CK_BYTE_PTR pWrappedKey
, /* gets wrapped key */
838 CK_ULONG_PTR pulWrappedKeyLen
/* gets wrapped key size */
843 /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
845 CK_PKCS11_FUNCTION_INFO(C_UnwrapKey
)
846 #ifdef CK_NEED_ARG_LIST
848 CK_SESSION_HANDLE hSession
, /* session's handle */
849 CK_MECHANISM_PTR pMechanism
, /* unwrapping mech. */
850 CK_OBJECT_HANDLE hUnwrappingKey
, /* unwrapping key */
851 CK_BYTE_PTR pWrappedKey
, /* the wrapped key */
852 CK_ULONG ulWrappedKeyLen
, /* wrapped key len */
853 CK_ATTRIBUTE_PTR pTemplate
, /* new key template */
854 CK_ULONG ulAttributeCount
, /* template length */
855 CK_OBJECT_HANDLE_PTR phKey
/* gets new handle */
860 /* C_DeriveKey derives a key from a base key, creating a new key
862 CK_PKCS11_FUNCTION_INFO(C_DeriveKey
)
863 #ifdef CK_NEED_ARG_LIST
865 CK_SESSION_HANDLE hSession
, /* session's handle */
866 CK_MECHANISM_PTR pMechanism
, /* key deriv. mech. */
867 CK_OBJECT_HANDLE hBaseKey
, /* base key */
868 CK_ATTRIBUTE_PTR pTemplate
, /* new key template */
869 CK_ULONG ulAttributeCount
, /* template length */
870 CK_OBJECT_HANDLE_PTR phKey
/* gets new handle */
876 /* Random number generation */
878 /* C_SeedRandom mixes additional seed material into the token's
879 * random number generator. */
880 CK_PKCS11_FUNCTION_INFO(C_SeedRandom
)
881 #ifdef CK_NEED_ARG_LIST
883 CK_SESSION_HANDLE hSession
, /* the session's handle */
884 CK_BYTE_PTR pSeed
, /* the seed material */
885 CK_ULONG ulSeedLen
/* length of seed material */
890 /* C_GenerateRandom generates random data. */
891 CK_PKCS11_FUNCTION_INFO(C_GenerateRandom
)
892 #ifdef CK_NEED_ARG_LIST
894 CK_SESSION_HANDLE hSession
, /* the session's handle */
895 CK_BYTE_PTR RandomData
, /* receives the random data */
896 CK_ULONG ulRandomLen
/* # of bytes to generate */
902 /* Parallel function management */
904 /* C_GetFunctionStatus is a legacy function; it obtains an
905 * updated status of a function running in parallel with an
907 CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus
)
908 #ifdef CK_NEED_ARG_LIST
910 CK_SESSION_HANDLE hSession
/* the session's handle */
915 /* C_CancelFunction is a legacy function; it cancels a function
916 * running in parallel. */
917 CK_PKCS11_FUNCTION_INFO(C_CancelFunction
)
918 #ifdef CK_NEED_ARG_LIST
920 CK_SESSION_HANDLE hSession
/* the session's handle */
926 /* Functions added in for PKCS #11 Version 2.01 or later */
928 /* C_WaitForSlotEvent waits for a slot event (token insertion,
929 * removal, etc.) to occur. */
930 CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent
)
931 #ifdef CK_NEED_ARG_LIST
933 CK_FLAGS flags
, /* blocking/nonblocking flag */
934 CK_SLOT_ID_PTR pSlot
, /* location that receives the slot ID */
935 CK_VOID_PTR pRserved
/* reserved. Should be NULL_PTR */