michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # This file is in part derived from a file "pkcs11f.h" made available michael@0: # by RSA Security at ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/pkcs11f.h michael@0: michael@0: # Fields michael@0: # FUNCTION introduces a Cryptoki function michael@0: # CK_type specifies and introduces an argument michael@0: # michael@0: michael@0: # General-purpose michael@0: michael@0: # C_Initialize initializes the Cryptoki library. michael@0: FUNCTION C_Initialize michael@0: CK_VOID_PTR pInitArgs # if this is not NULL_PTR, it gets michael@0: # cast to CK_C_INITIALIZE_ARGS_PTR michael@0: # and dereferenced michael@0: michael@0: # C_Finalize indicates that an application is done with the michael@0: # Cryptoki library. michael@0: FUNCTION C_Finalize michael@0: CK_VOID_PTR pReserved # reserved. Should be NULL_PTR michael@0: michael@0: # C_GetInfo returns general information about Cryptoki. michael@0: FUNCTION C_GetInfo michael@0: CK_INFO_PTR pInfo # location that receives information michael@0: michael@0: # C_GetFunctionList returns the function list. michael@0: FUNCTION C_GetFunctionList michael@0: CK_FUNCTION_LIST_PTR_PTR ppFunctionList # receives pointer to function michael@0: # list michael@0: michael@0: michael@0: # Slot and token management michael@0: michael@0: # C_GetSlotList obtains a list of slots in the system. michael@0: FUNCTION C_GetSlotList michael@0: CK_BBOOL tokenPresent # only slots with tokens? michael@0: CK_SLOT_ID_PTR pSlotList # receives array of slot IDs michael@0: CK_ULONG_PTR pulCount # receives number of slots michael@0: michael@0: # C_GetSlotInfo obtains information about a particular slot in the michael@0: # system. michael@0: FUNCTION C_GetSlotInfo michael@0: CK_SLOT_ID slotID # the ID of the slot michael@0: CK_SLOT_INFO_PTR pInfo # receives the slot information michael@0: michael@0: # C_GetTokenInfo obtains information about a particular token in the michael@0: # system. michael@0: FUNCTION C_GetTokenInfo michael@0: CK_SLOT_ID slotID # ID of the token's slot michael@0: CK_TOKEN_INFO_PTR pInfo # receives the token information michael@0: michael@0: # C_GetMechanismList obtains a list of mechanism types supported by a michael@0: # token. michael@0: FUNCTION C_GetMechanismList michael@0: CK_SLOT_ID slotID # ID of token's slot michael@0: CK_MECHANISM_TYPE_PTR pMechanismList # gets mech. array michael@0: CK_ULONG_PTR pulCount # gets # of mechs. michael@0: michael@0: # C_GetMechanismInfo obtains information about a particular mechanism michael@0: # possibly supported by a token. michael@0: FUNCTION C_GetMechanismInfo michael@0: CK_SLOT_ID slotID # ID of the token's slot michael@0: CK_MECHANISM_TYPE type # type of mechanism michael@0: CK_MECHANISM_INFO_PTR pInfo # receives mechanism info michael@0: michael@0: # C_InitToken initializes a token. michael@0: FUNCTION C_InitToken michael@0: CK_SLOT_ID slotID # ID of the token's slot michael@0: CK_CHAR_PTR pPin # the SO's initial PIN michael@0: CK_ULONG ulPinLen # length in bytes of the PIN michael@0: CK_CHAR_PTR pLabel # 32-byte token label (blank padded) michael@0: michael@0: # C_InitPIN initializes the normal user's PIN. michael@0: FUNCTION C_InitPIN michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_CHAR_PTR pPin # the normal user's PIN michael@0: CK_ULONG ulPinLen # length in bytes of the PIN michael@0: michael@0: # C_SetPIN modifies the PIN of the user who is logged in. michael@0: FUNCTION C_SetPIN michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_CHAR_PTR pOldPin # the old PIN michael@0: CK_ULONG ulOldLen # length of the old PIN michael@0: CK_CHAR_PTR pNewPin # the new PIN michael@0: CK_ULONG ulNewLen # length of the new PIN michael@0: michael@0: michael@0: # Session management michael@0: michael@0: # C_OpenSession opens a session between an application and a token. michael@0: FUNCTION C_OpenSession michael@0: CK_SLOT_ID slotID # the slot's ID michael@0: CK_FLAGS flags # from CK_SESSION_INFO michael@0: CK_VOID_PTR pApplication # passed to callback michael@0: CK_NOTIFY Notify # callback function michael@0: CK_SESSION_HANDLE_PTR phSession # gets session handle michael@0: michael@0: # C_CloseSession closes a session between an application and a token. michael@0: FUNCTION C_CloseSession michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: michael@0: # C_CloseAllSessions closes all sessions with a token. michael@0: FUNCTION C_CloseAllSessions michael@0: CK_SLOT_ID slotID # the token's slot michael@0: michael@0: # C_GetSessionInfo obtains information about the session. michael@0: FUNCTION C_GetSessionInfo michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_SESSION_INFO_PTR pInfo # receives session info michael@0: michael@0: # C_GetOperationState obtains the state of the cryptographic michael@0: # operation in a session. michael@0: FUNCTION C_GetOperationState michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pOperationState # gets state michael@0: CK_ULONG_PTR pulOperationStateLen # gets state length michael@0: michael@0: # C_SetOperationState restores the state of the cryptographic michael@0: # operation in a session. michael@0: FUNCTION C_SetOperationState michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pOperationState # holds state michael@0: CK_ULONG ulOperationStateLen # holds state length michael@0: CK_OBJECT_HANDLE hEncryptionKey # en/decryption key michael@0: CK_OBJECT_HANDLE hAuthenticationKey # sign/verify key michael@0: michael@0: # C_Login logs a user into a token. michael@0: FUNCTION C_Login michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_USER_TYPE userType # the user type michael@0: CK_CHAR_PTR pPin # the user's PIN michael@0: CK_ULONG ulPinLen # the length of the PIN michael@0: michael@0: # C_Logout logs a user out from a token. michael@0: FUNCTION C_Logout michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: michael@0: michael@0: # Object management michael@0: michael@0: # C_CreateObject creates a new object. michael@0: FUNCTION C_CreateObject michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_ATTRIBUTE_PTR pTemplate # the object's template michael@0: CK_ULONG ulCount # attributes in template michael@0: CK_OBJECT_HANDLE_PTR phObject # gets new object's handle. michael@0: michael@0: # C_CopyObject copies an object, creating a new object for the copy. michael@0: FUNCTION C_CopyObject michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_OBJECT_HANDLE hObject # the object's handle michael@0: CK_ATTRIBUTE_PTR pTemplate # template for new object michael@0: CK_ULONG ulCount # attributes in template michael@0: CK_OBJECT_HANDLE_PTR phNewObject # receives handle of copy michael@0: michael@0: # C_DestroyObject destroys an object. michael@0: FUNCTION C_DestroyObject michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_OBJECT_HANDLE hObject # the object's handle michael@0: michael@0: # C_GetObjectSize gets the size of an object in bytes. michael@0: FUNCTION C_GetObjectSize michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_OBJECT_HANDLE hObject # the object's handle michael@0: CK_ULONG_PTR pulSize # receives size of object michael@0: michael@0: # C_GetAttributeValue obtains the value of one or more object michael@0: # attributes. michael@0: FUNCTION C_GetAttributeValue michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_OBJECT_HANDLE hObject # the object's handle michael@0: CK_ATTRIBUTE_PTR pTemplate # specifies attrs; gets vals michael@0: CK_ULONG ulCount # attributes in template michael@0: michael@0: # C_SetAttributeValue modifies the value of one or more object michael@0: # attributes michael@0: FUNCTION C_SetAttributeValue michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_OBJECT_HANDLE hObject # the object's handle michael@0: CK_ATTRIBUTE_PTR pTemplate # specifies attrs and values michael@0: CK_ULONG ulCount # attributes in template michael@0: michael@0: # C_FindObjectsInit initializes a search for token and session michael@0: # objects that match a template. michael@0: FUNCTION C_FindObjectsInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_ATTRIBUTE_PTR pTemplate # attribute values to match michael@0: CK_ULONG ulCount # attrs in search template michael@0: michael@0: # C_FindObjects continues a search for token and session objects that michael@0: # match a template, obtaining additional object handles. michael@0: FUNCTION C_FindObjects michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_OBJECT_HANDLE_PTR phObject # gets obj. handles michael@0: CK_ULONG ulMaxObjectCount # max handles to get michael@0: CK_ULONG_PTR pulObjectCount # actual # returned michael@0: michael@0: # C_FindObjectsFinal finishes a search for token and session objects. michael@0: FUNCTION C_FindObjectsFinal michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: michael@0: michael@0: # Encryption and decryption michael@0: michael@0: # C_EncryptInit initializes an encryption operation. michael@0: FUNCTION C_EncryptInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the encryption mechanism michael@0: CK_OBJECT_HANDLE hKey # handle of encryption key michael@0: michael@0: # C_Encrypt encrypts single-part data. michael@0: FUNCTION C_Encrypt michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pData # the plaintext data michael@0: CK_ULONG ulDataLen # bytes of plaintext michael@0: CK_BYTE_PTR pEncryptedData # gets ciphertext michael@0: CK_ULONG_PTR pulEncryptedDataLen # gets c-text size michael@0: michael@0: # C_EncryptUpdate continues a multiple-part encryption operation. michael@0: FUNCTION C_EncryptUpdate michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pPart # the plaintext data michael@0: CK_ULONG ulPartLen # plaintext data len michael@0: CK_BYTE_PTR pEncryptedPart # gets ciphertext michael@0: CK_ULONG_PTR pulEncryptedPartLen # gets c-text size michael@0: michael@0: # C_EncryptFinal finishes a multiple-part encryption operation. michael@0: FUNCTION C_EncryptFinal michael@0: CK_SESSION_HANDLE hSession # session handle michael@0: CK_BYTE_PTR pLastEncryptedPart # last c-text michael@0: CK_ULONG_PTR pulLastEncryptedPartLen # gets last size michael@0: michael@0: # C_DecryptInit initializes a decryption operation. michael@0: FUNCTION C_DecryptInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the decryption mechanism michael@0: CK_OBJECT_HANDLE hKey # handle of decryption key michael@0: michael@0: # C_Decrypt decrypts encrypted data in a single part. michael@0: FUNCTION C_Decrypt michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pEncryptedData # ciphertext michael@0: CK_ULONG ulEncryptedDataLen # ciphertext length michael@0: CK_BYTE_PTR pData # gets plaintext michael@0: CK_ULONG_PTR pulDataLen # gets p-text size michael@0: michael@0: # C_DecryptUpdate continues a multiple-part decryption operation. michael@0: FUNCTION C_DecryptUpdate michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pEncryptedPart # encrypted data michael@0: CK_ULONG ulEncryptedPartLen # input length michael@0: CK_BYTE_PTR pPart # gets plaintext michael@0: CK_ULONG_PTR pulPartLen # p-text size michael@0: michael@0: # C_DecryptFinal finishes a multiple-part decryption operation. michael@0: FUNCTION C_DecryptFinal michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pLastPart # gets plaintext michael@0: CK_ULONG_PTR pulLastPartLen # p-text size michael@0: michael@0: michael@0: # Message digesting michael@0: michael@0: # C_DigestInit initializes a message-digesting operation. michael@0: FUNCTION C_DigestInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the digesting mechanism michael@0: michael@0: # C_Digest digests data in a single part. michael@0: FUNCTION C_Digest michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pData # data to be digested michael@0: CK_ULONG ulDataLen # bytes of data to digest michael@0: CK_BYTE_PTR pDigest # gets the message digest michael@0: CK_ULONG_PTR pulDigestLen # gets digest length michael@0: michael@0: # C_DigestUpdate continues a multiple-part message-digesting operation. michael@0: FUNCTION C_DigestUpdate michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pPart # data to be digested michael@0: CK_ULONG ulPartLen # bytes of data to be digested michael@0: michael@0: # C_DigestKey continues a multi-part message-digesting operation, by michael@0: # digesting the value of a secret key as part of the data already michael@0: # digested. michael@0: FUNCTION C_DigestKey michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_OBJECT_HANDLE hKey # secret key to digest michael@0: michael@0: # C_DigestFinal finishes a multiple-part message-digesting operation. michael@0: FUNCTION C_DigestFinal michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pDigest # gets the message digest michael@0: CK_ULONG_PTR pulDigestLen # gets byte count of digest michael@0: michael@0: michael@0: # Signing and MACing michael@0: michael@0: # C_SignInit initializes a signature (private key encryption) michael@0: # operation, where the signature is (will be) an appendix to the michael@0: # data, and plaintext cannot be recovered from the signature. michael@0: FUNCTION C_SignInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the signature mechanism michael@0: CK_OBJECT_HANDLE hKey # handle of signature key michael@0: michael@0: # C_Sign signs (encrypts with private key) data in a single part, michael@0: # where the signature is (will be) an appendix to the data, and michael@0: # plaintext cannot be recovered from the signature. michael@0: FUNCTION C_Sign michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pData # the data to sign michael@0: CK_ULONG ulDataLen # count of bytes to sign michael@0: CK_BYTE_PTR pSignature # gets the signature michael@0: CK_ULONG_PTR pulSignatureLen # gets signature length michael@0: michael@0: # C_SignUpdate continues a multiple-part signature operation, where michael@0: # the signature is (will be) an appendix to the data, and plaintext michael@0: # cannot be recovered from the signature. michael@0: FUNCTION C_SignUpdate michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pPart # the data to sign michael@0: CK_ULONG ulPartLen # count of bytes to sign michael@0: michael@0: # C_SignFinal finishes a multiple-part signature operation, returning michael@0: # the signature. michael@0: FUNCTION C_SignFinal michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pSignature # gets the signature michael@0: CK_ULONG_PTR pulSignatureLen # gets signature length michael@0: michael@0: # C_SignRecoverInit initializes a signature operation, where the data michael@0: # can be recovered from the signature. michael@0: FUNCTION C_SignRecoverInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the signature mechanism michael@0: CK_OBJECT_HANDLE hKey # handle of the signature key michael@0: michael@0: # C_SignRecover signs data in a single operation, where the data can michael@0: # be recovered from the signature. michael@0: FUNCTION C_SignRecover michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pData # the data to sign michael@0: CK_ULONG ulDataLen # count of bytes to sign michael@0: CK_BYTE_PTR pSignature # gets the signature michael@0: CK_ULONG_PTR pulSignatureLen # gets signature length michael@0: michael@0: michael@0: # Verifying signatures and MACs michael@0: michael@0: # C_VerifyInit initializes a verification operation, where the michael@0: # signature is an appendix to the data, and plaintext cannot cannot michael@0: # be recovered from the signature (e.g. DSA). michael@0: FUNCTION C_VerifyInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the verification mechanism michael@0: CK_OBJECT_HANDLE hKey # verification key michael@0: michael@0: # C_Verify verifies a signature in a single-part operation, where the michael@0: # signature is an appendix to the data, and plaintext cannot be michael@0: # recovered from the signature. michael@0: FUNCTION C_Verify michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pData # signed data michael@0: CK_ULONG ulDataLen # length of signed data michael@0: CK_BYTE_PTR pSignature # signature michael@0: CK_ULONG ulSignatureLen # signature length michael@0: michael@0: # C_VerifyUpdate continues a multiple-part verification operation, michael@0: # where the signature is an appendix to the data, and plaintext cannot be michael@0: # recovered from the signature. michael@0: FUNCTION C_VerifyUpdate michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pPart # signed data michael@0: CK_ULONG ulPartLen # length of signed data michael@0: michael@0: # C_VerifyFinal finishes a multiple-part verification operation, michael@0: # checking the signature. michael@0: FUNCTION C_VerifyFinal michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pSignature # signature to verify michael@0: CK_ULONG ulSignatureLen # signature length michael@0: michael@0: # C_VerifyRecoverInit initializes a signature verification operation, michael@0: # where the data is recovered from the signature. michael@0: FUNCTION C_VerifyRecoverInit michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the verification mechanism michael@0: CK_OBJECT_HANDLE hKey # verification key michael@0: michael@0: # C_VerifyRecover verifies a signature in a single-part operation, michael@0: # where the data is recovered from the signature. michael@0: FUNCTION C_VerifyRecover michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pSignature # signature to verify michael@0: CK_ULONG ulSignatureLen # signature length michael@0: CK_BYTE_PTR pData # gets signed data michael@0: CK_ULONG_PTR pulDataLen # gets signed data len michael@0: michael@0: michael@0: # Dual-function cryptographic operations michael@0: michael@0: # C_DigestEncryptUpdate continues a multiple-part digesting and michael@0: # encryption operation. michael@0: FUNCTION C_DigestEncryptUpdate michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pPart # the plaintext data michael@0: CK_ULONG ulPartLen # plaintext length michael@0: CK_BYTE_PTR pEncryptedPart # gets ciphertext michael@0: CK_ULONG_PTR pulEncryptedPartLen # gets c-text length michael@0: michael@0: # C_DecryptDigestUpdate continues a multiple-part decryption and michael@0: # digesting operation. michael@0: FUNCTION C_DecryptDigestUpdate michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pEncryptedPart # ciphertext michael@0: CK_ULONG ulEncryptedPartLen # ciphertext length michael@0: CK_BYTE_PTR pPart # gets plaintext michael@0: CK_ULONG_PTR pulPartLen # gets plaintext len michael@0: michael@0: # C_SignEncryptUpdate continues a multiple-part signing and michael@0: # encryption operation. michael@0: FUNCTION C_SignEncryptUpdate michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pPart # the plaintext data michael@0: CK_ULONG ulPartLen # plaintext length michael@0: CK_BYTE_PTR pEncryptedPart # gets ciphertext michael@0: CK_ULONG_PTR pulEncryptedPartLen # gets c-text length michael@0: michael@0: # C_DecryptVerifyUpdate continues a multiple-part decryption and michael@0: # verify operation. michael@0: FUNCTION C_DecryptVerifyUpdate michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_BYTE_PTR pEncryptedPart # ciphertext michael@0: CK_ULONG ulEncryptedPartLen # ciphertext length michael@0: CK_BYTE_PTR pPart # gets plaintext michael@0: CK_ULONG_PTR pulPartLen # gets p-text length michael@0: michael@0: michael@0: # Key management michael@0: michael@0: # C_GenerateKey generates a secret key, creating a new key object. michael@0: FUNCTION C_GenerateKey michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # key generation mech. michael@0: CK_ATTRIBUTE_PTR pTemplate # template for new key michael@0: CK_ULONG ulCount # # of attrs in template michael@0: CK_OBJECT_HANDLE_PTR phKey # gets handle of new key michael@0: michael@0: # C_GenerateKeyPair generates a public-key/private-key pair, creating michael@0: # new key objects. michael@0: FUNCTION C_GenerateKeyPair michael@0: CK_SESSION_HANDLE hSession # session handle michael@0: CK_MECHANISM_PTR pMechanism # key-gen mech. michael@0: CK_ATTRIBUTE_PTR pPublicKeyTemplate # template for pub. key michael@0: CK_ULONG ulPublicKeyAttributeCount # # pub. attrs. michael@0: CK_ATTRIBUTE_PTR pPrivateKeyTemplate # template for priv. key michael@0: CK_ULONG ulPrivateKeyAttributeCount # # priv. attrs. michael@0: CK_OBJECT_HANDLE_PTR phPublicKey # gets pub. key handle michael@0: CK_OBJECT_HANDLE_PTR phPrivateKey # gets priv. key handle michael@0: michael@0: # C_WrapKey wraps (i.e., encrypts) a key. michael@0: FUNCTION C_WrapKey michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_MECHANISM_PTR pMechanism # the wrapping mechanism michael@0: CK_OBJECT_HANDLE hWrappingKey # wrapping key michael@0: CK_OBJECT_HANDLE hKey # key to be wrapped michael@0: CK_BYTE_PTR pWrappedKey # gets wrapped key michael@0: CK_ULONG_PTR pulWrappedKeyLen # gets wrapped key size michael@0: michael@0: # C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new key michael@0: # object. michael@0: FUNCTION C_UnwrapKey michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_MECHANISM_PTR pMechanism # unwrapping mech. michael@0: CK_OBJECT_HANDLE hUnwrappingKey # unwrapping key michael@0: CK_BYTE_PTR pWrappedKey # the wrapped key michael@0: CK_ULONG ulWrappedKeyLen # wrapped key len michael@0: CK_ATTRIBUTE_PTR pTemplate # new key template michael@0: CK_ULONG ulAttributeCount # template length michael@0: CK_OBJECT_HANDLE_PTR phKey # gets new handle michael@0: michael@0: # C_DeriveKey derives a key from a base key, creating a new key object. michael@0: FUNCTION C_DeriveKey michael@0: CK_SESSION_HANDLE hSession # session's handle michael@0: CK_MECHANISM_PTR pMechanism # key deriv. mech. michael@0: CK_OBJECT_HANDLE hBaseKey # base key michael@0: CK_ATTRIBUTE_PTR pTemplate # new key template michael@0: CK_ULONG ulAttributeCount # template length michael@0: CK_OBJECT_HANDLE_PTR phKey # gets new handle michael@0: michael@0: michael@0: # Random number generation michael@0: michael@0: # C_SeedRandom mixes additional seed material into the token's random michael@0: # number generator. michael@0: FUNCTION C_SeedRandom michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR pSeed # the seed material michael@0: CK_ULONG ulSeedLen # length of seed material michael@0: michael@0: # C_GenerateRandom generates random data. michael@0: FUNCTION C_GenerateRandom michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: CK_BYTE_PTR RandomData # receives the random data michael@0: CK_ULONG ulRandomLen # # of bytes to generate michael@0: michael@0: michael@0: # Parallel function management michael@0: michael@0: # C_GetFunctionStatus is a legacy function; it obtains an updated michael@0: # status of a function running in parallel with an application. michael@0: FUNCTION C_GetFunctionStatus michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: michael@0: # C_CancelFunction is a legacy function; it cancels a function running michael@0: # in parallel. michael@0: FUNCTION C_CancelFunction michael@0: CK_SESSION_HANDLE hSession # the session's handle michael@0: michael@0: michael@0: # Functions added in for Cryptoki Version 2.01 or later michael@0: michael@0: # C_WaitForSlotEvent waits for a slot event (token insertion, removal, michael@0: # etc.) to occur. michael@0: FUNCTION C_WaitForSlotEvent michael@0: CK_FLAGS flags # blocking/nonblocking flag michael@0: CK_SLOT_ID_PTR pSlot # location that receives the slot ID michael@0: CK_VOID_PTR pRserved # reserved. Should be NULL_PTR michael@0: michael@0: ## C_ConfigureSlot passes an installation-specified bytestring to a michael@0: ## slot. michael@0: #FUNCTION C_ConfigureSlot michael@0: #CK_SLOT_ID slotID # the slot to configure michael@0: #CK_BYTE_PTR pConfig # the configuration string michael@0: #CK_ULONG ulConfigLen # length of the config string