pam_pkcs11
0.6.8
|
00001 /* pkcs11f.h include file for PKCS #11. */ 00002 /* $Revision: 1.4 $ */ 00003 00004 /* License to copy and use this software is granted provided that it is 00005 * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface 00006 * (Cryptoki)" in all material mentioning or referencing this software. 00007 00008 * License is also granted to make and use derivative works provided that 00009 * such works are identified as "derived from the RSA Security Inc. PKCS #11 00010 * Cryptographic Token Interface (Cryptoki)" in all material mentioning or 00011 * referencing the derived work. 00012 00013 * RSA Security Inc. makes no representations concerning either the 00014 * merchantability of this software or the suitability of this software for 00015 * any particular purpose. It is provided "as is" without express or implied 00016 * warranty of any kind. 00017 */ 00018 00019 /* This header file contains pretty much everything about all the */ 00020 /* Cryptoki function prototypes. Because this information is */ 00021 /* used for more than just declaring function prototypes, the */ 00022 /* order of the functions appearing herein is important, and */ 00023 /* should not be altered. */ 00024 00025 /* General-purpose */ 00026 00027 /* C_Initialize initializes the Cryptoki library. */ 00028 CK_PKCS11_FUNCTION_INFO(C_Initialize) 00029 #ifdef CK_NEED_ARG_LIST 00030 (CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets 00031 * cast to CK_C_INITIALIZE_ARGS_PTR 00032 * and dereferenced */ 00033 ); 00034 #endif 00035 00036 00037 /* C_Finalize indicates that an application is done with the 00038 * Cryptoki library. */ 00039 CK_PKCS11_FUNCTION_INFO(C_Finalize) 00040 #ifdef CK_NEED_ARG_LIST 00041 (CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */ 00042 ); 00043 #endif 00044 00045 00046 /* C_GetInfo returns general information about Cryptoki. */ 00047 CK_PKCS11_FUNCTION_INFO(C_GetInfo) 00048 #ifdef CK_NEED_ARG_LIST 00049 (CK_INFO_PTR pInfo /* location that receives information */ 00050 ); 00051 #endif 00052 00053 00054 /* C_GetFunctionList returns the function list. */ 00055 CK_PKCS11_FUNCTION_INFO(C_GetFunctionList) 00056 #ifdef CK_NEED_ARG_LIST 00057 (CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to 00058 * function list */ 00059 ); 00060 #endif 00061 00062 00063 00064 /* Slot and token management */ 00065 00066 /* C_GetSlotList obtains a list of slots in the system. */ 00067 CK_PKCS11_FUNCTION_INFO(C_GetSlotList) 00068 #ifdef CK_NEED_ARG_LIST 00069 (CK_BBOOL tokenPresent, /* only slots with tokens? */ 00070 CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */ 00071 CK_ULONG_PTR pulCount /* receives number of slots */ 00072 ); 00073 #endif 00074 00075 00076 /* C_GetSlotInfo obtains information about a particular slot in 00077 * the system. */ 00078 CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo) 00079 #ifdef CK_NEED_ARG_LIST 00080 (CK_SLOT_ID slotID, /* the ID of the slot */ 00081 CK_SLOT_INFO_PTR pInfo /* receives the slot information */ 00082 ); 00083 #endif 00084 00085 00086 /* C_GetTokenInfo obtains information about a particular token 00087 * in the system. */ 00088 CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo) 00089 #ifdef CK_NEED_ARG_LIST 00090 (CK_SLOT_ID slotID, /* ID of the token's slot */ 00091 CK_TOKEN_INFO_PTR pInfo /* receives the token information */ 00092 ); 00093 #endif 00094 00095 00096 /* C_GetMechanismList obtains a list of mechanism types 00097 * supported by a token. */ 00098 CK_PKCS11_FUNCTION_INFO(C_GetMechanismList) 00099 #ifdef CK_NEED_ARG_LIST 00100 (CK_SLOT_ID slotID, /* ID of token's slot */ 00101 CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */ 00102 CK_ULONG_PTR pulCount /* gets # of mechs. */ 00103 ); 00104 #endif 00105 00106 00107 /* C_GetMechanismInfo obtains information about a particular 00108 * mechanism possibly supported by a token. */ 00109 CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo) 00110 #ifdef CK_NEED_ARG_LIST 00111 (CK_SLOT_ID slotID, /* ID of the token's slot */ 00112 CK_MECHANISM_TYPE type, /* type of mechanism */ 00113 CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */ 00114 ); 00115 #endif 00116 00117 00118 /* C_InitToken initializes a token. */ 00119 CK_PKCS11_FUNCTION_INFO(C_InitToken) 00120 #ifdef CK_NEED_ARG_LIST 00121 /* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */ 00122 (CK_SLOT_ID slotID, /* ID of the token's slot */ 00123 CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */ 00124 CK_ULONG ulPinLen, /* length in bytes of the PIN */ 00125 CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */ 00126 ); 00127 #endif 00128 00129 00130 /* C_InitPIN initializes the normal user's PIN. */ 00131 CK_PKCS11_FUNCTION_INFO(C_InitPIN) 00132 #ifdef CK_NEED_ARG_LIST 00133 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00134 CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */ 00135 CK_ULONG ulPinLen /* length in bytes of the PIN */ 00136 ); 00137 #endif 00138 00139 00140 /* C_SetPIN modifies the PIN of the user who is logged in. */ 00141 CK_PKCS11_FUNCTION_INFO(C_SetPIN) 00142 #ifdef CK_NEED_ARG_LIST 00143 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00144 CK_UTF8CHAR_PTR pOldPin, /* the old PIN */ 00145 CK_ULONG ulOldLen, /* length of the old PIN */ 00146 CK_UTF8CHAR_PTR pNewPin, /* the new PIN */ 00147 CK_ULONG ulNewLen /* length of the new PIN */ 00148 ); 00149 #endif 00150 00151 00152 00153 /* Session management */ 00154 00155 /* C_OpenSession opens a session between an application and a 00156 * token. */ 00157 CK_PKCS11_FUNCTION_INFO(C_OpenSession) 00158 #ifdef CK_NEED_ARG_LIST 00159 (CK_SLOT_ID slotID, /* the slot's ID */ 00160 CK_FLAGS flags, /* from CK_SESSION_INFO */ 00161 CK_VOID_PTR pApplication, /* passed to callback */ 00162 CK_NOTIFY Notify, /* callback function */ 00163 CK_SESSION_HANDLE_PTR phSession /* gets session handle */ 00164 ); 00165 #endif 00166 00167 00168 /* C_CloseSession closes a session between an application and a 00169 * token. */ 00170 CK_PKCS11_FUNCTION_INFO(C_CloseSession) 00171 #ifdef CK_NEED_ARG_LIST 00172 (CK_SESSION_HANDLE hSession /* the session's handle */ 00173 ); 00174 #endif 00175 00176 00177 /* C_CloseAllSessions closes all sessions with a token. */ 00178 CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions) 00179 #ifdef CK_NEED_ARG_LIST 00180 (CK_SLOT_ID slotID /* the token's slot */ 00181 ); 00182 #endif 00183 00184 00185 /* C_GetSessionInfo obtains information about the session. */ 00186 CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo) 00187 #ifdef CK_NEED_ARG_LIST 00188 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00189 CK_SESSION_INFO_PTR pInfo /* receives session info */ 00190 ); 00191 #endif 00192 00193 00194 /* C_GetOperationState obtains the state of the cryptographic operation 00195 * in a session. */ 00196 CK_PKCS11_FUNCTION_INFO(C_GetOperationState) 00197 #ifdef CK_NEED_ARG_LIST 00198 (CK_SESSION_HANDLE hSession, /* session's handle */ 00199 CK_BYTE_PTR pOperationState, /* gets state */ 00200 CK_ULONG_PTR pulOperationStateLen /* gets state length */ 00201 ); 00202 #endif 00203 00204 00205 /* C_SetOperationState restores the state of the cryptographic 00206 * operation in a session. */ 00207 CK_PKCS11_FUNCTION_INFO(C_SetOperationState) 00208 #ifdef CK_NEED_ARG_LIST 00209 (CK_SESSION_HANDLE hSession, /* session's handle */ 00210 CK_BYTE_PTR pOperationState, /* holds state */ 00211 CK_ULONG ulOperationStateLen, /* holds state length */ 00212 CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */ 00213 CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */ 00214 ); 00215 #endif 00216 00217 00218 /* C_Login logs a user into a token. */ 00219 CK_PKCS11_FUNCTION_INFO(C_Login) 00220 #ifdef CK_NEED_ARG_LIST 00221 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00222 CK_USER_TYPE userType, /* the user type */ 00223 CK_UTF8CHAR_PTR pPin, /* the user's PIN */ 00224 CK_ULONG ulPinLen /* the length of the PIN */ 00225 ); 00226 #endif 00227 00228 00229 /* C_Logout logs a user out from a token. */ 00230 CK_PKCS11_FUNCTION_INFO(C_Logout) 00231 #ifdef CK_NEED_ARG_LIST 00232 (CK_SESSION_HANDLE hSession /* the session's handle */ 00233 ); 00234 #endif 00235 00236 00237 00238 /* Object management */ 00239 00240 /* C_CreateObject creates a new object. */ 00241 CK_PKCS11_FUNCTION_INFO(C_CreateObject) 00242 #ifdef CK_NEED_ARG_LIST 00243 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00244 CK_ATTRIBUTE_PTR pTemplate, /* the object's template */ 00245 CK_ULONG ulCount, /* attributes in template */ 00246 CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */ 00247 ); 00248 #endif 00249 00250 00251 /* C_CopyObject copies an object, creating a new object for the 00252 * copy. */ 00253 CK_PKCS11_FUNCTION_INFO(C_CopyObject) 00254 #ifdef CK_NEED_ARG_LIST 00255 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00256 CK_OBJECT_HANDLE hObject, /* the object's handle */ 00257 CK_ATTRIBUTE_PTR pTemplate, /* template for new object */ 00258 CK_ULONG ulCount, /* attributes in template */ 00259 CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */ 00260 ); 00261 #endif 00262 00263 00264 /* C_DestroyObject destroys an object. */ 00265 CK_PKCS11_FUNCTION_INFO(C_DestroyObject) 00266 #ifdef CK_NEED_ARG_LIST 00267 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00268 CK_OBJECT_HANDLE hObject /* the object's handle */ 00269 ); 00270 #endif 00271 00272 00273 /* C_GetObjectSize gets the size of an object in bytes. */ 00274 CK_PKCS11_FUNCTION_INFO(C_GetObjectSize) 00275 #ifdef CK_NEED_ARG_LIST 00276 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00277 CK_OBJECT_HANDLE hObject, /* the object's handle */ 00278 CK_ULONG_PTR pulSize /* receives size of object */ 00279 ); 00280 #endif 00281 00282 00283 /* C_GetAttributeValue obtains the value of one or more object 00284 * attributes. */ 00285 CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue) 00286 #ifdef CK_NEED_ARG_LIST 00287 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00288 CK_OBJECT_HANDLE hObject, /* the object's handle */ 00289 CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */ 00290 CK_ULONG ulCount /* attributes in template */ 00291 ); 00292 #endif 00293 00294 00295 /* C_SetAttributeValue modifies the value of one or more object 00296 * attributes */ 00297 CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue) 00298 #ifdef CK_NEED_ARG_LIST 00299 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00300 CK_OBJECT_HANDLE hObject, /* the object's handle */ 00301 CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */ 00302 CK_ULONG ulCount /* attributes in template */ 00303 ); 00304 #endif 00305 00306 00307 /* C_FindObjectsInit initializes a search for token and session 00308 * objects that match a template. */ 00309 CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit) 00310 #ifdef CK_NEED_ARG_LIST 00311 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00312 CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */ 00313 CK_ULONG ulCount /* attrs in search template */ 00314 ); 00315 #endif 00316 00317 00318 /* C_FindObjects continues a search for token and session 00319 * objects that match a template, obtaining additional object 00320 * handles. */ 00321 CK_PKCS11_FUNCTION_INFO(C_FindObjects) 00322 #ifdef CK_NEED_ARG_LIST 00323 (CK_SESSION_HANDLE hSession, /* session's handle */ 00324 CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */ 00325 CK_ULONG ulMaxObjectCount, /* max handles to get */ 00326 CK_ULONG_PTR pulObjectCount /* actual # returned */ 00327 ); 00328 #endif 00329 00330 00331 /* C_FindObjectsFinal finishes a search for token and session 00332 * objects. */ 00333 CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal) 00334 #ifdef CK_NEED_ARG_LIST 00335 (CK_SESSION_HANDLE hSession /* the session's handle */ 00336 ); 00337 #endif 00338 00339 00340 00341 /* Encryption and decryption */ 00342 00343 /* C_EncryptInit initializes an encryption operation. */ 00344 CK_PKCS11_FUNCTION_INFO(C_EncryptInit) 00345 #ifdef CK_NEED_ARG_LIST 00346 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00347 CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */ 00348 CK_OBJECT_HANDLE hKey /* handle of encryption key */ 00349 ); 00350 #endif 00351 00352 00353 /* C_Encrypt encrypts single-part data. */ 00354 CK_PKCS11_FUNCTION_INFO(C_Encrypt) 00355 #ifdef CK_NEED_ARG_LIST 00356 (CK_SESSION_HANDLE hSession, /* session's handle */ 00357 CK_BYTE_PTR pData, /* the plaintext data */ 00358 CK_ULONG ulDataLen, /* bytes of plaintext */ 00359 CK_BYTE_PTR pEncryptedData, /* gets ciphertext */ 00360 CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */ 00361 ); 00362 #endif 00363 00364 00365 /* C_EncryptUpdate continues a multiple-part encryption 00366 * operation. */ 00367 CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate) 00368 #ifdef CK_NEED_ARG_LIST 00369 (CK_SESSION_HANDLE hSession, /* session's handle */ 00370 CK_BYTE_PTR pPart, /* the plaintext data */ 00371 CK_ULONG ulPartLen, /* plaintext data len */ 00372 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ 00373 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */ 00374 ); 00375 #endif 00376 00377 00378 /* C_EncryptFinal finishes a multiple-part encryption 00379 * operation. */ 00380 CK_PKCS11_FUNCTION_INFO(C_EncryptFinal) 00381 #ifdef CK_NEED_ARG_LIST 00382 (CK_SESSION_HANDLE hSession, /* session handle */ 00383 CK_BYTE_PTR pLastEncryptedPart, /* last c-text */ 00384 CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */ 00385 ); 00386 #endif 00387 00388 00389 /* C_DecryptInit initializes a decryption operation. */ 00390 CK_PKCS11_FUNCTION_INFO(C_DecryptInit) 00391 #ifdef CK_NEED_ARG_LIST 00392 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00393 CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */ 00394 CK_OBJECT_HANDLE hKey /* handle of decryption key */ 00395 ); 00396 #endif 00397 00398 00399 /* C_Decrypt decrypts encrypted data in a single part. */ 00400 CK_PKCS11_FUNCTION_INFO(C_Decrypt) 00401 #ifdef CK_NEED_ARG_LIST 00402 (CK_SESSION_HANDLE hSession, /* session's handle */ 00403 CK_BYTE_PTR pEncryptedData, /* ciphertext */ 00404 CK_ULONG ulEncryptedDataLen, /* ciphertext length */ 00405 CK_BYTE_PTR pData, /* gets plaintext */ 00406 CK_ULONG_PTR pulDataLen /* gets p-text size */ 00407 ); 00408 #endif 00409 00410 00411 /* C_DecryptUpdate continues a multiple-part decryption 00412 * operation. */ 00413 CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate) 00414 #ifdef CK_NEED_ARG_LIST 00415 (CK_SESSION_HANDLE hSession, /* session's handle */ 00416 CK_BYTE_PTR pEncryptedPart, /* encrypted data */ 00417 CK_ULONG ulEncryptedPartLen, /* input length */ 00418 CK_BYTE_PTR pPart, /* gets plaintext */ 00419 CK_ULONG_PTR pulPartLen /* p-text size */ 00420 ); 00421 #endif 00422 00423 00424 /* C_DecryptFinal finishes a multiple-part decryption 00425 * operation. */ 00426 CK_PKCS11_FUNCTION_INFO(C_DecryptFinal) 00427 #ifdef CK_NEED_ARG_LIST 00428 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00429 CK_BYTE_PTR pLastPart, /* gets plaintext */ 00430 CK_ULONG_PTR pulLastPartLen /* p-text size */ 00431 ); 00432 #endif 00433 00434 00435 00436 /* Message digesting */ 00437 00438 /* C_DigestInit initializes a message-digesting operation. */ 00439 CK_PKCS11_FUNCTION_INFO(C_DigestInit) 00440 #ifdef CK_NEED_ARG_LIST 00441 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00442 CK_MECHANISM_PTR pMechanism /* the digesting mechanism */ 00443 ); 00444 #endif 00445 00446 00447 /* C_Digest digests data in a single part. */ 00448 CK_PKCS11_FUNCTION_INFO(C_Digest) 00449 #ifdef CK_NEED_ARG_LIST 00450 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00451 CK_BYTE_PTR pData, /* data to be digested */ 00452 CK_ULONG ulDataLen, /* bytes of data to digest */ 00453 CK_BYTE_PTR pDigest, /* gets the message digest */ 00454 CK_ULONG_PTR pulDigestLen /* gets digest length */ 00455 ); 00456 #endif 00457 00458 00459 /* C_DigestUpdate continues a multiple-part message-digesting 00460 * operation. */ 00461 CK_PKCS11_FUNCTION_INFO(C_DigestUpdate) 00462 #ifdef CK_NEED_ARG_LIST 00463 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00464 CK_BYTE_PTR pPart, /* data to be digested */ 00465 CK_ULONG ulPartLen /* bytes of data to be digested */ 00466 ); 00467 #endif 00468 00469 00470 /* C_DigestKey continues a multi-part message-digesting 00471 * operation, by digesting the value of a secret key as part of 00472 * the data already digested. */ 00473 CK_PKCS11_FUNCTION_INFO(C_DigestKey) 00474 #ifdef CK_NEED_ARG_LIST 00475 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00476 CK_OBJECT_HANDLE hKey /* secret key to digest */ 00477 ); 00478 #endif 00479 00480 00481 /* C_DigestFinal finishes a multiple-part message-digesting 00482 * operation. */ 00483 CK_PKCS11_FUNCTION_INFO(C_DigestFinal) 00484 #ifdef CK_NEED_ARG_LIST 00485 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00486 CK_BYTE_PTR pDigest, /* gets the message digest */ 00487 CK_ULONG_PTR pulDigestLen /* gets byte count of digest */ 00488 ); 00489 #endif 00490 00491 00492 00493 /* Signing and MACing */ 00494 00495 /* C_SignInit initializes a signature (private key encryption) 00496 * operation, where the signature is (will be) an appendix to 00497 * the data, and plaintext cannot be recovered from the 00498 *signature. */ 00499 CK_PKCS11_FUNCTION_INFO(C_SignInit) 00500 #ifdef CK_NEED_ARG_LIST 00501 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00502 CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ 00503 CK_OBJECT_HANDLE hKey /* handle of signature key */ 00504 ); 00505 #endif 00506 00507 00508 /* C_Sign signs (encrypts with private key) data in a single 00509 * part, where the signature is (will be) an appendix to the 00510 * data, and plaintext cannot be recovered from the signature. */ 00511 CK_PKCS11_FUNCTION_INFO(C_Sign) 00512 #ifdef CK_NEED_ARG_LIST 00513 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00514 CK_BYTE_PTR pData, /* the data to sign */ 00515 CK_ULONG ulDataLen, /* count of bytes to sign */ 00516 CK_BYTE_PTR pSignature, /* gets the signature */ 00517 CK_ULONG_PTR pulSignatureLen /* gets signature length */ 00518 ); 00519 #endif 00520 00521 00522 /* C_SignUpdate continues a multiple-part signature operation, 00523 * where the signature is (will be) an appendix to the data, 00524 * and plaintext cannot be recovered from the signature. */ 00525 CK_PKCS11_FUNCTION_INFO(C_SignUpdate) 00526 #ifdef CK_NEED_ARG_LIST 00527 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00528 CK_BYTE_PTR pPart, /* the data to sign */ 00529 CK_ULONG ulPartLen /* count of bytes to sign */ 00530 ); 00531 #endif 00532 00533 00534 /* C_SignFinal finishes a multiple-part signature operation, 00535 * returning the signature. */ 00536 CK_PKCS11_FUNCTION_INFO(C_SignFinal) 00537 #ifdef CK_NEED_ARG_LIST 00538 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00539 CK_BYTE_PTR pSignature, /* gets the signature */ 00540 CK_ULONG_PTR pulSignatureLen /* gets signature length */ 00541 ); 00542 #endif 00543 00544 00545 /* C_SignRecoverInit initializes a signature operation, where 00546 * the data can be recovered from the signature. */ 00547 CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit) 00548 #ifdef CK_NEED_ARG_LIST 00549 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00550 CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ 00551 CK_OBJECT_HANDLE hKey /* handle of the signature key */ 00552 ); 00553 #endif 00554 00555 00556 /* C_SignRecover signs data in a single operation, where the 00557 * data can be recovered from the signature. */ 00558 CK_PKCS11_FUNCTION_INFO(C_SignRecover) 00559 #ifdef CK_NEED_ARG_LIST 00560 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00561 CK_BYTE_PTR pData, /* the data to sign */ 00562 CK_ULONG ulDataLen, /* count of bytes to sign */ 00563 CK_BYTE_PTR pSignature, /* gets the signature */ 00564 CK_ULONG_PTR pulSignatureLen /* gets signature length */ 00565 ); 00566 #endif 00567 00568 00569 00570 /* Verifying signatures and MACs */ 00571 00572 /* C_VerifyInit initializes a verification operation, where the 00573 * signature is an appendix to the data, and plaintext cannot 00574 * cannot be recovered from the signature (e.g. DSA). */ 00575 CK_PKCS11_FUNCTION_INFO(C_VerifyInit) 00576 #ifdef CK_NEED_ARG_LIST 00577 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00578 CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ 00579 CK_OBJECT_HANDLE hKey /* verification key */ 00580 ); 00581 #endif 00582 00583 00584 /* C_Verify verifies a signature in a single-part operation, 00585 * where the signature is an appendix to the data, and plaintext 00586 * cannot be recovered from the signature. */ 00587 CK_PKCS11_FUNCTION_INFO(C_Verify) 00588 #ifdef CK_NEED_ARG_LIST 00589 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00590 CK_BYTE_PTR pData, /* signed data */ 00591 CK_ULONG ulDataLen, /* length of signed data */ 00592 CK_BYTE_PTR pSignature, /* signature */ 00593 CK_ULONG ulSignatureLen /* signature length */ 00594 ); 00595 #endif 00596 00597 00598 /* C_VerifyUpdate continues a multiple-part verification 00599 * operation, where the signature is an appendix to the data, 00600 * and plaintext cannot be recovered from the signature. */ 00601 CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate) 00602 #ifdef CK_NEED_ARG_LIST 00603 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00604 CK_BYTE_PTR pPart, /* signed data */ 00605 CK_ULONG ulPartLen /* length of signed data */ 00606 ); 00607 #endif 00608 00609 00610 /* C_VerifyFinal finishes a multiple-part verification 00611 * operation, checking the signature. */ 00612 CK_PKCS11_FUNCTION_INFO(C_VerifyFinal) 00613 #ifdef CK_NEED_ARG_LIST 00614 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00615 CK_BYTE_PTR pSignature, /* signature to verify */ 00616 CK_ULONG ulSignatureLen /* signature length */ 00617 ); 00618 #endif 00619 00620 00621 /* C_VerifyRecoverInit initializes a signature verification 00622 * operation, where the data is recovered from the signature. */ 00623 CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit) 00624 #ifdef CK_NEED_ARG_LIST 00625 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00626 CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ 00627 CK_OBJECT_HANDLE hKey /* verification key */ 00628 ); 00629 #endif 00630 00631 00632 /* C_VerifyRecover verifies a signature in a single-part 00633 * operation, where the data is recovered from the signature. */ 00634 CK_PKCS11_FUNCTION_INFO(C_VerifyRecover) 00635 #ifdef CK_NEED_ARG_LIST 00636 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00637 CK_BYTE_PTR pSignature, /* signature to verify */ 00638 CK_ULONG ulSignatureLen, /* signature length */ 00639 CK_BYTE_PTR pData, /* gets signed data */ 00640 CK_ULONG_PTR pulDataLen /* gets signed data len */ 00641 ); 00642 #endif 00643 00644 00645 00646 /* Dual-function cryptographic operations */ 00647 00648 /* C_DigestEncryptUpdate continues a multiple-part digesting 00649 * and encryption operation. */ 00650 CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate) 00651 #ifdef CK_NEED_ARG_LIST 00652 (CK_SESSION_HANDLE hSession, /* session's handle */ 00653 CK_BYTE_PTR pPart, /* the plaintext data */ 00654 CK_ULONG ulPartLen, /* plaintext length */ 00655 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ 00656 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ 00657 ); 00658 #endif 00659 00660 00661 /* C_DecryptDigestUpdate continues a multiple-part decryption and 00662 * digesting operation. */ 00663 CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate) 00664 #ifdef CK_NEED_ARG_LIST 00665 (CK_SESSION_HANDLE hSession, /* session's handle */ 00666 CK_BYTE_PTR pEncryptedPart, /* ciphertext */ 00667 CK_ULONG ulEncryptedPartLen, /* ciphertext length */ 00668 CK_BYTE_PTR pPart, /* gets plaintext */ 00669 CK_ULONG_PTR pulPartLen /* gets plaintext len */ 00670 ); 00671 #endif 00672 00673 00674 /* C_SignEncryptUpdate continues a multiple-part signing and 00675 * encryption operation. */ 00676 CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate) 00677 #ifdef CK_NEED_ARG_LIST 00678 (CK_SESSION_HANDLE hSession, /* session's handle */ 00679 CK_BYTE_PTR pPart, /* the plaintext data */ 00680 CK_ULONG ulPartLen, /* plaintext length */ 00681 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ 00682 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ 00683 ); 00684 #endif 00685 00686 00687 /* C_DecryptVerifyUpdate continues a multiple-part decryption and 00688 * verify operation. */ 00689 CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate) 00690 #ifdef CK_NEED_ARG_LIST 00691 (CK_SESSION_HANDLE hSession, /* session's handle */ 00692 CK_BYTE_PTR pEncryptedPart, /* ciphertext */ 00693 CK_ULONG ulEncryptedPartLen, /* ciphertext length */ 00694 CK_BYTE_PTR pPart, /* gets plaintext */ 00695 CK_ULONG_PTR pulPartLen /* gets p-text length */ 00696 ); 00697 #endif 00698 00699 00700 00701 /* Key management */ 00702 00703 /* C_GenerateKey generates a secret key, creating a new key 00704 * object. */ 00705 CK_PKCS11_FUNCTION_INFO(C_GenerateKey) 00706 #ifdef CK_NEED_ARG_LIST 00707 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00708 CK_MECHANISM_PTR pMechanism, /* key generation mech. */ 00709 CK_ATTRIBUTE_PTR pTemplate, /* template for new key */ 00710 CK_ULONG ulCount, /* # of attrs in template */ 00711 CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */ 00712 ); 00713 #endif 00714 00715 00716 /* C_GenerateKeyPair generates a public-key/private-key pair, 00717 * creating new key objects. */ 00718 CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair) 00719 #ifdef CK_NEED_ARG_LIST 00720 (CK_SESSION_HANDLE hSession, /* session 00721 * handle */ 00722 CK_MECHANISM_PTR pMechanism, /* key-gen 00723 * mech. */ 00724 CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template 00725 * for pub. 00726 * key */ 00727 CK_ULONG ulPublicKeyAttributeCount, /* # pub. 00728 * attrs. */ 00729 CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template 00730 * for priv. 00731 * key */ 00732 CK_ULONG ulPrivateKeyAttributeCount, /* # priv. 00733 * attrs. */ 00734 CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. 00735 * key 00736 * handle */ 00737 CK_OBJECT_HANDLE_PTR phPrivateKey /* gets 00738 * priv. key 00739 * handle */ 00740 ); 00741 #endif 00742 00743 00744 /* C_WrapKey wraps (i.e., encrypts) a key. */ 00745 CK_PKCS11_FUNCTION_INFO(C_WrapKey) 00746 #ifdef CK_NEED_ARG_LIST 00747 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00748 CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */ 00749 CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */ 00750 CK_OBJECT_HANDLE hKey, /* key to be wrapped */ 00751 CK_BYTE_PTR pWrappedKey, /* gets wrapped key */ 00752 CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */ 00753 ); 00754 #endif 00755 00756 00757 /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new 00758 * key object. */ 00759 CK_PKCS11_FUNCTION_INFO(C_UnwrapKey) 00760 #ifdef CK_NEED_ARG_LIST 00761 (CK_SESSION_HANDLE hSession, /* session's handle */ 00762 CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */ 00763 CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */ 00764 CK_BYTE_PTR pWrappedKey, /* the wrapped key */ 00765 CK_ULONG ulWrappedKeyLen, /* wrapped key len */ 00766 CK_ATTRIBUTE_PTR pTemplate, /* new key template */ 00767 CK_ULONG ulAttributeCount, /* template length */ 00768 CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ 00769 ); 00770 #endif 00771 00772 00773 /* C_DeriveKey derives a key from a base key, creating a new key 00774 * object. */ 00775 CK_PKCS11_FUNCTION_INFO(C_DeriveKey) 00776 #ifdef CK_NEED_ARG_LIST 00777 (CK_SESSION_HANDLE hSession, /* session's handle */ 00778 CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */ 00779 CK_OBJECT_HANDLE hBaseKey, /* base key */ 00780 CK_ATTRIBUTE_PTR pTemplate, /* new key template */ 00781 CK_ULONG ulAttributeCount, /* template length */ 00782 CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ 00783 ); 00784 #endif 00785 00786 00787 00788 /* Random number generation */ 00789 00790 /* C_SeedRandom mixes additional seed material into the token's 00791 * random number generator. */ 00792 CK_PKCS11_FUNCTION_INFO(C_SeedRandom) 00793 #ifdef CK_NEED_ARG_LIST 00794 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00795 CK_BYTE_PTR pSeed, /* the seed material */ 00796 CK_ULONG ulSeedLen /* length of seed material */ 00797 ); 00798 #endif 00799 00800 00801 /* C_GenerateRandom generates random data. */ 00802 CK_PKCS11_FUNCTION_INFO(C_GenerateRandom) 00803 #ifdef CK_NEED_ARG_LIST 00804 (CK_SESSION_HANDLE hSession, /* the session's handle */ 00805 CK_BYTE_PTR RandomData, /* receives the random data */ 00806 CK_ULONG ulRandomLen /* # of bytes to generate */ 00807 ); 00808 #endif 00809 00810 00811 00812 /* Parallel function management */ 00813 00814 /* C_GetFunctionStatus is a legacy function; it obtains an 00815 * updated status of a function running in parallel with an 00816 * application. */ 00817 CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus) 00818 #ifdef CK_NEED_ARG_LIST 00819 (CK_SESSION_HANDLE hSession /* the session's handle */ 00820 ); 00821 #endif 00822 00823 00824 /* C_CancelFunction is a legacy function; it cancels a function 00825 * running in parallel. */ 00826 CK_PKCS11_FUNCTION_INFO(C_CancelFunction) 00827 #ifdef CK_NEED_ARG_LIST 00828 (CK_SESSION_HANDLE hSession /* the session's handle */ 00829 ); 00830 #endif 00831 00832 00833 00834 /* Functions added in for Cryptoki Version 2.01 or later */ 00835 00836 /* C_WaitForSlotEvent waits for a slot event (token insertion, 00837 * removal, etc.) to occur. */ 00838 CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent) 00839 #ifdef CK_NEED_ARG_LIST 00840 (CK_FLAGS flags, /* blocking/nonblocking flag */ 00841 CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */ 00842 CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */ 00843 ); 00844 #endif