pkcs11f.h 28 KB

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