security/nss/lib/ckfw/ck.api

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial