ck.api 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. #
  2. # This Source Code Form is subject to the terms of the Mozilla Public
  3. # License, v. 2.0. If a copy of the MPL was not distributed with this
  4. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  5. # This file is in part derived from a file "pkcs11f.h" made available
  6. # by RSA Security at ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/pkcs11f.h
  7. # Fields
  8. # FUNCTION introduces a Cryptoki function
  9. # CK_type specifies and introduces an argument
  10. #
  11. # General-purpose
  12. # C_Initialize initializes the Cryptoki library.
  13. FUNCTION C_Initialize
  14. CK_VOID_PTR pInitArgs # if this is not NULL_PTR, it gets
  15. # cast to CK_C_INITIALIZE_ARGS_PTR
  16. # and dereferenced
  17. # C_Finalize indicates that an application is done with the
  18. # Cryptoki library.
  19. FUNCTION C_Finalize
  20. CK_VOID_PTR pReserved # reserved. Should be NULL_PTR
  21. # C_GetInfo returns general information about Cryptoki.
  22. FUNCTION C_GetInfo
  23. CK_INFO_PTR pInfo # location that receives information
  24. # C_GetFunctionList returns the function list.
  25. FUNCTION C_GetFunctionList
  26. CK_FUNCTION_LIST_PTR_PTR ppFunctionList # receives pointer to function
  27. # list
  28. # Slot and token management
  29. # C_GetSlotList obtains a list of slots in the system.
  30. FUNCTION C_GetSlotList
  31. CK_BBOOL tokenPresent # only slots with tokens?
  32. CK_SLOT_ID_PTR pSlotList # receives array of slot IDs
  33. CK_ULONG_PTR pulCount # receives number of slots
  34. # C_GetSlotInfo obtains information about a particular slot in the
  35. # system.
  36. FUNCTION C_GetSlotInfo
  37. CK_SLOT_ID slotID # the ID of the slot
  38. CK_SLOT_INFO_PTR pInfo # receives the slot information
  39. # C_GetTokenInfo obtains information about a particular token in the
  40. # system.
  41. FUNCTION C_GetTokenInfo
  42. CK_SLOT_ID slotID # ID of the token's slot
  43. CK_TOKEN_INFO_PTR pInfo # receives the token information
  44. # C_GetMechanismList obtains a list of mechanism types supported by a
  45. # token.
  46. FUNCTION C_GetMechanismList
  47. CK_SLOT_ID slotID # ID of token's slot
  48. CK_MECHANISM_TYPE_PTR pMechanismList # gets mech. array
  49. CK_ULONG_PTR pulCount # gets # of mechs.
  50. # C_GetMechanismInfo obtains information about a particular mechanism
  51. # possibly supported by a token.
  52. FUNCTION C_GetMechanismInfo
  53. CK_SLOT_ID slotID # ID of the token's slot
  54. CK_MECHANISM_TYPE type # type of mechanism
  55. CK_MECHANISM_INFO_PTR pInfo # receives mechanism info
  56. # C_InitToken initializes a token.
  57. FUNCTION C_InitToken
  58. CK_SLOT_ID slotID # ID of the token's slot
  59. CK_CHAR_PTR pPin # the SO's initial PIN
  60. CK_ULONG ulPinLen # length in bytes of the PIN
  61. CK_CHAR_PTR pLabel # 32-byte token label (blank padded)
  62. # C_InitPIN initializes the normal user's PIN.
  63. FUNCTION C_InitPIN
  64. CK_SESSION_HANDLE hSession # the session's handle
  65. CK_CHAR_PTR pPin # the normal user's PIN
  66. CK_ULONG ulPinLen # length in bytes of the PIN
  67. # C_SetPIN modifies the PIN of the user who is logged in.
  68. FUNCTION C_SetPIN
  69. CK_SESSION_HANDLE hSession # the session's handle
  70. CK_CHAR_PTR pOldPin # the old PIN
  71. CK_ULONG ulOldLen # length of the old PIN
  72. CK_CHAR_PTR pNewPin # the new PIN
  73. CK_ULONG ulNewLen # length of the new PIN
  74. # Session management
  75. # C_OpenSession opens a session between an application and a token.
  76. FUNCTION C_OpenSession
  77. CK_SLOT_ID slotID # the slot's ID
  78. CK_FLAGS flags # from CK_SESSION_INFO
  79. CK_VOID_PTR pApplication # passed to callback
  80. CK_NOTIFY Notify # callback function
  81. CK_SESSION_HANDLE_PTR phSession # gets session handle
  82. # C_CloseSession closes a session between an application and a token.
  83. FUNCTION C_CloseSession
  84. CK_SESSION_HANDLE hSession # the session's handle
  85. # C_CloseAllSessions closes all sessions with a token.
  86. FUNCTION C_CloseAllSessions
  87. CK_SLOT_ID slotID # the token's slot
  88. # C_GetSessionInfo obtains information about the session.
  89. FUNCTION C_GetSessionInfo
  90. CK_SESSION_HANDLE hSession # the session's handle
  91. CK_SESSION_INFO_PTR pInfo # receives session info
  92. # C_GetOperationState obtains the state of the cryptographic
  93. # operation in a session.
  94. FUNCTION C_GetOperationState
  95. CK_SESSION_HANDLE hSession # session's handle
  96. CK_BYTE_PTR pOperationState # gets state
  97. CK_ULONG_PTR pulOperationStateLen # gets state length
  98. # C_SetOperationState restores the state of the cryptographic
  99. # operation in a session.
  100. FUNCTION C_SetOperationState
  101. CK_SESSION_HANDLE hSession # session's handle
  102. CK_BYTE_PTR pOperationState # holds state
  103. CK_ULONG ulOperationStateLen # holds state length
  104. CK_OBJECT_HANDLE hEncryptionKey # en/decryption key
  105. CK_OBJECT_HANDLE hAuthenticationKey # sign/verify key
  106. # C_Login logs a user into a token.
  107. FUNCTION C_Login
  108. CK_SESSION_HANDLE hSession # the session's handle
  109. CK_USER_TYPE userType # the user type
  110. CK_CHAR_PTR pPin # the user's PIN
  111. CK_ULONG ulPinLen # the length of the PIN
  112. # C_Logout logs a user out from a token.
  113. FUNCTION C_Logout
  114. CK_SESSION_HANDLE hSession # the session's handle
  115. # Object management
  116. # C_CreateObject creates a new object.
  117. FUNCTION C_CreateObject
  118. CK_SESSION_HANDLE hSession # the session's handle
  119. CK_ATTRIBUTE_PTR pTemplate # the object's template
  120. CK_ULONG ulCount # attributes in template
  121. CK_OBJECT_HANDLE_PTR phObject # gets new object's handle.
  122. # C_CopyObject copies an object, creating a new object for the copy.
  123. FUNCTION C_CopyObject
  124. CK_SESSION_HANDLE hSession # the session's handle
  125. CK_OBJECT_HANDLE hObject # the object's handle
  126. CK_ATTRIBUTE_PTR pTemplate # template for new object
  127. CK_ULONG ulCount # attributes in template
  128. CK_OBJECT_HANDLE_PTR phNewObject # receives handle of copy
  129. # C_DestroyObject destroys an object.
  130. FUNCTION C_DestroyObject
  131. CK_SESSION_HANDLE hSession # the session's handle
  132. CK_OBJECT_HANDLE hObject # the object's handle
  133. # C_GetObjectSize gets the size of an object in bytes.
  134. FUNCTION C_GetObjectSize
  135. CK_SESSION_HANDLE hSession # the session's handle
  136. CK_OBJECT_HANDLE hObject # the object's handle
  137. CK_ULONG_PTR pulSize # receives size of object
  138. # C_GetAttributeValue obtains the value of one or more object
  139. # attributes.
  140. FUNCTION C_GetAttributeValue
  141. CK_SESSION_HANDLE hSession # the session's handle
  142. CK_OBJECT_HANDLE hObject # the object's handle
  143. CK_ATTRIBUTE_PTR pTemplate # specifies attrs; gets vals
  144. CK_ULONG ulCount # attributes in template
  145. # C_SetAttributeValue modifies the value of one or more object
  146. # attributes
  147. FUNCTION C_SetAttributeValue
  148. CK_SESSION_HANDLE hSession # the session's handle
  149. CK_OBJECT_HANDLE hObject # the object's handle
  150. CK_ATTRIBUTE_PTR pTemplate # specifies attrs and values
  151. CK_ULONG ulCount # attributes in template
  152. # C_FindObjectsInit initializes a search for token and session
  153. # objects that match a template.
  154. FUNCTION C_FindObjectsInit
  155. CK_SESSION_HANDLE hSession # the session's handle
  156. CK_ATTRIBUTE_PTR pTemplate # attribute values to match
  157. CK_ULONG ulCount # attrs in search template
  158. # C_FindObjects continues a search for token and session objects that
  159. # match a template, obtaining additional object handles.
  160. FUNCTION C_FindObjects
  161. CK_SESSION_HANDLE hSession # session's handle
  162. CK_OBJECT_HANDLE_PTR phObject # gets obj. handles
  163. CK_ULONG ulMaxObjectCount # max handles to get
  164. CK_ULONG_PTR pulObjectCount # actual # returned
  165. # C_FindObjectsFinal finishes a search for token and session objects.
  166. FUNCTION C_FindObjectsFinal
  167. CK_SESSION_HANDLE hSession # the session's handle
  168. # Encryption and decryption
  169. # C_EncryptInit initializes an encryption operation.
  170. FUNCTION C_EncryptInit
  171. CK_SESSION_HANDLE hSession # the session's handle
  172. CK_MECHANISM_PTR pMechanism # the encryption mechanism
  173. CK_OBJECT_HANDLE hKey # handle of encryption key
  174. # C_Encrypt encrypts single-part data.
  175. FUNCTION C_Encrypt
  176. CK_SESSION_HANDLE hSession # session's handle
  177. CK_BYTE_PTR pData # the plaintext data
  178. CK_ULONG ulDataLen # bytes of plaintext
  179. CK_BYTE_PTR pEncryptedData # gets ciphertext
  180. CK_ULONG_PTR pulEncryptedDataLen # gets c-text size
  181. # C_EncryptUpdate continues a multiple-part encryption operation.
  182. FUNCTION C_EncryptUpdate
  183. CK_SESSION_HANDLE hSession # session's handle
  184. CK_BYTE_PTR pPart # the plaintext data
  185. CK_ULONG ulPartLen # plaintext data len
  186. CK_BYTE_PTR pEncryptedPart # gets ciphertext
  187. CK_ULONG_PTR pulEncryptedPartLen # gets c-text size
  188. # C_EncryptFinal finishes a multiple-part encryption operation.
  189. FUNCTION C_EncryptFinal
  190. CK_SESSION_HANDLE hSession # session handle
  191. CK_BYTE_PTR pLastEncryptedPart # last c-text
  192. CK_ULONG_PTR pulLastEncryptedPartLen # gets last size
  193. # C_DecryptInit initializes a decryption operation.
  194. FUNCTION C_DecryptInit
  195. CK_SESSION_HANDLE hSession # the session's handle
  196. CK_MECHANISM_PTR pMechanism # the decryption mechanism
  197. CK_OBJECT_HANDLE hKey # handle of decryption key
  198. # C_Decrypt decrypts encrypted data in a single part.
  199. FUNCTION C_Decrypt
  200. CK_SESSION_HANDLE hSession # session's handle
  201. CK_BYTE_PTR pEncryptedData # ciphertext
  202. CK_ULONG ulEncryptedDataLen # ciphertext length
  203. CK_BYTE_PTR pData # gets plaintext
  204. CK_ULONG_PTR pulDataLen # gets p-text size
  205. # C_DecryptUpdate continues a multiple-part decryption operation.
  206. FUNCTION C_DecryptUpdate
  207. CK_SESSION_HANDLE hSession # session's handle
  208. CK_BYTE_PTR pEncryptedPart # encrypted data
  209. CK_ULONG ulEncryptedPartLen # input length
  210. CK_BYTE_PTR pPart # gets plaintext
  211. CK_ULONG_PTR pulPartLen # p-text size
  212. # C_DecryptFinal finishes a multiple-part decryption operation.
  213. FUNCTION C_DecryptFinal
  214. CK_SESSION_HANDLE hSession # the session's handle
  215. CK_BYTE_PTR pLastPart # gets plaintext
  216. CK_ULONG_PTR pulLastPartLen # p-text size
  217. # Message digesting
  218. # C_DigestInit initializes a message-digesting operation.
  219. FUNCTION C_DigestInit
  220. CK_SESSION_HANDLE hSession # the session's handle
  221. CK_MECHANISM_PTR pMechanism # the digesting mechanism
  222. # C_Digest digests data in a single part.
  223. FUNCTION C_Digest
  224. CK_SESSION_HANDLE hSession # the session's handle
  225. CK_BYTE_PTR pData # data to be digested
  226. CK_ULONG ulDataLen # bytes of data to digest
  227. CK_BYTE_PTR pDigest # gets the message digest
  228. CK_ULONG_PTR pulDigestLen # gets digest length
  229. # C_DigestUpdate continues a multiple-part message-digesting operation.
  230. FUNCTION C_DigestUpdate
  231. CK_SESSION_HANDLE hSession # the session's handle
  232. CK_BYTE_PTR pPart # data to be digested
  233. CK_ULONG ulPartLen # bytes of data to be digested
  234. # C_DigestKey continues a multi-part message-digesting operation, by
  235. # digesting the value of a secret key as part of the data already
  236. # digested.
  237. FUNCTION C_DigestKey
  238. CK_SESSION_HANDLE hSession # the session's handle
  239. CK_OBJECT_HANDLE hKey # secret key to digest
  240. # C_DigestFinal finishes a multiple-part message-digesting operation.
  241. FUNCTION C_DigestFinal
  242. CK_SESSION_HANDLE hSession # the session's handle
  243. CK_BYTE_PTR pDigest # gets the message digest
  244. CK_ULONG_PTR pulDigestLen # gets byte count of digest
  245. # Signing and MACing
  246. # C_SignInit initializes a signature (private key encryption)
  247. # operation, where the signature is (will be) an appendix to the
  248. # data, and plaintext cannot be recovered from the signature.
  249. FUNCTION C_SignInit
  250. CK_SESSION_HANDLE hSession # the session's handle
  251. CK_MECHANISM_PTR pMechanism # the signature mechanism
  252. CK_OBJECT_HANDLE hKey # handle of signature key
  253. # C_Sign signs (encrypts with private key) data in a single part,
  254. # where the signature is (will be) an appendix to the data, and
  255. # plaintext cannot be recovered from the signature.
  256. FUNCTION C_Sign
  257. CK_SESSION_HANDLE hSession # the session's handle
  258. CK_BYTE_PTR pData # the data to sign
  259. CK_ULONG ulDataLen # count of bytes to sign
  260. CK_BYTE_PTR pSignature # gets the signature
  261. CK_ULONG_PTR pulSignatureLen # gets signature length
  262. # C_SignUpdate continues a multiple-part signature operation, where
  263. # the signature is (will be) an appendix to the data, and plaintext
  264. # cannot be recovered from the signature.
  265. FUNCTION C_SignUpdate
  266. CK_SESSION_HANDLE hSession # the session's handle
  267. CK_BYTE_PTR pPart # the data to sign
  268. CK_ULONG ulPartLen # count of bytes to sign
  269. # C_SignFinal finishes a multiple-part signature operation, returning
  270. # the signature.
  271. FUNCTION C_SignFinal
  272. CK_SESSION_HANDLE hSession # the session's handle
  273. CK_BYTE_PTR pSignature # gets the signature
  274. CK_ULONG_PTR pulSignatureLen # gets signature length
  275. # C_SignRecoverInit initializes a signature operation, where the data
  276. # can be recovered from the signature.
  277. FUNCTION C_SignRecoverInit
  278. CK_SESSION_HANDLE hSession # the session's handle
  279. CK_MECHANISM_PTR pMechanism # the signature mechanism
  280. CK_OBJECT_HANDLE hKey # handle of the signature key
  281. # C_SignRecover signs data in a single operation, where the data can
  282. # be recovered from the signature.
  283. FUNCTION C_SignRecover
  284. CK_SESSION_HANDLE hSession # the session's handle
  285. CK_BYTE_PTR pData # the data to sign
  286. CK_ULONG ulDataLen # count of bytes to sign
  287. CK_BYTE_PTR pSignature # gets the signature
  288. CK_ULONG_PTR pulSignatureLen # gets signature length
  289. # Verifying signatures and MACs
  290. # C_VerifyInit initializes a verification operation, where the
  291. # signature is an appendix to the data, and plaintext cannot cannot
  292. # be recovered from the signature (e.g. DSA).
  293. FUNCTION C_VerifyInit
  294. CK_SESSION_HANDLE hSession # the session's handle
  295. CK_MECHANISM_PTR pMechanism # the verification mechanism
  296. CK_OBJECT_HANDLE hKey # verification key
  297. # C_Verify verifies a signature in a single-part operation, where the
  298. # signature is an appendix to the data, and plaintext cannot be
  299. # recovered from the signature.
  300. FUNCTION C_Verify
  301. CK_SESSION_HANDLE hSession # the session's handle
  302. CK_BYTE_PTR pData # signed data
  303. CK_ULONG ulDataLen # length of signed data
  304. CK_BYTE_PTR pSignature # signature
  305. CK_ULONG ulSignatureLen # signature length
  306. # C_VerifyUpdate continues a multiple-part verification operation,
  307. # where the signature is an appendix to the data, and plaintext cannot be
  308. # recovered from the signature.
  309. FUNCTION C_VerifyUpdate
  310. CK_SESSION_HANDLE hSession # the session's handle
  311. CK_BYTE_PTR pPart # signed data
  312. CK_ULONG ulPartLen # length of signed data
  313. # C_VerifyFinal finishes a multiple-part verification operation,
  314. # checking the signature.
  315. FUNCTION C_VerifyFinal
  316. CK_SESSION_HANDLE hSession # the session's handle
  317. CK_BYTE_PTR pSignature # signature to verify
  318. CK_ULONG ulSignatureLen # signature length
  319. # C_VerifyRecoverInit initializes a signature verification operation,
  320. # where the data is recovered from the signature.
  321. FUNCTION C_VerifyRecoverInit
  322. CK_SESSION_HANDLE hSession # the session's handle
  323. CK_MECHANISM_PTR pMechanism # the verification mechanism
  324. CK_OBJECT_HANDLE hKey # verification key
  325. # C_VerifyRecover verifies a signature in a single-part operation,
  326. # where the data is recovered from the signature.
  327. FUNCTION C_VerifyRecover
  328. CK_SESSION_HANDLE hSession # the session's handle
  329. CK_BYTE_PTR pSignature # signature to verify
  330. CK_ULONG ulSignatureLen # signature length
  331. CK_BYTE_PTR pData # gets signed data
  332. CK_ULONG_PTR pulDataLen # gets signed data len
  333. # Dual-function cryptographic operations
  334. # C_DigestEncryptUpdate continues a multiple-part digesting and
  335. # encryption operation.
  336. FUNCTION C_DigestEncryptUpdate
  337. CK_SESSION_HANDLE hSession # session's handle
  338. CK_BYTE_PTR pPart # the plaintext data
  339. CK_ULONG ulPartLen # plaintext length
  340. CK_BYTE_PTR pEncryptedPart # gets ciphertext
  341. CK_ULONG_PTR pulEncryptedPartLen # gets c-text length
  342. # C_DecryptDigestUpdate continues a multiple-part decryption and
  343. # digesting operation.
  344. FUNCTION C_DecryptDigestUpdate
  345. CK_SESSION_HANDLE hSession # session's handle
  346. CK_BYTE_PTR pEncryptedPart # ciphertext
  347. CK_ULONG ulEncryptedPartLen # ciphertext length
  348. CK_BYTE_PTR pPart # gets plaintext
  349. CK_ULONG_PTR pulPartLen # gets plaintext len
  350. # C_SignEncryptUpdate continues a multiple-part signing and
  351. # encryption operation.
  352. FUNCTION C_SignEncryptUpdate
  353. CK_SESSION_HANDLE hSession # session's handle
  354. CK_BYTE_PTR pPart # the plaintext data
  355. CK_ULONG ulPartLen # plaintext length
  356. CK_BYTE_PTR pEncryptedPart # gets ciphertext
  357. CK_ULONG_PTR pulEncryptedPartLen # gets c-text length
  358. # C_DecryptVerifyUpdate continues a multiple-part decryption and
  359. # verify operation.
  360. FUNCTION C_DecryptVerifyUpdate
  361. CK_SESSION_HANDLE hSession # session's handle
  362. CK_BYTE_PTR pEncryptedPart # ciphertext
  363. CK_ULONG ulEncryptedPartLen # ciphertext length
  364. CK_BYTE_PTR pPart # gets plaintext
  365. CK_ULONG_PTR pulPartLen # gets p-text length
  366. # Key management
  367. # C_GenerateKey generates a secret key, creating a new key object.
  368. FUNCTION C_GenerateKey
  369. CK_SESSION_HANDLE hSession # the session's handle
  370. CK_MECHANISM_PTR pMechanism # key generation mech.
  371. CK_ATTRIBUTE_PTR pTemplate # template for new key
  372. CK_ULONG ulCount # # of attrs in template
  373. CK_OBJECT_HANDLE_PTR phKey # gets handle of new key
  374. # C_GenerateKeyPair generates a public-key/private-key pair, creating
  375. # new key objects.
  376. FUNCTION C_GenerateKeyPair
  377. CK_SESSION_HANDLE hSession # session handle
  378. CK_MECHANISM_PTR pMechanism # key-gen mech.
  379. CK_ATTRIBUTE_PTR pPublicKeyTemplate # template for pub. key
  380. CK_ULONG ulPublicKeyAttributeCount # # pub. attrs.
  381. CK_ATTRIBUTE_PTR pPrivateKeyTemplate # template for priv. key
  382. CK_ULONG ulPrivateKeyAttributeCount # # priv. attrs.
  383. CK_OBJECT_HANDLE_PTR phPublicKey # gets pub. key handle
  384. CK_OBJECT_HANDLE_PTR phPrivateKey # gets priv. key handle
  385. # C_WrapKey wraps (i.e., encrypts) a key.
  386. FUNCTION C_WrapKey
  387. CK_SESSION_HANDLE hSession # the session's handle
  388. CK_MECHANISM_PTR pMechanism # the wrapping mechanism
  389. CK_OBJECT_HANDLE hWrappingKey # wrapping key
  390. CK_OBJECT_HANDLE hKey # key to be wrapped
  391. CK_BYTE_PTR pWrappedKey # gets wrapped key
  392. CK_ULONG_PTR pulWrappedKeyLen # gets wrapped key size
  393. # C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new key
  394. # object.
  395. FUNCTION C_UnwrapKey
  396. CK_SESSION_HANDLE hSession # session's handle
  397. CK_MECHANISM_PTR pMechanism # unwrapping mech.
  398. CK_OBJECT_HANDLE hUnwrappingKey # unwrapping key
  399. CK_BYTE_PTR pWrappedKey # the wrapped key
  400. CK_ULONG ulWrappedKeyLen # wrapped key len
  401. CK_ATTRIBUTE_PTR pTemplate # new key template
  402. CK_ULONG ulAttributeCount # template length
  403. CK_OBJECT_HANDLE_PTR phKey # gets new handle
  404. # C_DeriveKey derives a key from a base key, creating a new key object.
  405. FUNCTION C_DeriveKey
  406. CK_SESSION_HANDLE hSession # session's handle
  407. CK_MECHANISM_PTR pMechanism # key deriv. mech.
  408. CK_OBJECT_HANDLE hBaseKey # base key
  409. CK_ATTRIBUTE_PTR pTemplate # new key template
  410. CK_ULONG ulAttributeCount # template length
  411. CK_OBJECT_HANDLE_PTR phKey # gets new handle
  412. # Random number generation
  413. # C_SeedRandom mixes additional seed material into the token's random
  414. # number generator.
  415. FUNCTION C_SeedRandom
  416. CK_SESSION_HANDLE hSession # the session's handle
  417. CK_BYTE_PTR pSeed # the seed material
  418. CK_ULONG ulSeedLen # length of seed material
  419. # C_GenerateRandom generates random data.
  420. FUNCTION C_GenerateRandom
  421. CK_SESSION_HANDLE hSession # the session's handle
  422. CK_BYTE_PTR RandomData # receives the random data
  423. CK_ULONG ulRandomLen # # of bytes to generate
  424. # Parallel function management
  425. # C_GetFunctionStatus is a legacy function; it obtains an updated
  426. # status of a function running in parallel with an application.
  427. FUNCTION C_GetFunctionStatus
  428. CK_SESSION_HANDLE hSession # the session's handle
  429. # C_CancelFunction is a legacy function; it cancels a function running
  430. # in parallel.
  431. FUNCTION C_CancelFunction
  432. CK_SESSION_HANDLE hSession # the session's handle
  433. # Functions added in for Cryptoki Version 2.01 or later
  434. # C_WaitForSlotEvent waits for a slot event (token insertion, removal,
  435. # etc.) to occur.
  436. FUNCTION C_WaitForSlotEvent
  437. CK_FLAGS flags # blocking/nonblocking flag
  438. CK_SLOT_ID_PTR pSlot # location that receives the slot ID
  439. CK_VOID_PTR pRserved # reserved. Should be NULL_PTR
  440. ## C_ConfigureSlot passes an installation-specified bytestring to a
  441. ## slot.
  442. #FUNCTION C_ConfigureSlot
  443. #CK_SLOT_ID slotID # the slot to configure
  444. #CK_BYTE_PTR pConfig # the configuration string
  445. #CK_ULONG ulConfigLen # length of the config string