PageRenderTime 589ms CodeModel.GetById 42ms RepoModel.GetById 10ms app.codeStats 0ms

/gecko_api/include/pkcs11f.h

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