home *** CD-ROM | disk | FTP | other *** search
/ ftp.rsa.com / 2014.05.ftp.rsa.com.tar / ftp.rsa.com / pub / pkcs / pkcs-11 / v2.01 / pkcs11f.h < prev    next >
C/C++ Source or Header  |  2014-05-02  |  27KB  |  896 lines

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