pkcs11f.h 27 KB

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