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

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

mercurial