Cryptographic Token Interface Standard

PKCS#11


pkcs11_all.h File Reference

More...

Go to the source code of this file.

Data Structures

 CK_VERSION
 

CK_VERSION; CK_VERSION_PTR

CK_VERSION is a structure that describes the version of a Cryptoki interface, a Cryptoki library, or an SSL implementation, or the hardware or firmware version of a slot or token. More...

 CK_INFO
 

CK_INFO; CK_INFO_PTR

CK_INFO provides general information about Cryptoki. More...

 CK_SLOT_INFO
 

CK_SLOT_INFO; CK_SLOT_INFO_PTR

CK_SLOT_INFO provides information about a slot. More...

 CK_TOKEN_INFO
 

CK_TOKEN_INFO; CK_TOKEN_INFO_PTR

CK_TOKEN_INFO provides information about a token. More...

 CK_SESSION_INFO
 

CK_SESSION_INFO; CK_SESSION_INFO_PTR

CK_SESSION_INFO provides information about a session. More...

 CK_ATTRIBUTE
 

CK_ATTRIBUTE; CK_ATTRIBUTE_PTR

CK_ATTRIBUTE is a structure that includes the type, value, and length of an attribute. More...

 CK_DATE
 

CK_DATE

CK_DATE is a structure that defines a date. More...

 CK_MECHANISM
 

CK_MECHANISM; CK_MECHANISM_PTR

CK_MECHANISM is a structure that specifies a particular mechanism and any parameters it requires. More...

 CK_MECHANISM_INFO
 

CK_MECHANISM_INFO; CK_MECHANISM_INFO_PTR

CK_MECHANISM_INFO is a structure that provides information about a particular mechanism. More...

 CK_FUNCTION_LIST
 

CK_FUNCTION_LIST; CK_FUNCTION_LIST_PTR; CK_FUNCTION_LIST_PTR_PTR

CK_FUNCTION_LIST is a structure which contains a Cryptoki version and a function pointer to each function in the Cryptoki API. More...

 CK_C_INITIALIZE_ARGS
 

CK_C_INITIALIZE_ARGS; CK_C_INITIALIZE_ARGS_PTR

CK_C_INITIALIZE_ARGS is a structure containing the optional arguments for the C_Initialize function. More...

 CK_RSA_PKCS_OAEP_PARAMS
 

CK_RSA_PKCS_OAEP_PARAMS; CK_RSA_PKCS_OAEP_PARAMS_PTR

CK_RSA_PKCS_OAEP_PARAMS is a structure that provides the parameters to the CKM_RSA_PKCS_OAEP mechanism. More...

 CK_RSA_PKCS_PSS_PARAMS
 

CK_RSA_PKCS_PSS_PARAMS; CK_RSA_PKCS_PSS_PARAMS_PTR

CK_RSA_PKCS_PSS_PARAMS is a structure that provides the parameters to the CKM_RSA_PKCS_PSS mechanism. More...

 CK_ECDH1_DERIVE_PARAMS
 

CK_ECDH1_DERIVE_PARAMS, CK_ECDH1_DERIVE_PARAMS_PTR

CK_ECDH1_DERIVE_PARAMS is a structure that provides the parameters for the CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE key derivation mechanisms, where each party contributes one key pair. More...

 CK_ECMQV_DERIVE_PARAMS
 

CK_ ECMQV _DERIVE_PARAMS, CK_ ECMQV _DERIVE_PARAMS_PTR

CK_ ECMQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_ECMQV_DERIVE key derivation mechanism, where each party contributes two key pairs. More...

 CK_X9_42_DH1_DERIVE_PARAMS
 

CK_X9_42_DH1_DERIVE_PARAMS, CK_X9_42_DH1_DERIVE_PARAMS_PTR

CK_X9_42_DH1_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_DH_DERIVE key derivation mechanism, where each party contributes one key pair. More...

 CK_X9_42_DH2_DERIVE_PARAMS
 

CK_X9_42_DH2_DERIVE_PARAMS, CK_X9_42_DH2_DERIVE_PARAMS_PTR

CK_X9_42_DH2_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation mechanisms, where each party contributes two key pairs. More...

 CK_X9_42_MQV_DERIVE_PARAMS
 

CK_X9_42_MQV_DERIVE_PARAMS, CK_X9_42_MQV_DERIVE_PARAMS_PTR

CK_X9_42_MQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_MQV_DERIVE key derivation mechanism, where each party contributes two key pairs. More...

 CK_AES_CTR_PARAMS
 

CK_AES_CTR_PARAMS; CK_AES_CTR_PARAMS_PTR

CK_AES_CTR_PARAMS is a structure that provides the parameters to the CKM_AES_CTR mechanism. More...

 CK_GCM_PARAMS
 

CK_GCM _PARAMS; CK_GCM _PARAMS_PTR

CK_GCM_PARAMS is a structure that provides the parameters to the CKM_AES_GCM mechanism. More...

 CK_CCM_PARAMS
 

CK_CCM _PARAMS; CK_CCM _PARAMS_PTR

CK_CCM_PARAMS is a structure that provides the parameters to the CKM_AES_CCM mechanism. More...

 CK_DES_CBC_ENCRYPT_DATA_PARAMS
 
. More...

 CK_PBE_PARAMS
 

CK_PBE_PARAMS; CK_PBE_PARAMS_PTR

CK_PBE_PARAMS is a structure which provides all of the necessary information required by the CKM_PBE mechanisms (see PKCS #5 and PKCS #12 for information on the PBE generation mechanisms) and the CKM_PBA_SHA1_WITH_SHA1_HMAC mechanism. More...

 CK_PKCS5_PBKD2_PARAMS
 

CK_PKCS5_PBKD2_PARAMS; CK_PKCS5_PBKD2_PARAMS_PTR

CK_PKCS5_PBKD2_PARAMS is a structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism. More...

 CK_SSL3_RANDOM_DATA
 

CK_SSL3_RANDOM_DATA

CK_SSL3_RANDOM_DATA is a structure which provides information about the random data of a client and a server in an SSL context. More...

 CK_SSL3_MASTER_KEY_DERIVE_PARAMS
 CK_SSL3_KEY_MAT_OUT
 

CK_SSL3_KEY_MAT_OUT; CK_SSL3_KEY_MAT_OUT_PTR

CK_SSL3_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. More...

 CK_SSL3_KEY_MAT_PARAMS
 

CK_SSL3_KEY_MAT_PARAMS; CK_SSL3_KEY_MAT_PARAMS_PTR

CK_SSL3_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. More...

 CK_TLS_PRF_PARAMS
 

CK_TLS_PRF_PARAMS; CK_TLS_PRF_PARAMS_PTR

CK_TLS_PRF_PARAMS is a structure, which provides the parameters to the CKM_TLS_PRF mechanism. More...

 CK_WTLS_RANDOM_DATA
 

CK_WTLS_RANDOM_DATA; CK_WTLS_RANDOM_DATA_PTR

CK_WTLS_RANDOM_DATA is a structure, which provides information about the random data of a client and a server in a WTLS context. More...

 CK_WTLS_MASTER_KEY_DERIVE_PARAMS
 

CK_WTLS_MASTER_KEY_DERIVE_PARAMS; CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR

CK_WTLS_MASTER_KEY_DERIVE_PARAMS is a structure, which provides the parameters to the CKM_WTLS_MASTER_KEY_DERIVE mechanism. More...

 CK_WTLS_PRF_PARAMS
 

CK_WTLS_PRF_PARAMS; CK_WTLS_PRF_PARAMS_PTR

CK_WTLS_PRF_PARAMS is a structure, which provides the parameters to the CKM_WTLS_PRF mechanism. More...

 CK_WTLS_KEY_MAT_OUT
 

CK_WTLS_KEY_MAT_OUT; CK_WTLS_KEY_MAT_OUT_PTR

CK_WTLS_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE or with the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanism. More...

 CK_WTLS_KEY_MAT_PARAMS
 

CK_WTLS_KEY_MAT_PARAMS; CK_WTLS_KEY_MAT_PARAMS_PTR

CK_WTLS_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE and the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanisms. More...

 CK_KEY_DERIVATION_STRING_DATA
 

CK_KEY_DERIVATION_STRING_DATA; CK_KEY_DERIVATION_STRING_DATA_PTR

. More...

 CK_CMS_SIG_PARAMS
 

CK_CMS_SIG_PARAMS, CK_CMS_SIG_PARAMS_PTR

CK_CMS_SIG_PARAMS is a structure that provides the parameters to the CKM_CMS_SIG mechanism. More...

 CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS
 Mechanisms:. More...

 CK_ARIA_CBC_ENCRYPT_DATA_PARAMS
 Mechanisms:. More...

 CK_OTP_PARAM
 

CK_OTP_PARAM; CK_OTP_PARAM_PTR

CK_OTP_PARAM is a structure that includes the type, value, and length of an OTP parameter. More...

 CK_OTP_PARAMS
 CK_OTP_PARAMS; CK_OTP_PARAMS_PTR CK_OTP_PARAMS is a structure that is used to provide parameters for OTP mechanisms in a generic fashion. More...

 CK_OTP_SIGNATURE_INFO
 CK_OTP_SIGNATURE_INFO, CK_OTP_SIGNATURE_INFO_PTR CK_OTP_SIGNATURE_INFO is a structure that is returned by all OTP mechanisms in successful calls to C_Sign (C_SignFinal). More...

 CK_KIP_PARAMS
 

CK_KIP_ PARAMS; CK_KIP_ PARAMS_PTR

CK_KIP_PARAMS is a structure that provides the parameters to all the CT-KIP related mechanisms: The CKM_KIP_DERIVE key derivation mechanism, the CKM_KIP_WRAP key wrap and key unwrap mechanism, and the CKM_KIP_MAC signature mechanism. More...

 CK_GOSTR3410_KEY_WRAP_PARAMS
 CK_GOSTR3410_KEY_WRAP_PARAMS is a structure that provides the parameters to the CKM_GOSTR3410_KEY_WRAP mechanism. More...

 CK_GOSTR3410_DERIVE_PARAMS
 CK_GOSTR3410_DERIVE_PARAMS is a structure that provides the parameters to the CKM_GOSTR3410_DERIVE mechanism. More...

 CK_KEA_DERIVE_PARAMS
 CK_RC2_CBC_PARAMS
 

CK_RC2_CBC_PARAMS; CK_RC2_CBC_PARAMS_PTR

CK_RC2_CBC_PARAMS is a structure that provides the parameters to the CKM_RC2_CBC and CKM_RC2_CBC_PAD mechanisms. More...

 CK_RC2_MAC_GENERAL_PARAMS
 

CK_RC2_MAC_GENERAL_PARAMS; CK_RC2_MAC_GENERAL_PARAMS_PTR

CK_RC2_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC2_MAC_GENERAL mechanism. More...

 CK_RC5_PARAMS
 

CK_RC5_PARAMS; CK_RC5_PARAMS_PTR

CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and CKM_RC5_MAC mechanisms. More...

 CK_RC5_CBC_PARAMS
 

CK_RC5_CBC_PARAMS; CK_RC5_CBC_PARAMS_PTR

CK_RC5_CBC_PARAMS is a structure that provides the parameters to the CKM_RC5_CBC and CKM_RC5_CBC_PAD mechanisms. More...

 CK_RC5_MAC_GENERAL_PARAMS
 

CK_RC5_MAC_GENERAL_PARAMS; CK_RC5_MAC_GENERAL_PARAMS_PTR

CK_RC5_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC5_MAC_GENERAL mechanism. More...

 CK_SKIPJACK_PRIVATE_WRAP_PARAMS
 

CK_SKIPJACK_PRIVATE_WRAP_PARAMS; CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR

CK_SKIPJACK_PRIVATE_WRAP_PARAMS is a structure that provides the parameters to the CKM_SKIPJACK_PRIVATE_WRAP mechanism. More...

 CK_SKIPJACK_RELAYX_PARAMS
 

CK_SKIPJACK_RELAYX_PARAMS; CK_SKIPJACK_RELAYX_PARAMS_PTR

CK_SKIPJACK_RELAYX_PARAMS is a structure that provides the parameters to the CKM_SKIPJACK_RELAYX mechanism. More...

 CK_PBE_PARAMS
 

CK_PBE_PARAMS; CK_PBE_PARAMS_PTR

CK_PBE_PARAMS is a structure which provides all of the necessary information required by the CKM_PBE mechanisms (see PKCS #5 and PKCS #12 for information on the PBE generation mechanisms) and the CKM_PBA_SHA1_WITH_SHA1_HMAC mechanism. More...

 CK_KEY_WRAP_SET_OAEP_PARAMS
 

CK_KEY_WRAP_SET_OAEP_PARAMS; CK_KEY_WRAP_SET_OAEP_PARAMS_PTR

CK_KEY_WRAP_SET_OAEP_PARAMS is a structure that provides the parameters to the CKM_KEY_WRAP_SET_OAEP mechanism. More...


Defines

#define CK_INVALID_HANDLE
 An invalid handle. More...

#define CK_TRUE
 CK_BBOOL true. More...

#define CK_FALSE
 CK_BBOOL false. More...

#define CK_UNAVAILABLE_INFORMATION
 Information unavailable. More...

#define CK_EFFECTIVELY_INFINITE
 Effectively infinite. More...

#define CKU_SO
 Security Officer. More...

#define CKU_USER
 User. More...

#define CKU_CONTEXT_SPECIFIC
 Context specific. More...

#define CKS_RO_PUBLIC_SESSION
 Read only public session. More...

#define CKS_RO_USER_FUNCTIONS
 Read only user functions. More...

#define CKS_RW_PUBLIC_SESSION
 Read write public session. More...

#define CKS_RW_USER_FUNCTIONS
 Read write user functions. More...

#define CKS_RW_SO_FUNCTIONS
 Read write security officer functions. More...

#define TRUE
 True. More...

#define FALSE
 False. More...

#define CKF_TOKEN_PRESENT
 True if a token is present in the slot (''e.g.'', a device is in the reader). More...

#define CKF_REMOVABLE_DEVICE
 True if the reader supports removable devices. More...

#define CKF_HW_SLOT
 True if the slot is a hardware slot, as opposed to a software slot implementing a "soft token". More...

#define CKF_RNG
 True if the token has its own random number generator. More...

#define CKF_WRITE_PROTECTED
 True if the token is write-protected (see below). More...

#define CKF_LOGIN_REQUIRED
 True if there are some cryptographic functions that a user must be logged in to perform. More...

#define CKF_USER_PIN_INITIALIZED
 True if the normal user's PIN has been initialized. More...

#define CKF_RESTORE_KEY_NOT_NEEDED
 True if a successful save of a session's cryptographic operations state ''always'' contains all keys needed to restore the state of the session. More...

#define CKF_CLOCK_ON_TOKEN
 True if token has its own hardware clock. More...

#define CKF_PROTECTED_AUTHENTICATION_PATH
 True if token has a "protected authentication path", whereby a user can log into the token without passing a PIN through the Cryptoki library. More...

#define CKF_DUAL_CRYPTO_OPERATIONS
 True if a single session with the token can perform dual cryptographic operations (see Section 11.13). More...

#define CKF_TOKEN_INITIALIZED
 True if the token has been initialized using C_InitToken or an equivalent mechanism outside the scope of this standard. More...

#define CKF_SECONDARY_AUTHENTICATION
 True if the token supports secondary authentication for private key objects. More...

#define CKF_USER_PIN_COUNT_LOW
 True if an incorrect user login PIN has been entered at least once since the last successful authentication. More...

#define CKF_USER_PIN_FINAL_TRY
 True if supplying an incorrect user PIN will cause it to become locked. More...

#define CKF_USER_PIN_LOCKED
 True if the user PIN has been locked. More...

#define CKF_USER_PIN_TO_BE_CHANGED
 True if the user PIN value is the default value set by token initialization or manufacturing, or the PIN has been expired by the card. More...

#define CKF_SO_PIN_COUNT_LOW
 True if an incorrect SO login PIN has been entered at least once since the last successful authentication. More...

#define CKF_SO_PIN_FINAL_TRY
 True if supplying an incorrect SO PIN will cause it to become locked. More...

#define CKF_SO_PIN_LOCKED
 True if the SO PIN has been locked. More...

#define CKF_SO_PIN_TO_BE_CHANGED
 True if the SO PIN value is the default value set by token initialization or manufacturing, or the PIN has been expired by the card. More...

#define CKF_ERROR_STATE
 True if the token failed a FIPS 140-2 self-test and entered an error state. More...

#define CKF_RW_SESSION
 True if the session is read/write; false if the session is read-only. More...

#define CKF_SERIAL_SESSION
 This flag is provided for backward compatibility, and should always be set to true. More...

#define CKF_HW
 True if the mechanism is performed by the device; false if the mechanism is performed in software. More...

#define CKF_ENCRYPT
 True if the mechanism can be used with '''C_EncryptInit'''. More...

#define CKF_DECRYPT
 True if the mechanism can be used with '''C_DecryptInit'''. More...

#define CKF_DIGEST
 True if the mechanism can be used with '''C_DigestInit'''. More...

#define CKF_SIGN
 True if the mechanism can be used with '''C_SignInit'''. More...

#define CKF_SIGN_RECOVER
 True if the mechanism can be used with '''C_SignRecoverInit'''. More...

#define CKF_VERIFY
 True if the mechanism can be used with '''C_VerifyInit'''. More...

#define CKF_VERIFY_RECOVER
 True if the mechanism can be used with '''C_VerifyRecoverInit'''. More...

#define CKF_GENERATE
 True if the mechanism can be used with '''C_GenerateKey'''. More...

#define CKF_GENERATE_KEY_PAIR
 True if the mechanism can be used with '''C_GenerateKeyPair'''. More...

#define CKF_WRAP
 True if the mechanism can be used with '''C_WrapKey'''. More...

#define CKF_UNWRAP
 True if the mechanism can be used with '''C_UnwrapKey'''. More...

#define CKF_DERIVE
 True if the mechanism can be used with '''C_DeriveKey'''. More...

#define CKF_EXTENSION
 True if there is an extension to the flags; false if no extensions. More...

#define CKF_LIBRARY_CANT_CREATE_OS_THREADS
 True if application threads which are executing calls to the library may ''not'' use native operating system calls to spawn new threads; false if they may. More...

#define CKF_OS_LOCKING_OK
 True if the library can use the native operation system threading model for locking; false otherwise. More...

#define CKA_CLASS
 Object class (type). More...

#define CKA_HW_FEATURE_TYPE
 Hardware feature (type). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_RESET_ON_INIT
 The value of the counter will reset to a previously returned value if the token is initialized using '''C_InitToken'''. More...

#define CKA_HAS_RESET
 The value of the counter has been reset at least once at some point in time. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PIXEL_X
 Screen resolution (in pixels) in X-axis (e.g. More...

#define CKA_PIXEL_Y
 Screen resolution (in pixels) in Y-axis (e.g. More...

#define CKA_RESOLUTION
 DPI, pixels per inch. More...

#define CKA_CHAR_ROWS
 For character-oriented displays; number of character rows (e.g. More...

#define CKA_CHAR_COLUMNS
 For character-oriented displays: number of character columns (e.g. More...

#define CKA_COLOR
 Color support. More...

#define CKA_BITS_PER_PIXEL
 The number of bits of color or grayscale information per pixel. More...

#define CKA_CHAR_SETS
 String indicating supported character sets, as defined by IANA MIBenum sets (www.iana.org). More...

#define CKA_ENCODING_METHODS
 String indicating supported content transfer encoding methods, as defined by IANA (www.iana.org). More...

#define CKA_MIME_TYPES
 String indicating supported (presentable) MIME-types, as defined by IANA (www.iana.org). More...

#define CKA_TOKEN
 CK_TRUE if object is a token object; CK_FALSE if object is a session object. More...

#define CKA_PRIVATE
 CK_TRUE if object is a private object; CK_FALSE if object is a public object. More...

#define CKA_MODIFIABLE
 CK_TRUE if object can be modified Default is CK_TRUE. More...

#define CKA_LABEL
 Description of the object (default empty). More...

#define CKA_COPYABLE
 CK_TRUE if object can be copied using C_CopyObject. More...

#define CKA_APPLICATION
 Description of the application that manages the object (default empty). More...

#define CKA_OBJECT_ID
 DER-encoding of the object identifier indicating the data object type (default empty). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_CERTIFICATE_TYPE
 Type of certificate. More...

#define CKA_TRUSTED
 The certificate can be trusted for the application that it was created. More...

#define CKA_CERTIFICATE_CATEGORY
 Categorization of the certificate:0 = unspecified (default value), 1 = token user, 2 = authority, 3 = other entity. More...

#define CKA_CHECK_VALUE
 Checksum. More...

#define CKA_START_DATE
 Start date for the certificate (default empty). More...

#define CKA_END_DATE
 End date for the certificate (default empty). More...

#define CKA_SUBJECT
 DER-encoding of the certificate subject name. More...

#define CKA_ID
 Key identifier for public/private key pair (default empty). More...

#define CKA_ISSUER
 DER-encoding of the certificate issuer name (default empty). More...

#define CKA_SERIAL_NUMBER
 DER-encoding of the certificate serial number (default empty). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_URL
 If not empty this attribute gives the URL where the complete certificate can be obtained (default empty). More...

#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY
 Hash of the subject public key (default empty). More...

#define CKA_HASH_OF_ISSUER_PUBLIC_KEY
 Hash of the issuer public key (default empty). More...

#define CKA_JAVA_MIDP_SECURITY_DOMAIN
 Java MIDP security domain: 0 = unspecified (default value), 1 = manufacturer, 2 = operator, 3 = third party. More...

#define CKA_NAME_HASH_ALGORITHM
 Defines the mechanism used to calculate CKA_HASH_OF_SUBJECT_PUBLIC_KEY and CKA_HASH_OF_ISSUER_PUBLIC_KEY. More...

#define CKA_SUBJECT
 DER-encoding of the certificate subject name. More...

#define CKA_ISSUER
 DER-encoding of the certificate issuer name (default empty). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_URL
 If not empty this attribute gives the URL where the complete certificate can be obtained (default empty). More...

#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY
 Hash of the subject public key (default empty). More...

#define CKA_HASH_OF_ISSUER_PUBLIC_KEY
 Hash of the issuer public key (default empty). More...

#define CKA_NAME_HASH_ALGORITHM
 Defines the mechanism used to calculate CKA_HASH_OF_SUBJECT_PUBLIC_KEY and CKA_HASH_OF_ISSUER_PUBLIC_KEY. More...

#define CKA_OWNER
 DER-encoding of the attribute certificate's subject field. More...

#define CKA_AC_ISSUER
 DER-encoding of the attribute certificate's issuer field. More...

#define CKA_SERIAL_NUMBER
 DER-encoding of the certificate serial number (default empty). More...

#define CKA_ATTR_TYPES
 BER-encoding of a sequence of object identifier values corresponding to the attribute types contained in the certificate. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_KEY_TYPE
 Type of key. More...

#define CKA_ID
 Key identifier for public/private key pair (default empty). More...

#define CKA_START_DATE
 Start date for the certificate (default empty). More...

#define CKA_END_DATE
 End date for the certificate (default empty). More...

#define CKA_DERIVE
 CK_TRUE if key supports key derivation (''i.e.'', if other keys can be derived from this one (default CK_FALSE). More...

#define CKA_LOCAL
 CK_TRUE only if key was either * generated locally (''i.e.'', on the token) with a '''C_GenerateKey''' or '''C_GenerateKeyPair''' call * created with a '''C_CopyObject''' call as a copy of a key which had its '''CKA_LOCAL''' attribute set to CK_TRUE. More...

#define CKA_KEY_GEN_MECHANISM
 Identifier of the mechanism used to generate the key material. More...

#define CKA_ALLOWED_MECHANISMS
 A list of mechanisms allowed to be used with this key. More...

#define CKA_SUBJECT
 DER-encoding of the certificate subject name. More...

#define CKA_ENCRYPT
 CK_TRUE if key supports encryption9. More...

#define CKA_VERIFY
 CK_TRUE if key supports verification where the signature is an appendix to the data9. More...

#define CKA_VERIFY_RECOVER
 CK_TRUE if key supports verification where the data is recovered from the signature9. More...

#define CKA_WRAP
 CK_TRUE if key supports wrapping (''i.e.'', can be used to wrap other keys)9. More...

#define CKA_TRUSTED
 The certificate can be trusted for the application that it was created. More...

#define CKA_WRAP_TEMPLATE
 For wrapping keys. More...

#define CKA_SUBJECT
 DER-encoding of the certificate subject name. More...

#define CKA_SENSITIVE
 CK_TRUE if key is sensitive9 . More...

#define CKA_DECRYPT
 CK_TRUE if key supports decryption9. More...

#define CKA_SIGN
 CK_TRUE if key supports signatures where the signature is an appendix to the data9. More...

#define CKA_SIGN_RECOVER
 CK_TRUE if key supports signatures where the data can be recovered from the signature9. More...

#define CKA_UNWRAP
 CK_TRUE if key supports unwrapping (''i.e.'', can be used to unwrap other keys)9. More...

#define CKA_EXTRACTABLE
 CK_TRUE if key is extractable and can be wrapped 9. More...

#define CKA_ALWAYS_SENSITIVE
 CK_TRUE if key has ''always'' had the CKA_SENSITIVE attribute set to CK_TRUE. More...

#define CKA_NEVER_EXTRACTABLE
 CK_TRUE if key has ''never'' had the CKA_EXTRACTABLE attribute set to CK_TRUE. More...

#define CKA_WRAP_WITH_TRUSTED
 CK_TRUE if the key can only be wrapped with a wrapping key that has CKA_TRUSTED set to CK_TRUE. More...

#define CKA_UNWRAP_TEMPLATE
 For wrapping keys. More...

#define CKA_ALWAYS_AUTHENTICATE
 If CK_TRUE, the user has to supply the PIN for each use (sign or decrypt) with the key. More...

#define CKA_SENSITIVE
 CK_TRUE if key is sensitive9 . More...

#define CKA_ENCRYPT
 CK_TRUE if key supports encryption9. More...

#define CKA_DECRYPT
 CK_TRUE if key supports decryption9. More...

#define CKA_SIGN
 CK_TRUE if key supports signatures where the signature is an appendix to the data9. More...

#define CKA_VERIFY
 CK_TRUE if key supports verification where the signature is an appendix to the data9. More...

#define CKA_WRAP
 CK_TRUE if key supports wrapping (''i.e.'', can be used to wrap other keys)9. More...

#define CKA_UNWRAP
 CK_TRUE if key supports unwrapping (''i.e.'', can be used to unwrap other keys)9. More...

#define CKA_EXTRACTABLE
 CK_TRUE if key is extractable and can be wrapped 9. More...

#define CKA_ALWAYS_SENSITIVE
 CK_TRUE if key has ''always'' had the CKA_SENSITIVE attribute set to CK_TRUE. More...

#define CKA_NEVER_EXTRACTABLE
 CK_TRUE if key has ''never'' had the CKA_EXTRACTABLE attribute set to CK_TRUE. More...

#define CKA_CHECK_VALUE
 Checksum. More...

#define CKA_WRAP_WITH_TRUSTED
 CK_TRUE if the key can only be wrapped with a wrapping key that has CKA_TRUSTED set to CK_TRUE. More...

#define CKA_TRUSTED
 The certificate can be trusted for the application that it was created. More...

#define CKA_WRAP_TEMPLATE
 For wrapping keys. More...

#define CKA_UNWRAP_TEMPLATE
 For wrapping keys. More...

#define CKA_KEY_TYPE
 Type of key. More...

#define CKA_LOCAL
 CK_TRUE only if key was either * generated locally (''i.e.'', on the token) with a '''C_GenerateKey''' or '''C_GenerateKeyPair''' call * created with a '''C_CopyObject''' call as a copy of a key which had its '''CKA_LOCAL''' attribute set to CK_TRUE. More...

#define CKA_MECHANISM_TYPE
 The type of mechanism object. More...

#define CKR_GENERAL_ERROR
 Some horrible, unrecoverable error has occurred. More...

#define CKR_HOST_MEMORY
 The computer that the Cryptoki library is running on has insufficient memory to perform the requested function. More...

#define CKR_FUNCTION_FAILED
 The requested function could not be performed, but detailed information about why not is not available in this error return. More...

#define CKR_OK
 The function executed successfully. More...

#define CKR_SESSION_HANDLE_INVALID
 The specified session handle was invalid ''at the time that the function was invoked''. More...

#define CKR_DEVICE_REMOVED
 The token was removed from its slot ''during the execution of the function''. More...

#define CKR_SESSION_CLOSED
 The session was closed ''during the execution of the function''. More...

#define CKR_DEVICE_MEMORY
 The token does not have sufficient memory to perform the requested function. More...

#define CKR_DEVICE_ERROR
 Some problem has occurred with the token and/or slot. More...

#define CKR_TOKEN_NOT_PRESENT
 The token was not present in its slot ''at the time that the function was invoked''. More...

#define CKR_DEVICE_REMOVED
 The token was removed from its slot ''during the execution of the function''. More...

#define CKR_CANCEL
 When a function executing in serial with an application decides to give the application a chance to do some work, it calls an application-supplied function with a CKN_SURRENDER callback (see Section 11.17). More...

#define CKR_MUTEX_BAD
 This error code can be returned by mutex-handling functions who are passed a bad mutex object as an argument. More...

#define CKR_MUTEX_NOT_LOCKED
 This error code can be returned by mutex-unlocking functions. More...

#define CKR_ARGUMENTS_BAD
 This is a rather generic error code which indicates that the arguments supplied to the Cryptoki function were in some way not appropriate. More...

#define CKR_ATTRIBUTE_READ_ONLY
 An attempt was made to set a value for an attribute which may not be set by the application, or which may not be modified by the application. More...

#define CKR_ATTRIBUTE_SENSITIVE
 An attempt was made to obtain the value of an attribute of an object which cannot be satisfied because the object is either sensitive or unextractable. More...

#define CKR_ATTRIBUTE_TYPE_INVALID
 An invalid attribute type was specified in a template. More...

#define CKR_ATTRIBUTE_VALUE_INVALID
 An invalid value was specified for a particular attribute in a template. More...

#define CKR_BUFFER_TOO_SMALL
 The output of the function is too large to fit in the supplied buffer. More...

#define CKR_CANT_LOCK
 This value can only be returned by '''C_Initialize'''. More...

#define CKR_CRYPTOKI_ALREADY_INITIALIZED
 This value can only be returned by '''C_Initialize'''. More...

#define CKR_CRYPTOKI_NOT_INITIALIZED
 This value can be returned by any function other than '''C_Initialize''' and '''C_GetFunctionList'''. More...

#define CKR_DATA_INVALID
 The plaintext input data to a cryptographic operation is invalid. More...

#define CKR_DATA_LEN_RANGE
 The plaintext input data to a cryptographic operation has a bad length. More...

#define CKR_DOMAIN_PARAMS_INVALID
 Invalid or unsupported domain parameters were supplied to the function. More...

#define CKR_ENCRYPTED_DATA_INVALID
 The encrypted input to a decryption operation has been determined to be invalid ciphertext. More...

#define CKR_ENCRYPTED_DATA_LEN_RANGE
 The ciphertext input to a decryption operation has been determined to be invalid ciphertext solely on the basis of its length. More...

#define CKR_EXCEEDED_MAX_ITERATIONS
 An iterative algorithm (for key pair generation, domain parameter generation etc.) failed because we have exceeded the maximum number of iterations. More...

#define CKR_FIPS_SELF_TEST_FAILED
 A FIPS 140-2 power-up self-test or conditional self-test failed. More...

#define CKR_FUNCTION_CANCELED
 The function was canceled in mid-execution. More...

#define CKR_FUNCTION_NOT_PARALLEL
 There is currently no function executing in parallel in the specified session. More...

#define CKR_FUNCTION_NOT_SUPPORTED
 The requested function is not supported by this Cryptoki library. More...

#define CKR_FUNCTION_REJECTED
 The signature request is rejected by the user. More...

#define CKR_INFORMATION_SENSITIVE
 The information requested could not be obtained because the token considers it sensitive, and is not able or willing to reveal it. More...

#define CKR_KEY_CHANGED
 This value is only returned by '''C_SetOperationState'''. More...

#define CKR_KEY_FUNCTION_NOT_PERMITTED
 An attempt has been made to use a key for a cryptographic purpose that the key's attributes are not set to allow it to do. More...

#define CKR_KEY_HANDLE_INVALID
 The specified key handle is not valid. More...

#define CKR_KEY_INDIGESTIBLE
 This error code can only be returned by '''C_DigestKey'''. More...

#define CKR_KEY_NEEDED
 This value is only returned by '''C_SetOperationState'''. More...

#define CKR_KEY_NOT_NEEDED
 An extraneous key was supplied to '''C_SetOperationState'''. More...

#define CKR_KEY_NOT_WRAPPABLE
 Although the specified private or secret key does not have its CKA_EXTRACTABLE attribute set to CK_FALSE, Cryptoki (or the token) is unable to wrap the key as requested (possibly the token can only wrap a given key with certain types of keys, and the wrapping key specified is not one of these types). More...

#define CKR_KEY_SIZE_RANGE
 Although the requested keyed cryptographic operation could in principle be carried out, this Cryptoki library (or the token) is unable to actually do it because the supplied key's size is outside the range of key sizes that it can handle. More...

#define CKR_KEY_TYPE_INCONSISTENT
 The specified key is not the correct type of key to use with the specified mechanism. More...

#define CKR_KEY_UNEXTRACTABLE
 The specified private or secret key can't be wrapped because its CKA_EXTRACTABLE attribute is set to CK_FALSE. More...

#define CKR_LIBRARY_LOAD_FAILED
 The Cryptoki library could not load a dependent shared library. More...

#define CKR_MECHANISM_INVALID
 An invalid mechanism was specified to the cryptographic operation. More...

#define CKR_MECHANISM_PARAM_INVALID
 Invalid parameters were supplied to the mechanism specified to the cryptographic operation. More...

#define CKR_NEED_TO_CREATE_THREADS
 This value can only be returned by '''C_Initialize'''. More...

#define CKR_NO_EVENT
 This value can only be returned by '''C_GetSlotEvent'''. More...

#define CKR_OBJECT_HANDLE_INVALID
 The specified object handle is not valid. More...

#define CKR_OPERATION_ACTIVE
 There is already an active operation (or combination of active operations) which prevents Cryptoki from activating the specified operation. More...

#define CKR_OPERATION_NOT_INITIALIZED
 There is no active operation of an appropriate type in the specified session. More...

#define CKR_PIN_EXPIRED
 The specified PIN has expired, and the requested operation cannot be carried out unless C_SetPIN is called to change the PIN value. More...

#define CKR_PIN_INCORRECT
 The specified PIN is incorrect, ''i.e.'', does not match the PIN stored on the token. More...

#define CKR_PIN_INVALID
 The specified PIN has invalid characters in it. More...

#define CKR_PIN_LEN_RANGE
 The specified PIN is too long or too short. More...

#define CKR_PIN_LOCKED
 The specified PIN is "locked", and cannot be used. More...

#define CKR_PIN_TOO_WEAK
 The specified PIN is too weak so that it could be easy to guess. More...

#define CKR_PUBLIC_KEY_INVALID
 The public key fails a public key validation. More...

#define CKR_RANDOM_NO_RNG
 This value can be returned by '''C_SeedRandom''' and '''C_GenerateRandom'''. More...

#define CKR_RANDOM_SEED_NOT_SUPPORTED
 This value can only be returned by '''C_SeedRandom'''. More...

#define CKR_SAVED_STATE_INVALID
 This value can only be returned by '''C_SetOperationState'''. More...

#define CKR_SESSION_COUNT
 This value can only be returned by '''C_OpenSession'''. More...

#define CKR_SESSION_EXISTS
 This value can only be returned by '''C_InitToken'''. More...

#define CKR_SESSION_PARALLEL_NOT_SUPPORTED
 The specified token does not support parallel sessions. More...

#define CKR_SESSION_READ_ONLY
 The specified session was unable to accomplish the desired action because it is a read-only session. More...

#define CKR_SESSION_READ_ONLY_EXISTS
 A read-only session already exists, and so the SO cannot be logged in. More...

#define CKR_SESSION_READ_WRITE_SO_EXISTS
 A read/write SO session already exists, and so a read-only session cannot be opened. More...

#define CKR_SIGNATURE_LEN_RANGE
 The provided signature/MAC can be seen to be invalid solely on the basis of its length. More...

#define CKR_SIGNATURE_INVALID
 The provided signature/MAC is invalid. More...

#define CKR_SLOT_ID_INVALID
 The specified slot ID is not valid. More...

#define CKR_STATE_UNSAVEABLE
 The cryptographic operations state of the specified session cannot be saved for some reason (possibly the token is simply unable to save the current state). More...

#define CKR_TEMPLATE_INCOMPLETE
 The template specified for creating an object is incomplete, and lacks some necessary attributes. More...

#define CKR_TEMPLATE_INCONSISTENT
 The template specified for creating an object has conflicting attributes. More...

#define CKR_TOKEN_NOT_RECOGNIZED
 The Cryptoki library and/or slot does not recognize the token in the slot. More...

#define CKR_TOKEN_WRITE_PROTECTED
 The requested action could not be performed because the token is write-protected. More...

#define CKR_UNWRAPPING_KEY_HANDLE_INVALID
 This value can only be returned by '''C_UnwrapKey'''. More...

#define CKR_UNWRAPPING_KEY_SIZE_RANGE
 This value can only be returned by '''C_UnwrapKey'''. More...

#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
 This value can only be returned by '''C_UnwrapKey'''. More...

#define CKR_USER_ALREADY_LOGGED_IN
 This value can only be returned by '''C_Login'''. More...

#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN
 This value can only be returned by '''C_Login'''. More...

#define CKR_USER_NOT_LOGGED_IN
 The desired action cannot be performed because the appropriate user (or ''an'' appropriate user) is not logged in. More...

#define CKR_USER_PIN_NOT_INITIALIZED
 This value can only be returned by '''C_Login'''. More...

#define CKR_USER_TOO_MANY_TYPES
 An attempt was made to have more distinct users simultaneously logged into the token than the token and/or library permits. More...

#define CKR_USER_TYPE_INVALID
 An invalid value was specified as a '''CK_USER_TYPE'''. More...

#define CKR_WRAPPED_KEY_INVALID
 This value can only be returned by '''C_UnwrapKey'''. More...

#define CKR_WRAPPED_KEY_LEN_RANGE
 This value can only be returned by '''C_UnwrapKey'''. More...

#define CKR_WRAPPING_KEY_HANDLE_INVALID
 This value can only be returned by '''C_WrapKey'''. More...

#define CKR_WRAPPING_KEY_SIZE_RANGE
 This value can only be returned by '''C_WrapKey'''. More...

#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT
 This value can only be returned by '''C_WrapKey'''. More...

#define CKA_MODULUS
 Modulus ''n''. More...

#define CKA_MODULUS_BITS
 Length in bits of modulus ''n''. More...

#define CKA_PUBLIC_EXPONENT
 Public exponent ''e''. More...

#define CKA_MODULUS
 Modulus ''n''. More...

#define CKA_PUBLIC_EXPONENT
 Public exponent ''e''. More...

#define CKA_PRIVATE_EXPONENT
 Private exponent ''d''. More...

#define CKA_PRIME_1
 Prime ''p''. More...

#define CKA_PRIME_2
 Prime ''q''. More...

#define CKA_EXPONENT_1
 Private exponent ''d'' modulo ''p''-1. More...

#define CKA_EXPONENT_2
 Private exponent ''d'' modulo ''q''-1. More...

#define CKA_COEFFICIENT
 CRT coefficient ''q''-1 mod ''p''. More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_PRIME_BITS
 Length of the prime value. More...

#define CKA_EC_PARAMS
 DER-encoding of an ANSI X9.62 Parameters value. More...

#define CKA_EC_POINT
 DER-encoding of ANSI X9.62 ECPoint value ''Q''. More...

#define CKA_EC_PARAMS
 DER-encoding of an ANSI X9.62 Parameters value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_BITS
 Length in bits of private value ''x''. More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_PRIME_BITS
 Length of the prime value. More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_PRIME_BITS
 Length of the prime value. More...

#define CKA_SUBPRIME_BITS
 Length of the subprime value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_REQUIRED_CMS_ATTRIBUTES
 Attributes the token always will include in the set of CMS signed attributes. More...

#define CKA_DEFAULT_CMS_ATTRIBUTES
 Attributes the token will include in the set of CMS signed attributes in the absence of any attributes specified by the application. More...

#define CKA_SUPPORTED_CMS_ATTRIBUTES
 Attributes the token may include in the set of CMS signed attributes upon request by the application. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_OTP_FORMAT
 Format of OTP values produced with this key: CK_OTP_FORMAT_DECIMAL = Decimal (default) (UTF8-encoded) CK_OTP_FORMAT_HEXADECIMAL = Hexadecimal (UTF8-encoded) CK_OTP_FORMAT_ALPHANUMERIC = Alphanumeric (UTF8-encoded) CK_OTP_FORMAT_BINARY = Only binary values. More...

#define CKA_OTP_LENGTH
 Default length of OTP values (in the CKA_OTP_FORMAT) produced with this key. More...

#define CKA_OTP_USER_FRIENDLY_MODE
 Set to CK_TRUE when the token is capable of returning OTPs suitable for human consumption. More...

#define CKA_OTP_CHALLENGE_REQUIREMENT
 Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A challenge must be supplied. More...

#define CKA_OTP_TIME_REQUIREMENT
 Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A time value must be supplied. More...

#define CKA_OTP_COUNTER_REQUIREMENT
 Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A counter value must be supplied. More...

#define CKA_OTP_PIN_REQUIREMENT
 Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A PIN value must be supplied. More...

#define CKA_OTP_COUNTER
 Value of the associated internal counter. More...

#define CKA_OTP_TIME
 Value of the associated internal UTC time in the form YYYYMMDDhhmmss. More...

#define CKA_OTP_USER_IDENTIFIER
 Text string that identifies a user associated with the OTP key (may be used to enhance the user experience). More...

#define CKA_OTP_SERVICE_IDENTIFIER
 Text string that identifies a service that may validate OTPs generated by this key. More...

#define CKA_OTP_SERVICE_LOGO
 Logotype image that identifies a service that may validate OTPs generated by this key. More...

#define CKA_OTP_SERVICE_LOGO_TYPE
 MIME type of the CKA_OTP_SERVICE_LOGO attribute value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CK_OTP_PIN
 A UTF8 string containing a PIN for use when computing or verifying PIN-based OTP values. More...

#define CK_OTP_CHALLENGE
 Challenge to use when computing or verifying challenge-based OTP values. More...

#define CK_OTP_TIME
 UTC time value in the form YYYYMMDDhhmmss to use when computing or verifying time-based OTP values. More...

#define CK_OTP_COUNTER
 Counter value to use when computing or verifying counter-based OTP values. More...

#define CK_OTP_FLAGS
 Bit flags indicating the characteristics of the sought OTP as defined below. More...

#define CK_OTP_OUTPUT_LENGTH
 Desired output length (overrides any default value). More...

#define CK_OTP_FORMAT
 Returned OTP format (allowed values are the same as for CKA_OTP_FORMAT). More...

#define CK_OTP_VALUE
 An actual OTP value. More...

#define CKF_NEXT_OTP
 True (i.e. More...

#define CKF_EXCLUDE_TIME
 True (i.e. More...

#define CKF_EXCLUDE_COUNTER
 True (i.e. More...

#define CKF_EXCLUDE_CHALLENGE
 True (i.e. More...

#define CKF_EXCLUDE_PIN
 True (i.e. More...

#define CKF_USER_FRIENDLY_OTP
 True (i.e. More...

#define CKA_OTP_TIME_INTERVAL
 Interval between OTP values produced with this key, in seconds. More...

#define CKR_NEW_PIN_MODE
 The supplied OTP was not accepted and the library requests a new OTP computed using a new PIN. More...

#define CKR_NEXT_OTP
 The supplied OTP was correct but indicated a larger than normal drift in the token's internal state (e.g. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_GOST28147_PARAMS
 DER-encoding of the object identifier indicating the data object type of GOST 28147-89. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_OBJECT_ID
 DER-encoding of the object identifier indicating the data object type (default empty). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_OBJECT_ID
 DER-encoding of the object identifier indicating the data object type (default empty). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_GOSTR3410PARAMS
 DER-encoding of the object identifier indicating the data object type of GOST R 34.10-2001. More...

#define CKA_GOSTR3411PARAMS
 DER-encoding of the object identifier indicating the data object type of GOST R 34.11-94. More...

#define CKA_GOST28147_PARAMS
 DER-encoding of the object identifier indicating the data object type of GOST 28147-89. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_GOSTR3410PARAMS
 DER-encoding of the object identifier indicating the data object type of GOST R 34.10-2001. More...

#define CKA_GOSTR3411PARAMS
 DER-encoding of the object identifier indicating the data object type of GOST R 34.11-94. More...

#define CKA_GOST28147_PARAMS4
 DER-encoding of the object identifier indicating the data object type of GOST 28147-89. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_OBJECT_ID
 DER-encoding of the object identifier indicating the data object type (default empty). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_PRIME
 Prime ''p'' (512 to 1024 bits, in steps of 64 bits). More...

#define CKA_SUBPRIME
 Subprime ''q'' (160 bits). More...

#define CKA_BASE
 Base ''g''. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE_LEN
 Length in bytes of key value. More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...

#define CKA_VALUE
 Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). More...


Typedefs

typedef unsigned char CK_BYTE
 an unsigned 8-bit value. More...

typedef CK_BYTE CK_CHAR
 an unsigned 8-bit character. More...

typedef CK_BYTE CK_UTF8CHAR
 an 8-bit UTF-8 character. More...

typedef CK_BYTE CK_BBOOL
 a BYTE-sized Boolean flag. More...

typedef unsigned long int CK_ULONG
 an unsigned value, at least 32 bits long. More...

typedef long int CK_LONG
 a signed value, the same size as a CK_ULONG. More...

typedef CK_ULONG CK_FLAGS
 at least 32 bits; each bit is a Boolean flag. More...

typedef CK_BYTE CK_PTR CK_BYTE_PTR
 Pointer to a CK_BYTE. More...

typedef CK_CHAR CK_PTR CK_CHAR_PTR
 Pointer to a CK_CHAR. More...

typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR
 Pointer to a CK_UTF8CHAR. More...

typedef CK_ULONG CK_PTR CK_ULONG_PTR
 Pointer to a CK_ULONG. More...

typedef void CK_PTR CK_VOID_PTR
 Pointer to a void. More...

typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR
 Pointer to a CK_VOID_PTR. More...

typedef NULL CK_PTR NULL_PTR
 A NULL pointer. More...

typedef CK_RV(* myCallbackType )(args)
 

CK_CALLBACK_FUNCTION

CK_CALLBACK_FUNCTION(returnType, name), when followed by a parentheses-enclosed list of arguments and a semicolon, declares a variable or type which is a pointer to an application callback function that can be used by a Cryptoki API function in a Cryptoki library. More...

typedef struct CK_VERSION
 

CK_VERSION; CK_VERSION_PTR

CK_VERSION is a structure that describes the version of a Cryptoki interface, a Cryptoki library, or an SSL implementation, or the hardware or firmware version of a slot or token. More...

typedef CK_VERSION CK_PTR CK_VERSION_PTR
 Pointer to a CK_VERSION. More...

typedef struct CK_INFO
 

CK_INFO; CK_INFO_PTR

CK_INFO provides general information about Cryptoki. More...

typedef CK_INFO CK_PTR CK_INFO_PTR
 Pointer to a CK_INFO. More...

typedef CK_ULONG CK_NOTIFICATION
 

CK_NOTIFICATION

CK_NOTIFICATION holds the types of notifications that Cryptoki provides to an application. More...

typedef CK_ULONG CK_SLOT_ID
 

CK_SLOT_ID; CK_SLOT_ID_PTR

CK_SLOT_ID is a Cryptoki-assigned value that identifies a slot. More...

typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR
 Pointer to a CK_SLOT_ID. More...

typedef struct CK_SLOT_INFO
 

CK_SLOT_INFO; CK_SLOT_INFO_PTR

CK_SLOT_INFO provides information about a slot. More...

typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR
 Pointer to a CK_SLOT_INFO. More...

typedef struct CK_TOKEN_INFO
 

CK_TOKEN_INFO; CK_TOKEN_INFO_PTR

CK_TOKEN_INFO provides information about a token. More...

typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR
 Pointer to a CK_TOKEN_INFO. More...

typedef CK_ULONG CK_SESSION_HANDLE
 

CK_SESSION_HANDLE; CK_SESSION_HANDLE_PTR

CK_SESSION_HANDLE is a Cryptoki-assigned value that identifies a session. More...

typedef CK_SESSION_HANDLE
CK_PTR 
CK_SESSION_HANDLE_PTR
 Pointer to a CK_SESSION_HANDLE. More...

typedef CK_ULONG CK_USER_TYPE
 

CK_USER_TYPE

CK_USER_TYPE holds the types of Cryptoki users described in Section 6.5, and, in addition, a context-specific type described in Section 10.9.. More...

typedef CK_ULONG CK_STATE
 

CK_STATE

CK_STATE holds the session state, as described in Sections 6.7.1 and 6.7.2. It is defined as follows:. More...

typedef struct CK_SESSION_INFO
 

CK_SESSION_INFO; CK_SESSION_INFO_PTR

CK_SESSION_INFO provides information about a session. More...

typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR
 Pointer to a CK_SESSION_INFO. More...

typedef CK_ULONG CK_OBJECT_HANDLE
 

CK_OBJECT_HANDLE; CK_OBJECT_HANDLE_PTR

CK_OBJECT_HANDLE is a token-specific identifier for an object. More...

typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR
 Pointer to a CK_OBJECT_HANDLE. More...

typedef CK_ULONG CK_OBJECT_CLASS
 

CK_OBJECT_CLASS; CK_OBJECT_CLASS_PTR

CK_OBJECT_CLASS is a value that identifies the classes (or types) of objects that Cryptoki recognizes. More...

typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR
 Pointer to a CK_OBJECT_CLASS. More...

typedef CK_ULONG CK_HW_FEATURE_TYPE
 

CK_HW_FEATURE_TYPE

CK_HW_FEATURE_TYPE is a value that identifies a hardware feature type of a device. More...

typedef CK_ULONG CK_KEY_TYPE
 

CK_KEY_TYPE

CK_KEY_TYPE is a value that identifies a key type. More...

typedef CK_ULONG CK_CERTIFICATE_TYPE
 

CK_CERTIFICATE_TYPE

CK_CERTIFICATE_TYPE is a value that identifies a certificate type. More...

typedef CK_ULONG CK_ATTRIBUTE_TYPE
 

CK_ATTRIBUTE_TYPE

CK_ATTRIBUTE_TYPE is a value that identifies an attribute type. More...

typedef struct CK_ATTRIBUTE
 

CK_ATTRIBUTE; CK_ATTRIBUTE_PTR

CK_ATTRIBUTE is a structure that includes the type, value, and length of an attribute. More...

typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR
 Pointer to a CK_ATTRIBUTE. More...

typedef struct CK_DATE
 

CK_DATE

CK_DATE is a structure that defines a date. More...

typedef CK_ULONG CK_MECHANISM_TYPE
 

CK_MECHANISM_TYPE; CK_MECHANISM_TYPE_PTR

CK_MECHANISM_TYPE is a value that identifies a mechanism type. More...

typedef CK_MECHANISM_TYPE
CK_PTR 
CK_MECHANISM_TYPE_PTR
 Pointer to a CK_MECHANISM_TYPE. More...

typedef struct CK_MECHANISM
 

CK_MECHANISM; CK_MECHANISM_PTR

CK_MECHANISM is a structure that specifies a particular mechanism and any parameters it requires. More...

typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR
 Pointer to a CK_MECHANISM. More...

typedef struct CK_MECHANISM_INFO
 

CK_MECHANISM_INFO; CK_MECHANISM_INFO_PTR

CK_MECHANISM_INFO is a structure that provides information about a particular mechanism. More...

typedef CK_MECHANISM_INFO
CK_PTR 
CK_MECHANISM_INFO_PTR
 Pointer to a CK_MECHANISM_INFO. More...

typedef CK_ULONG CK_RV
 

CK_RV

CK_RV is a value that identifies the return value of a Cryptoki function. More...

typedef CK_RV(* CK_NOTIFY )(CK_SESSION_HANDLE hSession, CK_NOTIFICATION event, CK_VOID_PTR pApplication)
 

CK_NOTIFY

CK_NOTIFY is the type of a pointer to a function used by Cryptoki to perform notification callbacks. More...

typedef struct CK_FUNCTION_LIST
 

CK_FUNCTION_LIST; CK_FUNCTION_LIST_PTR; CK_FUNCTION_LIST_PTR_PTR

CK_FUNCTION_LIST is a structure which contains a Cryptoki version and a function pointer to each function in the Cryptoki API. More...

typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR
 Pointer to a CK_FUNCTION_LIST. More...

typedef CK_FUNCTION_LIST_PTR
CK_PTR 
CK_FUNCTION_LIST_PTR_PTR
 Pointer to a CK_FUNCTION_LIST_PTR. More...

typedef CK_RV(* CK_CREATEMUTEX )(CK_VOID_PTR_PTR ppMutex)
 

CK_CREATEMUTEX

CK_CREATEMUTEX is the type of a pointer to an application-supplied function which creates a new mutex object and returns a pointer to it. More...

typedef CK_RV(* CK_DESTROYMUTEX )(CK_VOID_PTR pMutex)
 

CK_DESTROYMUTEX

CK_DESTROYMUTEX is the type of a pointer to an application-supplied function which destroys an existing mutex object. More...

typedef CK_RV(* CK_LOCKMUTEX )(CK_VOID_PTR pMutex)
 If a CK_LOCKMUTEX function is called on a mutex which is not locked, the calling thread obtains a lock on that mutex and returns. More...

typedef CK_RV(* CK_UNLOCKMUTEX )(CK_VOID_PTR pMutex)
 CK_UNLOCKMUTEX is defined as follows:. More...

typedef struct CK_C_INITIALIZE_ARGS
 

CK_C_INITIALIZE_ARGS; CK_C_INITIALIZE_ARGS_PTR

CK_C_INITIALIZE_ARGS is a structure containing the optional arguments for the C_Initialize function. More...

typedef CK_C_INITIALIZE_ARGS
CK_PTR 
CK_C_INITIALIZE_ARGS_PTR
 Pointer to a CK_C_INITIALIZE_ARGS. More...

typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE
 

CK_RSA_PKCS_MGF_TYPE; CK_RSA_PKCS_MGF_TYPE_PTR

CK_RSA_PKCS_MGF_TYPE is used to indicate the Message Generation Function (MGF) applied to a message block when formatting a message block for the PKCS #1 OAEP encryption scheme or the PKCS #1 PSS signature scheme. More...

typedef CK_RSA_PKCS_MGF_TYPE
CK_PTR 
CK_RSA_PKCS_MGF_TYPE_PTR
 Pointer to a CK_RSA_PKCS_MGF_TYPE. More...

typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE
 

CK_RSA_PKCS_OAEP_SOURCE_TYPE; CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR

CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source of the encoding parameter when formatting a message block for the PKCS #1 OAEP encryption scheme. More...

typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE
CK_PTR 
CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR
 Pointer to a CK_RSA_PKCS_OAEP_SOURCE_TYPE. More...

typedef struct CK_RSA_PKCS_OAEP_PARAMS
 

CK_RSA_PKCS_OAEP_PARAMS; CK_RSA_PKCS_OAEP_PARAMS_PTR

CK_RSA_PKCS_OAEP_PARAMS is a structure that provides the parameters to the CKM_RSA_PKCS_OAEP mechanism. More...

typedef CK_RSA_PKCS_OAEP_PARAMS
CK_PTR 
CK_RSA_PKCS_OAEP_PARAMS_PTR
 Pointer to a CK_RSA_PKCS_OAEP_PARAMS. More...

typedef struct CK_RSA_PKCS_PSS_PARAMS
 

CK_RSA_PKCS_PSS_PARAMS; CK_RSA_PKCS_PSS_PARAMS_PTR

CK_RSA_PKCS_PSS_PARAMS is a structure that provides the parameters to the CKM_RSA_PKCS_PSS mechanism. More...

typedef CK_RSA_PKCS_PSS_PARAMS
CK_PTR 
CK_RSA_PKCS_PSS_PARAMS_PTR
 Pointer to a CK_RSA_PKCS_PSS_PARAMS. More...

typedef CK_ULONG CK_EC_KDF_TYPE
 

CK_EC_KDF_TYPE, CK_EC_KDF_TYPE_PTR

CK_EC_KDF_TYPE is used to indicate the Key Derivation Function (KDF) applied to derive keying data from a shared secret. More...

typedef CK_EC_KDF_TYPE CK_PTR CK_EC_KDF_TYPE_PTR
 Pointer to a CK_EC_KDF_TYPE. More...

typedef struct CK_ECDH1_DERIVE_PARAMS
 

CK_ECDH1_DERIVE_PARAMS, CK_ECDH1_DERIVE_PARAMS_PTR

CK_ECDH1_DERIVE_PARAMS is a structure that provides the parameters for the CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE key derivation mechanisms, where each party contributes one key pair. More...

typedef CK_ECDH1_DERIVE_PARAMS
CK_PTR 
CK_ECDH1_DERIVE_PARAMS_PTR
 Pointer to a CK_ECDH1_DERIVE_PARAMS. More...

typedef struct CK_ECMQV_DERIVE_PARAMS
 

CK_ ECMQV _DERIVE_PARAMS, CK_ ECMQV _DERIVE_PARAMS_PTR

CK_ ECMQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_ECMQV_DERIVE key derivation mechanism, where each party contributes two key pairs. More...

typedef CK_ECMQV_DERIVE_PARAMS
CK_PTR 
CK_ECMQV_DERIVE_PARAMS_PTR
 Pointer to a CK_ECMQV_DERIVE_PARAMS. More...

typedef CK_ULONG CK_X9_42_DH_KDF_TYPE
 

CK_X9_42_DH_KDF_TYPE, CK_X9_42_DH_KDF_TYPE_PTR

CK_X9_42_DH_KDF_TYPE is used to indicate the Key Derivation Function (KDF) applied to derive keying data from a shared secret. More...

typedef CK_X9_42_DH_KDF_TYPE
CK_PTR 
CK_X9_42_DH_KDF_TYPE_PTR
 Pointer to a CK_X9_42_DH_KDF_TYPE. More...

typedef struct CK_X9_42_DH1_DERIVE_PARAMS
 

CK_X9_42_DH1_DERIVE_PARAMS, CK_X9_42_DH1_DERIVE_PARAMS_PTR

CK_X9_42_DH1_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_DH_DERIVE key derivation mechanism, where each party contributes one key pair. More...

typedef CK_X9_42_DH1_DERIVE_PARAMS
CK_PTR 
CK_X9_42_DH1_DERIVE_PARAMS_PTR
 Pointer to a CK_X9_42_DH1_DERIVE_PARAMS. More...

typedef struct CK_X9_42_DH2_DERIVE_PARAMS
 

CK_X9_42_DH2_DERIVE_PARAMS, CK_X9_42_DH2_DERIVE_PARAMS_PTR

CK_X9_42_DH2_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation mechanisms, where each party contributes two key pairs. More...

typedef CK_X9_42_DH2_DERIVE_PARAMS
CK_PTR 
CK_X9_42_DH2_DERIVE_PARAMS_PTR
 Pointer to a CK_X9_42_DH2_DERIVE_PARAMS. More...

typedef struct CK_X9_42_MQV_DERIVE_PARAMS
 

CK_X9_42_MQV_DERIVE_PARAMS, CK_X9_42_MQV_DERIVE_PARAMS_PTR

CK_X9_42_MQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_MQV_DERIVE key derivation mechanism, where each party contributes two key pairs. More...

typedef CK_X9_42_MQV_DERIVE_PARAMS
CK_PTR 
CK_X9_42_MQV_DERIVE_PARAMS_PTR
 Pointer to a CK_X9_42_MQV_DERIVE_PARAMS. More...

typedef struct CK_AES_CTR_PARAMS
 

CK_AES_CTR_PARAMS; CK_AES_CTR_PARAMS_PTR

CK_AES_CTR_PARAMS is a structure that provides the parameters to the CKM_AES_CTR mechanism. More...

typedef struct CK_GCM_PARAMS
 

CK_GCM _PARAMS; CK_GCM _PARAMS_PTR

CK_GCM_PARAMS is a structure that provides the parameters to the CKM_AES_GCM mechanism. More...

typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR
 Pointer to a CK_GCM_PARAMS. More...

typedef struct CK_CCM_PARAMS
 

CK_CCM _PARAMS; CK_CCM _PARAMS_PTR

CK_CCM_PARAMS is a structure that provides the parameters to the CKM_AES_CCM mechanism. More...

typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR
 Pointer to a CK_CCM_PARAMS. More...

typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS
 
. More...

typedef CK_DES_CBC_ENCRYPT_DATA_PARAMSCK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR
typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS
typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS
CK_PTR 
CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR
typedef struct CK_PBE_PARAMS
 

CK_PBE_PARAMS; CK_PBE_PARAMS_PTR

CK_PBE_PARAMS is a structure which provides all of the necessary information required by the CKM_PBE mechanisms (see PKCS #5 and PKCS #12 for information on the PBE generation mechanisms) and the CKM_PBA_SHA1_WITH_SHA1_HMAC mechanism. More...

typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR
 Pointer to a CK_PBE_PARAMS. More...

typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
 

CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR

CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to indicate the Pseudo-Random Function (PRF) used to generate key bits using PKCS #5 PBKDF2. More...

typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
CK_PTR 
CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR
 Pointer to a CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE. More...

typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE
 

CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR

CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the source of the salt value when deriving a key using PKCS #5 PBKDF2. More...

typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE
CK_PTR 
CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR
 Pointer to a CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE. More...

typedef struct CK_PKCS5_PBKD2_PARAMS
 

CK_PKCS5_PBKD2_PARAMS; CK_PKCS5_PBKD2_PARAMS_PTR

CK_PKCS5_PBKD2_PARAMS is a structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism. More...

typedef CK_PKCS5_PBKD2_PARAMS
CK_PTR 
CK_PKCS5_PBKD2_PARAMS_PTR
 Pointer to a CK_PKCS5_PBKD2_PARAMS. More...

typedef struct CK_SSL3_RANDOM_DATA
 

CK_SSL3_RANDOM_DATA

CK_SSL3_RANDOM_DATA is a structure which provides information about the random data of a client and a server in an SSL context. More...

typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS
typedef CK_SSL3_MASTER_KEY_DERIVE_PARAMS
CK_PTR 
CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR
 Pointer to a CK_SSL3_MASTER_KEY_DERIVE_PARAMS. More...

typedef struct CK_SSL3_KEY_MAT_OUT
 

CK_SSL3_KEY_MAT_OUT; CK_SSL3_KEY_MAT_OUT_PTR

CK_SSL3_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. More...

typedef CK_SSL3_KEY_MAT_OUT
CK_PTR 
CK_SSL3_KEY_MAT_OUT_PTR
 Pointer to a CK_SSL3_KEY_MAT_OUT. More...

typedef struct CK_SSL3_KEY_MAT_PARAMS
 

CK_SSL3_KEY_MAT_PARAMS; CK_SSL3_KEY_MAT_PARAMS_PTR

CK_SSL3_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. More...

typedef CK_SSL3_KEY_MAT_PARAMS
CK_PTR 
CK_SSL3_KEY_MAT_PARAMS_PTR
 Pointer to a CK_SSL3_KEY_MAT_PARAMS. More...

typedef struct CK_TLS_PRF_PARAMS
 

CK_TLS_PRF_PARAMS; CK_TLS_PRF_PARAMS_PTR

CK_TLS_PRF_PARAMS is a structure, which provides the parameters to the CKM_TLS_PRF mechanism. More...

typedef CK_TLS_PRF_PARAMS
CK_PTR 
CK_TLS_PRF_PARAMS_PTR
 Pointer to a CK_TLS_PRF_PARAMS. More...

typedef struct CK_WTLS_RANDOM_DATA
 

CK_WTLS_RANDOM_DATA; CK_WTLS_RANDOM_DATA_PTR

CK_WTLS_RANDOM_DATA is a structure, which provides information about the random data of a client and a server in a WTLS context. More...

typedef CK_WTLS_RANDOM_DATA
CK_PTR 
CK_WTLS_RANDOM_DATA_PTR
 Pointer to a CK_WTLS_RANDOM_DATA. More...

typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS
 

CK_WTLS_MASTER_KEY_DERIVE_PARAMS; CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR

CK_WTLS_MASTER_KEY_DERIVE_PARAMS is a structure, which provides the parameters to the CKM_WTLS_MASTER_KEY_DERIVE mechanism. More...

typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS
CK_PTR 
CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR
 Pointer to a CK_WTLS_MASTER_KEY_DERIVE_PARAMS. More...

typedef struct CK_WTLS_PRF_PARAMS
 

CK_WTLS_PRF_PARAMS; CK_WTLS_PRF_PARAMS_PTR

CK_WTLS_PRF_PARAMS is a structure, which provides the parameters to the CKM_WTLS_PRF mechanism. More...

typedef CK_WTLS_PRF_PARAMS
CK_PTR 
CK_WTLS_PRF_PARAMS_PTR
 Pointer to a CK_WTLS_PRF_PARAMS. More...

typedef struct CK_WTLS_KEY_MAT_OUT
 

CK_WTLS_KEY_MAT_OUT; CK_WTLS_KEY_MAT_OUT_PTR

CK_WTLS_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE or with the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanism. More...

typedef CK_WTLS_KEY_MAT_OUT
CK_PTR 
CK_WTLS_KEY_MAT_OUT_PTR
 Pointer to a CK_WTLS_KEY_MAT_OUT. More...

typedef struct CK_WTLS_KEY_MAT_PARAMS
 

CK_WTLS_KEY_MAT_PARAMS; CK_WTLS_KEY_MAT_PARAMS_PTR

CK_WTLS_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE and the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanisms. More...

typedef CK_WTLS_KEY_MAT_PARAMS
CK_PTR 
CK_WTLS_KEY_MAT_PARAMS_PTR
 Pointer to a CK_WTLS_KEY_MAT_PARAMS. More...

typedef struct CK_KEY_DERIVATION_STRING_DATA
 

CK_KEY_DERIVATION_STRING_DATA; CK_KEY_DERIVATION_STRING_DATA_PTR

. More...

typedef CK_ULONG CK_EXTRACT_PARAMS
 

CK_EXTRACT_PARAMS; CK_EXTRACT_PARAMS_PTR

CK_KEY_EXTRACT_PARAMS provides the parameter to the CKM_EXTRACT_KEY_FROM_KEY mechanism. More...

typedef CK_EXTRACT_PARAMS
CK_PTR 
CK_EXTRACT_PARAMS_PTR
 Pointer to a CK_EXTRACT_PARAMS. More...

typedef struct CK_CMS_SIG_PARAMS
 

CK_CMS_SIG_PARAMS, CK_CMS_SIG_PARAMS_PTR

CK_CMS_SIG_PARAMS is a structure that provides the parameters to the CKM_CMS_SIG mechanism. More...

typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS
 Mechanisms:. More...

typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS
CK_PTR 
CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR
typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS
 Mechanisms:. More...

typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS
CK_PTR 
CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR
typedef struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS CK_CBC_ENCRYPT_DATA_PARAMS
 Mechanisms:. More...

typedef CK_CBC_ENCRYPT_DATA_PARAMS
CK_PTR 
CK_CBC_ENCRYPT_DATA_PARAMS_PTR
typedef CK_ULONG CK_PARAM_TYPE
 

CK_PARAM_TYPE

CK_PARAM_TYPE is a value that identifies an OTP parameter type. More...

typedef struct CK_OTP_PARAM
 

CK_OTP_PARAM; CK_OTP_PARAM_PTR

CK_OTP_PARAM is a structure that includes the type, value, and length of an OTP parameter. More...

typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR
 Pointer to a CK_OTP_PARAM. More...

typedef struct CK_OTP_PARAMS
 CK_OTP_PARAMS; CK_OTP_PARAMS_PTR CK_OTP_PARAMS is a structure that is used to provide parameters for OTP mechanisms in a generic fashion. More...

typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR
 Pointer to a CK_OTP_PARAMS. More...

typedef struct CK_OTP_SIGNATURE_INFO
 CK_OTP_SIGNATURE_INFO, CK_OTP_SIGNATURE_INFO_PTR CK_OTP_SIGNATURE_INFO is a structure that is returned by all OTP mechanisms in successful calls to C_Sign (C_SignFinal). More...

typedef struct CK_KIP_PARAMS
 

CK_KIP_ PARAMS; CK_KIP_ PARAMS_PTR

CK_KIP_PARAMS is a structure that provides the parameters to all the CT-KIP related mechanisms: The CKM_KIP_DERIVE key derivation mechanism, the CKM_KIP_WRAP key wrap and key unwrap mechanism, and the CKM_KIP_MAC signature mechanism. More...

typedef struct CK_GOSTR3410_KEY_WRAP_PARAMS
 CK_GOSTR3410_KEY_WRAP_PARAMS is a structure that provides the parameters to the CKM_GOSTR3410_KEY_WRAP mechanism. More...

typedef struct CK_GOSTR3410_DERIVE_PARAMS
 CK_GOSTR3410_DERIVE_PARAMS is a structure that provides the parameters to the CKM_GOSTR3410_DERIVE mechanism. More...

typedef struct CK_KEA_DERIVE_PARAMS
typedef CK_KEA_DERIVE_PARAMS
CK_PTR 
CK_KEA_DERIVE_PARAMS_PTR
 Pointer to a CK_KEA_DERIVE_PARAMS. More...

typedef CK_ULONG CK_RC2_PARAMS
 

CK_RC2_PARAMS; CK_RC2_PARAMS_PTR

CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and CKM_RC2_MAC mechanisms. More...

typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR
 Pointer to a CK_RC2_PARAMS. More...

typedef struct CK_RC2_CBC_PARAMS
 

CK_RC2_CBC_PARAMS; CK_RC2_CBC_PARAMS_PTR

CK_RC2_CBC_PARAMS is a structure that provides the parameters to the CKM_RC2_CBC and CKM_RC2_CBC_PAD mechanisms. More...

typedef CK_RC2_CBC_PARAMS
CK_PTR 
CK_RC2_CBC_PARAMS_PTR
 Pointer to a CK_RC2_CBC_PARAMS. More...

typedef struct CK_RC2_MAC_GENERAL_PARAMS
 

CK_RC2_MAC_GENERAL_PARAMS; CK_RC2_MAC_GENERAL_PARAMS_PTR

CK_RC2_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC2_MAC_GENERAL mechanism. More...

typedef CK_RC2_MAC_GENERAL_PARAMS
CK_PTR 
CK_RC2_MAC_GENERAL_PARAMS_PTR
 Pointer to a CK_RC2_MAC_GENERAL_PARAMS. More...

typedef struct CK_RC5_PARAMS
 

CK_RC5_PARAMS; CK_RC5_PARAMS_PTR

CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and CKM_RC5_MAC mechanisms. More...

typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR
 Pointer to a CK_RC5_PARAMS. More...

typedef struct CK_RC5_CBC_PARAMS
 

CK_RC5_CBC_PARAMS; CK_RC5_CBC_PARAMS_PTR

CK_RC5_CBC_PARAMS is a structure that provides the parameters to the CKM_RC5_CBC and CKM_RC5_CBC_PAD mechanisms. More...

typedef CK_RC5_CBC_PARAMS
CK_PTR 
CK_RC5_CBC_PARAMS_PTR
 Pointer to a CK_RC5_CBC_PARAMS. More...

typedef struct CK_RC5_MAC_GENERAL_PARAMS
 

CK_RC5_MAC_GENERAL_PARAMS; CK_RC5_MAC_GENERAL_PARAMS_PTR

CK_RC5_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC5_MAC_GENERAL mechanism. More...

typedef CK_RC5_MAC_GENERAL_PARAMS
CK_PTR 
CK_RC5_MAC_GENERAL_PARAMS_PTR
 Pointer to a CK_RC5_MAC_GENERAL_PARAMS. More...

typedef CK_ULONG CK_MAC_GENERAL_PARAMS
 

CK_MAC_GENERAL_PARAMS; CK_MAC_GENERAL_PARAMS_PTR

CK_MAC_GENERAL_PARAMS provides the parameters to the general-length MACing mechanisms of the DES, DES3 (triple-DES), CAST, CAST3, CAST128 (CAST5), IDEA, CDMF and AES ciphers. More...

typedef CK_MAC_GENERAL_PARAMS
CK_PTR 
CK_MAC_GENERAL_PARAMS_PTR
 Pointer to a CK_MAC_GENERAL_PARAMS. More...

typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS
 

CK_SKIPJACK_PRIVATE_WRAP_PARAMS; CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR

CK_SKIPJACK_PRIVATE_WRAP_PARAMS is a structure that provides the parameters to the CKM_SKIPJACK_PRIVATE_WRAP mechanism. More...

typedef CK_PRIVATE_WRAP_PARAMS
CK_PTR 
CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR
 Pointer to a CK_PRIVATE_WRAP_PARAMS. More...

typedef struct CK_SKIPJACK_RELAYX_PARAMS
 

CK_SKIPJACK_RELAYX_PARAMS; CK_SKIPJACK_RELAYX_PARAMS_PTR

CK_SKIPJACK_RELAYX_PARAMS is a structure that provides the parameters to the CKM_SKIPJACK_RELAYX mechanism. More...

typedef CK_SKIPJACK_RELAYX_PARAMS
CK_PTR 
CK_SKIPJACK_RELAYX_PARAMS_PTR
 Pointer to a CK_SKIPJACK_RELAYX_PARAMS. More...

typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS
 

CK_KEY_WRAP_SET_OAEP_PARAMS; CK_KEY_WRAP_SET_OAEP_PARAMS_PTR

CK_KEY_WRAP_SET_OAEP_PARAMS is a structure that provides the parameters to the CKM_KEY_WRAP_SET_OAEP mechanism. More...

typedef CK_KEY_WRAP_SET_OAEP_PARAMS
CK_PTR 
CK_KEY_WRAP_SET_OAEP_PARAMS_PTR
 Pointer to a CK_KEY_WRAP_SET_OAEP_PARAMS. More...


Functions

typedef CK_DECLARE_FUNCTION_POINTER (CK_RV, myC_InitializeType)(CK_VOID_PTR pReserved)
CK_RV C_Initialize (CK_VOID_PTR pInitArgs)
 C_Initialize initializes the Cryptoki library. More...

CK_RV C_Finalize (CK_VOID_PTR pReserved)
 C_Finalize is called to indicate that an application is finished with the Cryptoki library. More...

CK_RV C_GetInfo (CK_INFO_PTR pInfo)
 C_GetInfo returns general information about Cryptoki. More...

CK_RV C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR ppFunctionList)
 C_GetFunctionList obtains a pointer to the Cryptoki library's list of function pointers. More...

CK_RV C_GetSlotList (CK_BBOOL tokenPresent, CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount)
 C_GetSlotList is used to obtain a list of slots in the system. More...

CK_RV C_GetSlotInfo (CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo)
 C_GetSlotInfo obtains information about a particular slot in the system. More...

CK_RV C_GetTokenInfo (CK_SLOT_ID slotID, CK_TOKEN_INFO_PTR pInfo)
 C_GetTokenInfo obtains information about a particular token in the system. More...

CK_RV C_WaitForSlotEvent (CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, CK_VOID_PTR pReserved)
 C_WaitForSlotEvent waits for a slot event, such as token insertion or token removal, to occur. More...

CK_RV C_GetMechanismList (CK_SLOT_ID slotID, CK_MECHANISM_TYPE_PTR pMechanismList, CK_ULONG_PTR pulCount)
 C_GetMechanismList is used to obtain a list of mechanism types supported by a token. More...

CK_RV C_GetMechanismInfo (CK_SLOT_ID slotID, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR pInfo)
 C_GetMechanismInfo obtains information about a particular mechanism possibly supported by a token. More...

CK_RV C_InitToken (CK_SLOT_ID slotID, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen, CK_UTF8CHAR_PTR pLabel)
 C_InitToken initializes a token. More...

CK_RV C_InitPIN (CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen)
 C_InitPIN initializes the normal user's PIN. More...

CK_RV C_SetPIN (CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pOldPin, CK_ULONG ulOldLen, CK_UTF8CHAR_PTR pNewPin, CK_ULONG ulNewLen)
 C_SetPIN modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in. More...

CK_RV C_OpenSession (CK_SLOT_ID slotID, CK_FLAGS flags, CK_VOID_PTR pApplication, CK_NOTIFY Notify, CK_SESSION_HANDLE_PTR phSession)
 C_OpenSession opens a session between an application and a token in a particular slot. More...

CK_RV C_CloseSession (CK_SESSION_HANDLE hSession)
 C_CloseSession closes a session between an application and a token. More...

CK_RV C_CloseAllSessions (CK_SLOT_ID slotID)
 C_CloseAllSessions closes all sessions an application has with a token. More...

CK_RV C_GetSessionInfo (CK_SESSION_HANDLE hSession, CK_SESSION_INFO_PTR pInfo)
 C_GetSessionInfo obtains information about a session. More...

CK_RV C_GetOperationState (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pOperationState, CK_ULONG_PTR pulOperationStateLen)
 C_GetOperationState obtains a copy of the cryptographic operations state of a session, encoded as a string of bytes. More...

CK_RV C_SetOperationState (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pOperationState, CK_ULONG ulOperationStateLen, CK_OBJECT_HANDLE hEncryptionKey, CK_OBJECT_HANDLE hAuthenticationKey)
 C_SetOperationState restores the cryptographic operations state of a session from a string of bytes obtained with C_GetOperationState. More...

CK_RV C_Login (CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen)
 C_Login logs a user into a token. More...

CK_RV C_Logout (CK_SESSION_HANDLE hSession)
 C_Logout logs a user out from a token. More...

CK_RV C_CreateObject (CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phObject)
 C_CreateObject creates a new object. More...

CK_RV C_CopyObject (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phNewObject)
 C_CopyObject copies an object, creating a new object for the copy. More...

CK_RV C_DestroyObject (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject)
 C_DestroyObject destroys an object. More...

CK_RV C_GetObjectSize (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ULONG_PTR pulSize)
 C_GetObjectSize gets the size of an object in bytes. More...

CK_RV C_GetAttributeValue (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
 C_GetAttributeValue obtains the value of one or more attributes of an object. More...

CK_RV C_SetAttributeValue (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
 C_SetAttributeValue modifies the value of one or more attributes of an object. More...

CK_RV C_FindObjectsInit (CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
 C_FindObjectsInit initializes a search for token and session objects that match a template. More...

CK_RV C_FindObjects (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE_PTR phObject, CK_ULONG ulMaxObjectCount, CK_ULONG_PTR pulObjectCount)
 C_FindObjects continues a search for token and session objects that match a template, obtaining additional object handles. More...

CK_RV C_FindObjectsFinal (CK_SESSION_HANDLE hSession)
 C_FindObjectsFinal terminates a search for token and session objects. More...

CK_RV C_EncryptInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
 C_EncryptInit initializes an encryption operation. More...

CK_RV C_Encrypt (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pEncryptedData, CK_ULONG_PTR pulEncryptedDataLen)
 C_Encrypt encrypts single-part data. More...

CK_RV C_EncryptUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen, CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen)
 C_EncryptUpdate continues a multiple-part encryption operation, processing another data part. More...

CK_RV C_EncryptFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pLastEncryptedPart, CK_ULONG_PTR pulLastEncryptedPartLen)
 C_EncryptFinal finishes a multiple-part encryption operation. More...

CK_RV C_DecryptInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
 C_DecryptInit initializes a decryption operation. More...

CK_RV C_Decrypt (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedData, CK_ULONG ulEncryptedDataLen, CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
 C_Decrypt decrypts encrypted data in a single part. More...

CK_RV C_DecryptUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart, CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
 C_DecryptUpdate continues a multiple-part decryption operation, processing another encrypted data part. More...

CK_RV C_DecryptFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pLastPart, CK_ULONG_PTR pulLastPartLen)
 C_DecryptFinal finishes a multiple-part decryption operation. More...

CK_RV C_DigestInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism)
 C_DigestInit initializes a message-digesting operation. More...

CK_RV C_Digest (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
 C_Digest digests data in a single part. More...

CK_RV C_DigestUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
 C_DigestUpdate continues a multiple-part message-digesting operation, processing another data part. More...

CK_RV C_DigestKey (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hKey)
 C_DigestKey continues a multiple-part message-digesting operation by digesting the value of a secret key. More...

CK_RV C_DigestFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
 C_DigestFinal finishes a multiple-part message-digesting operation, returning the message digest. More...

CK_RV C_SignInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
 C_SignInit initializes a signature operation, where the signature is an appendix to the data. More...

CK_RV C_Sign (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
 C_Sign signs data in a single part, where the signature is an appendix to the data. More...

CK_RV C_SignUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
 C_SignUpdate continues a multiple-part signature operation, processing another data part. More...

CK_RV C_SignFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
 C_SignFinal finishes a multiple-part signature operation, returning the signature. More...

CK_RV C_SignRecoverInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
 C_SignRecoverInit initializes a signature operation, where the data can be recovered from the signature. More...

CK_RV C_SignRecover (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
 C_SignRecover signs data in a single operation, where the data can be recovered from the signature. More...

CK_RV C_VerifyInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
 C_VerifyInit initializes a verification operation, where the signature is an appendix to the data. More...

CK_RV C_Verify (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
 C_Verify verifies a signature in a single-part operation, where the signature is an appendix to the data. More...

CK_RV C_VerifyUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
 C_VerifyUpdate continues a multiple-part verification operation, processing another data part. More...

CK_RV C_VerifyFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
 C_VerifyFinal finishes a multiple-part verification operation, checking the signature. More...

CK_RV C_VerifyRecoverInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
 C_VerifyRecoverInit initializes a signature verification operation, where the data is recovered from the signature. More...

CK_RV C_VerifyRecover (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen, CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
 C_VerifyRecover verifies a signature in a single-part operation, where the data is recovered from the signature. More...

CK_RV C_DigestEncryptUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen, CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen)
 C_DigestEncryptUpdate continues multiple-part digest and encryption operations, processing another data part. More...

CK_RV C_DecryptDigestUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart, CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
 C_DecryptDigestUpdate continues a multiple-part combined decryption and digest operation, processing another data part. More...

CK_RV C_SignEncryptUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen, CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen)
 C_SignEncryptUpdate continues a multiple-part combined signature and encryption operation, processing another data part. More...

CK_RV C_DecryptVerifyUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart, CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
 C_DecryptVerifyUpdate continues a multiple-part combined decryption and verification operation, processing another data part. More...

CK_RV C_GenerateKey (CK_SESSION_HANDLE hSession CK_MECHANISM_PTR pMechanism, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phKey)
 C_GenerateKey generates a secret key or set of domain parameters, creating a new object. More...

CK_RV C_GenerateKeyPair (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_ATTRIBUTE_PTR pPublicKeyTemplate, CK_ULONG ulPublicKeyAttributeCount, CK_ATTRIBUTE_PTR pPrivateKeyTemplate, CK_ULONG ulPrivateKeyAttributeCount, CK_OBJECT_HANDLE_PTR phPublicKey, CK_OBJECT_HANDLE_PTR phPrivateKey)
 C_GenerateKeyPair generates a public/private key pair, creating new key objects. More...

CK_RV C_WrapKey (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hWrappingKey, CK_OBJECT_HANDLE hKey, CK_BYTE_PTR pWrappedKey, CK_ULONG_PTR pulWrappedKeyLen)
 C_WrapKey wraps (i.e., encrypts) a private or secret key. More...

CK_RV C_UnwrapKey (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hUnwrappingKey, CK_BYTE_PTR pWrappedKey, CK_ULONG ulWrappedKeyLen, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey)
 C_UnwrapKey unwraps (i.e. decrypts) a wrapped key, creating a new private key or secret key object. More...

CK_RV C_DeriveKey (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hBaseKey, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey)
 C_DeriveKey derives a key from a base key, creating a new key object. More...

CK_RV C_SeedRandom (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen)
 C_SeedRandom mixes additional seed material into the token's random number generator. More...

CK_RV C_GenerateRandom (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pRandomData, CK_ULONG ulRandomLen)
 C_GenerateRandom generates random or pseudo-random data. More...

CK_RV C_GetFunctionStatus (CK_SESSION_HANDLE hSession)
 In previous versions of Cryptoki, C_GetFunctionStatus obtained the status of a function running in parallel with an application. More...

CK_RV C_CancelFunction (CK_SESSION_HANDLE hSession)
 In previous versions of Cryptoki, C_CancelFunction cancelled a function running in parallel with an application. More...


Variables

 myC_Initialize
 myCallback


Detailed Description

Definition in file pkcs11_all.h.


Define Documentation

#define CK_INVALID_HANDLE
 

An invalid handle.

#define CK_TRUE
 

CK_BBOOL true.

#define CK_FALSE
 

CK_BBOOL false.

#define CK_UNAVAILABLE_INFORMATION
 

Information unavailable.

#define CK_EFFECTIVELY_INFINITE
 

Effectively infinite.

#define CKU_SO
 

Security Officer.

#define CKU_USER
 

User.

#define CKU_CONTEXT_SPECIFIC
 

Context specific.

#define CKS_RO_PUBLIC_SESSION
 

Read only public session.

#define CKS_RO_USER_FUNCTIONS
 

Read only user functions.

#define CKS_RW_PUBLIC_SESSION
 

Read write public session.

#define CKS_RW_USER_FUNCTIONS
 

Read write user functions.

#define CKS_RW_SO_FUNCTIONS
 

Read write security officer functions.

#define TRUE
 

True.

#define FALSE
 

False.

#define CKF_TOKEN_PRESENT
 

True if a token is present in the slot (''e.g.'', a device is in the reader).

#define CKF_REMOVABLE_DEVICE
 

True if the reader supports removable devices.

#define CKF_HW_SLOT
 

True if the slot is a hardware slot, as opposed to a software slot implementing a "soft token".

#define CKF_RNG
 

True if the token has its own random number generator.

#define CKF_WRITE_PROTECTED
 

True if the token is write-protected (see below).

#define CKF_LOGIN_REQUIRED
 

True if there are some cryptographic functions that a user must be logged in to perform.

#define CKF_USER_PIN_INITIALIZED
 

True if the normal user's PIN has been initialized.

#define CKF_RESTORE_KEY_NOT_NEEDED
 

True if a successful save of a session's cryptographic operations state ''always'' contains all keys needed to restore the state of the session.

#define CKF_CLOCK_ON_TOKEN
 

True if token has its own hardware clock.

#define CKF_PROTECTED_AUTHENTICATION_PATH
 

True if token has a "protected authentication path", whereby a user can log into the token without passing a PIN through the Cryptoki library.

#define CKF_DUAL_CRYPTO_OPERATIONS
 

True if a single session with the token can perform dual cryptographic operations (see Section 11.13).

#define CKF_TOKEN_INITIALIZED
 

True if the token has been initialized using C_InitToken or an equivalent mechanism outside the scope of this standard. Calling C_InitToken when this flag is set will cause the token to be reinitialized.

#define CKF_SECONDARY_AUTHENTICATION
 

True if the token supports secondary authentication for private key objects. (Deprecated; new implementations MUST NOT set this flag)

#define CKF_USER_PIN_COUNT_LOW
 

True if an incorrect user login PIN has been entered at least once since the last successful authentication.

#define CKF_USER_PIN_FINAL_TRY
 

True if supplying an incorrect user PIN will cause it to become locked.

#define CKF_USER_PIN_LOCKED
 

True if the user PIN has been locked. User login to the token is not possible.

#define CKF_USER_PIN_TO_BE_CHANGED
 

True if the user PIN value is the default value set by token initialization or manufacturing, or the PIN has been expired by the card.

#define CKF_SO_PIN_COUNT_LOW
 

True if an incorrect SO login PIN has been entered at least once since the last successful authentication.

#define CKF_SO_PIN_FINAL_TRY
 

True if supplying an incorrect SO PIN will cause it to become locked.

#define CKF_SO_PIN_LOCKED
 

True if the SO PIN has been locked. SO login to the token is not possible.

#define CKF_SO_PIN_TO_BE_CHANGED
 

True if the SO PIN value is the default value set by token initialization or manufacturing, or the PIN has been expired by the card.

#define CKF_ERROR_STATE
 

True if the token failed a FIPS 140-2 self-test and entered an error state.

#define CKF_RW_SESSION
 

True if the session is read/write; false if the session is read-only.

#define CKF_SERIAL_SESSION
 

This flag is provided for backward compatibility, and should always be set to true.

#define CKF_HW
 

True if the mechanism is performed by the device; false if the mechanism is performed in software.

#define CKF_ENCRYPT
 

True if the mechanism can be used with '''C_EncryptInit'''.

#define CKF_DECRYPT
 

True if the mechanism can be used with '''C_DecryptInit'''.

#define CKF_DIGEST
 

True if the mechanism can be used with '''C_DigestInit'''.

#define CKF_SIGN
 

True if the mechanism can be used with '''C_SignInit'''.

#define CKF_SIGN_RECOVER
 

True if the mechanism can be used with '''C_SignRecoverInit'''.

#define CKF_VERIFY
 

True if the mechanism can be used with '''C_VerifyInit'''.

#define CKF_VERIFY_RECOVER
 

True if the mechanism can be used with '''C_VerifyRecoverInit'''.

#define CKF_GENERATE
 

True if the mechanism can be used with '''C_GenerateKey'''.

#define CKF_GENERATE_KEY_PAIR
 

True if the mechanism can be used with '''C_GenerateKeyPair'''.

#define CKF_WRAP
 

True if the mechanism can be used with '''C_WrapKey'''.

#define CKF_UNWRAP
 

True if the mechanism can be used with '''C_UnwrapKey'''.

#define CKF_DERIVE
 

True if the mechanism can be used with '''C_DeriveKey'''.

#define CKF_EXTENSION
 

True if there is an extension to the flags; false if no extensions. Must be false for this version.

#define CKF_LIBRARY_CANT_CREATE_OS_THREADS
 

True if application threads which are executing calls to the library may ''not'' use native operating system calls to spawn new threads; false if they may.

#define CKF_OS_LOCKING_OK
 

True if the library can use the native operation system threading model for locking; false otherwise.

#define CKA_CLASS
 

Object class (type).

#define CKA_HW_FEATURE_TYPE
 

Hardware feature (type).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_RESET_ON_INIT
 

The value of the counter will reset to a previously returned value if the token is initialized using '''C_InitToken'''.

#define CKA_HAS_RESET
 

The value of the counter has been reset at least once at some point in time.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PIXEL_X
 

Screen resolution (in pixels) in X-axis (e.g. 1280)

#define CKA_PIXEL_Y
 

Screen resolution (in pixels) in Y-axis (e.g. 1024)

#define CKA_RESOLUTION
 

DPI, pixels per inch.

#define CKA_CHAR_ROWS
 

For character-oriented displays; number of character rows (e.g. 24)

#define CKA_CHAR_COLUMNS
 

For character-oriented displays: number of character columns (e.g. 80). If display is of proportional-font type, this is the width of the display in "em"-s (letter "M"), see CC/PP Struct.

#define CKA_COLOR
 

Color support.

#define CKA_BITS_PER_PIXEL
 

The number of bits of color or grayscale information per pixel.

#define CKA_CHAR_SETS
 

String indicating supported character sets, as defined by IANA MIBenum sets (www.iana.org). Supported character sets are separated with ";". E.g. a token supporting iso-8859-1 and us-ascii would set the attribute value to "4;3".

#define CKA_ENCODING_METHODS
 

String indicating supported content transfer encoding methods, as defined by IANA (www.iana.org). Supported methods are separated with ";". E.g. a token supporting 7bit, 8bit and base64 could set the attribute value to "7bit;8bit;base64".

#define CKA_MIME_TYPES
 

String indicating supported (presentable) MIME-types, as defined by IANA (www.iana.org). Supported types are separated with ";". E.g. a token supporting MIME types "a/b", "a/c" and "a/d" would set the attribute value to "a/b;a/c;a/d".

#define CKA_TOKEN
 

CK_TRUE if object is a token object; CK_FALSE if object is a session object. Default is CK_FALSE.

#define CKA_PRIVATE
 

CK_TRUE if object is a private object; CK_FALSE if object is a public object. Default value is token-specific, and may depend on the values of other attributes of the object.

#define CKA_MODIFIABLE
 

CK_TRUE if object can be modified Default is CK_TRUE.

#define CKA_LABEL
 

Description of the object (default empty).

#define CKA_COPYABLE
 

CK_TRUE if object can be copied using C_CopyObject. Defaults to CK_TRUE. Can't be set to TRUE once it is set to FALSE.

#define CKA_APPLICATION
 

Description of the application that manages the object (default empty).

#define CKA_OBJECT_ID
 

DER-encoding of the object identifier indicating the data object type (default empty).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_CERTIFICATE_TYPE
 

Type of certificate.

#define CKA_TRUSTED
 

The certificate can be trusted for the application that it was created. The wrapping key can be used to wrap keys with CKA_WRAP_WITH_TRUSTED set to CK_TRUE.

#define CKA_CERTIFICATE_CATEGORY
 

Categorization of the certificate:0 = unspecified (default value), 1 = token user, 2 = authority, 3 = other entity.

#define CKA_CHECK_VALUE
 

Checksum.

#define CKA_START_DATE
 

Start date for the certificate (default empty).

#define CKA_END_DATE
 

End date for the certificate (default empty).

#define CKA_SUBJECT
 

DER-encoding of the certificate subject name.

#define CKA_ID
 

Key identifier for public/private key pair (default empty).

#define CKA_ISSUER
 

DER-encoding of the certificate issuer name (default empty).

#define CKA_SERIAL_NUMBER
 

DER-encoding of the certificate serial number (default empty). (default empty)

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_URL
 

If not empty this attribute gives the URL where the complete certificate can be obtained (default empty).

#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY
 

Hash of the subject public key (default empty). Hash algorithm is defined by CKA_NAME_HASH_ALGORITHM

#define CKA_HASH_OF_ISSUER_PUBLIC_KEY
 

Hash of the issuer public key (default empty). Hash algorithm is defined by CKA_NAME_HASH_ALGORITHM

#define CKA_JAVA_MIDP_SECURITY_DOMAIN
 

Java MIDP security domain: 0 = unspecified (default value), 1 = manufacturer, 2 = operator, 3 = third party.

#define CKA_NAME_HASH_ALGORITHM
 

Defines the mechanism used to calculate CKA_HASH_OF_SUBJECT_PUBLIC_KEY and CKA_HASH_OF_ISSUER_PUBLIC_KEY. If the attribute is not present then the type defaults to SHA-1.

#define CKA_SUBJECT
 

DER-encoding of the certificate subject name.

#define CKA_ISSUER
 

DER-encoding of the certificate issuer name (default empty).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_URL
 

If not empty this attribute gives the URL where the complete certificate can be obtained (default empty).

#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY
 

Hash of the subject public key (default empty). Hash algorithm is defined by CKA_NAME_HASH_ALGORITHM

#define CKA_HASH_OF_ISSUER_PUBLIC_KEY
 

Hash of the issuer public key (default empty). Hash algorithm is defined by CKA_NAME_HASH_ALGORITHM

#define CKA_NAME_HASH_ALGORITHM
 

Defines the mechanism used to calculate CKA_HASH_OF_SUBJECT_PUBLIC_KEY and CKA_HASH_OF_ISSUER_PUBLIC_KEY. If the attribute is not present then the type defaults to SHA-1.

#define CKA_OWNER
 

DER-encoding of the attribute certificate's subject field. This is distinct from the CKA_SUBJECT attribute contained in CKC_X_509 certificates because the ASN.1 syntax and encoding are different.

#define CKA_AC_ISSUER
 

DER-encoding of the attribute certificate's issuer field. This is distinct from the CKA_ISSUER attribute contained in CKC_X_509 certificates because the ASN.1 syntax and encoding are different. (default empty)

#define CKA_SERIAL_NUMBER
 

DER-encoding of the certificate serial number (default empty). (default empty)

#define CKA_ATTR_TYPES
 

BER-encoding of a sequence of object identifier values corresponding to the attribute types contained in the certificate. When present, this field offers an opportunity for applications to search for a particular attribute certificate without fetching and parsing the certificate itself. (default empty)

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_KEY_TYPE
 

Type of key.

#define CKA_ID
 

Key identifier for public/private key pair (default empty).

#define CKA_START_DATE
 

Start date for the certificate (default empty).

#define CKA_END_DATE
 

End date for the certificate (default empty).

#define CKA_DERIVE
 

CK_TRUE if key supports key derivation (''i.e.'', if other keys can be derived from this one (default CK_FALSE).

#define CKA_LOCAL
 

CK_TRUE only if key was either * generated locally (''i.e.'', on the token) with a '''C_GenerateKey''' or '''C_GenerateKeyPair''' call * created with a '''C_CopyObject''' call as a copy of a key which had its '''CKA_LOCAL''' attribute set to CK_TRUE.

#define CKA_KEY_GEN_MECHANISM
 

Identifier of the mechanism used to generate the key material.

#define CKA_ALLOWED_MECHANISMS
 

A list of mechanisms allowed to be used with this key. The number of mechanisms in the array is the ''ulValueLen'' component of the attribute divided by the size of CK_MECHANISM_TYPE.

#define CKA_SUBJECT
 

DER-encoding of the certificate subject name.

#define CKA_ENCRYPT
 

CK_TRUE if key supports encryption9.

#define CKA_VERIFY
 

CK_TRUE if key supports verification where the signature is an appendix to the data9.

#define CKA_VERIFY_RECOVER
 

CK_TRUE if key supports verification where the data is recovered from the signature9.

#define CKA_WRAP
 

CK_TRUE if key supports wrapping (''i.e.'', can be used to wrap other keys)9.

#define CKA_TRUSTED
 

The certificate can be trusted for the application that it was created. The wrapping key can be used to wrap keys with CKA_WRAP_WITH_TRUSTED set to CK_TRUE.

#define CKA_WRAP_TEMPLATE
 

For wrapping keys. The attribute template to match against any keys wrapped using this wrapping key. Keys that do not match cannot be wrapped. The number of attributes in the array is the ''ulValueLen'' component of the attribute divided by the size of CK_ATTRIBUTE.

#define CKA_SUBJECT
 

DER-encoding of the certificate subject name.

#define CKA_SENSITIVE
 

CK_TRUE if key is sensitive9 .

#define CKA_DECRYPT
 

CK_TRUE if key supports decryption9.

#define CKA_SIGN
 

CK_TRUE if key supports signatures where the signature is an appendix to the data9.

#define CKA_SIGN_RECOVER
 

CK_TRUE if key supports signatures where the data can be recovered from the signature9.

#define CKA_UNWRAP
 

CK_TRUE if key supports unwrapping (''i.e.'', can be used to unwrap other keys)9.

#define CKA_EXTRACTABLE
 

CK_TRUE if key is extractable and can be wrapped 9.

#define CKA_ALWAYS_SENSITIVE
 

CK_TRUE if key has ''always'' had the CKA_SENSITIVE attribute set to CK_TRUE.

#define CKA_NEVER_EXTRACTABLE
 

CK_TRUE if key has ''never'' had the CKA_EXTRACTABLE attribute set to CK_TRUE.

#define CKA_WRAP_WITH_TRUSTED
 

CK_TRUE if the key can only be wrapped with a wrapping key that has CKA_TRUSTED set to CK_TRUE. Default is CK_FALSE.

#define CKA_UNWRAP_TEMPLATE
 

For wrapping keys. The attribute template to apply to any keys unwrapped using this wrapping key. Any user supplied template is applied after this template as if the object has already been created. The number of attributes in the array is the ''ulValueLen'' component of the attribute divided by the size of CK_ATTRIBUTE.

#define CKA_ALWAYS_AUTHENTICATE
 

If CK_TRUE, the user has to supply the PIN for each use (sign or decrypt) with the key. Default is CK_FALSE.

#define CKA_SENSITIVE
 

CK_TRUE if key is sensitive9 .

#define CKA_ENCRYPT
 

CK_TRUE if key supports encryption9.

#define CKA_DECRYPT
 

CK_TRUE if key supports decryption9.

#define CKA_SIGN
 

CK_TRUE if key supports signatures where the signature is an appendix to the data9.

#define CKA_VERIFY
 

CK_TRUE if key supports verification where the signature is an appendix to the data9.

#define CKA_WRAP
 

CK_TRUE if key supports wrapping (''i.e.'', can be used to wrap other keys)9.

#define CKA_UNWRAP
 

CK_TRUE if key supports unwrapping (''i.e.'', can be used to unwrap other keys)9.

#define CKA_EXTRACTABLE
 

CK_TRUE if key is extractable and can be wrapped 9.

#define CKA_ALWAYS_SENSITIVE
 

CK_TRUE if key has ''always'' had the CKA_SENSITIVE attribute set to CK_TRUE.

#define CKA_NEVER_EXTRACTABLE
 

CK_TRUE if key has ''never'' had the CKA_EXTRACTABLE attribute set to CK_TRUE.

#define CKA_CHECK_VALUE
 

Checksum.

#define CKA_WRAP_WITH_TRUSTED
 

CK_TRUE if the key can only be wrapped with a wrapping key that has CKA_TRUSTED set to CK_TRUE. Default is CK_FALSE.

#define CKA_TRUSTED
 

The certificate can be trusted for the application that it was created. The wrapping key can be used to wrap keys with CKA_WRAP_WITH_TRUSTED set to CK_TRUE.

#define CKA_WRAP_TEMPLATE
 

For wrapping keys. The attribute template to match against any keys wrapped using this wrapping key. Keys that do not match cannot be wrapped. The number of attributes in the array is the ''ulValueLen'' component of the attribute divided by the size of CK_ATTRIBUTE.

#define CKA_UNWRAP_TEMPLATE
 

For wrapping keys. The attribute template to apply to any keys unwrapped using this wrapping key. Any user supplied template is applied after this template as if the object has already been created. The number of attributes in the array is the ''ulValueLen'' component of the attribute divided by the size of CK_ATTRIBUTE.

#define CKA_KEY_TYPE
 

Type of key.

#define CKA_LOCAL
 

CK_TRUE only if key was either * generated locally (''i.e.'', on the token) with a '''C_GenerateKey''' or '''C_GenerateKeyPair''' call * created with a '''C_CopyObject''' call as a copy of a key which had its '''CKA_LOCAL''' attribute set to CK_TRUE.

#define CKA_MECHANISM_TYPE
 

The type of mechanism object.

#define CKR_GENERAL_ERROR
 

Some horrible, unrecoverable error has occurred. In the worst case, it is possible that the function only partially succeeded, and that the computer and/or token is in an inconsistent state.

#define CKR_HOST_MEMORY
 

The computer that the Cryptoki library is running on has insufficient memory to perform the requested function.

#define CKR_FUNCTION_FAILED
 

The requested function could not be performed, but detailed information about why not is not available in this error return. If the failed function uses a session, it is possible that the '''CK_SESSION_INFO''' structure that can be obtained by calling '''C_GetSessionInfo''' will hold useful information about what happened in its ''ulDeviceError'' field. In any event, although the function call failed, the situation is not necessarily totally hopeless, as it is likely to be when CKR_GENERAL_ERROR is returned. Depending on what the root cause of the error actually was, it is possible that an attempt to make the exact same function call again would succeed.

#define CKR_OK
 

The function executed successfully. Technically, CKR_OK is not ''quite'' a "universal" return value; in particular, the legacy functions '''C_GetFunctionStatus''' and '''C_CancelFunction''' (see Section 11.16) cannot return CKR_OK.

#define CKR_SESSION_HANDLE_INVALID
 

The specified session handle was invalid ''at the time that the function was invoked''. Note that this can happen if the session's token is removed before the function invocation, since removing a token closes all sessions with it.

#define CKR_DEVICE_REMOVED
 

The token was removed from its slot ''during the execution of the function''.

#define CKR_SESSION_CLOSED
 

The session was closed ''during the execution of the function''. Note that, as stated in Section 6.7.6, the behavior of Cryptoki is ''undefined'' if multiple threads of an application attempt to access a common Cryptoki session simultaneously. Therefore, there is actually no guarantee that a function invocation could ever return the value CKR_SESSION_CLOSED"if one thread is using a session when another thread closes that session, that is an instance of multiple threads accessing a common session simultaneously.

#define CKR_DEVICE_MEMORY
 

The token does not have sufficient memory to perform the requested function.

#define CKR_DEVICE_ERROR
 

Some problem has occurred with the token and/or slot. This error code can be returned by more than just the functions mentioned above; in particular, it is possible for '''C_GetSlotInfo''' to return CKR_DEVICE_ERROR.

#define CKR_TOKEN_NOT_PRESENT
 

The token was not present in its slot ''at the time that the function was invoked''.

#define CKR_DEVICE_REMOVED
 

The token was removed from its slot ''during the execution of the function''.

#define CKR_CANCEL
 

When a function executing in serial with an application decides to give the application a chance to do some work, it calls an application-supplied function with a CKN_SURRENDER callback (see Section 11.17). If the callback returns the value CKR_CANCEL, then the function aborts and returns CKR_FUNCTION_CANCELED.

#define CKR_MUTEX_BAD
 

This error code can be returned by mutex-handling functions who are passed a bad mutex object as an argument. Unfortunately, it is possible for such a function not to recognize a bad mutex object. There is therefore no guarantee that such a function will successfully detect bad mutex objects and return this value.

#define CKR_MUTEX_NOT_LOCKED
 

This error code can be returned by mutex-unlocking functions. It indicates that the mutex supplied to the mutex-unlocking function was not locked.

#define CKR_ARGUMENTS_BAD
 

This is a rather generic error code which indicates that the arguments supplied to the Cryptoki function were in some way not appropriate.

#define CKR_ATTRIBUTE_READ_ONLY
 

An attempt was made to set a value for an attribute which may not be set by the application, or which may not be modified by the application. See Section 10.1 for more information.

#define CKR_ATTRIBUTE_SENSITIVE
 

An attempt was made to obtain the value of an attribute of an object which cannot be satisfied because the object is either sensitive or unextractable.

#define CKR_ATTRIBUTE_TYPE_INVALID
 

An invalid attribute type was specified in a template. See Section 10.1 for more information.

#define CKR_ATTRIBUTE_VALUE_INVALID
 

An invalid value was specified for a particular attribute in a template. See Section 10.1 for more information.

#define CKR_BUFFER_TOO_SMALL
 

The output of the function is too large to fit in the supplied buffer.

#define CKR_CANT_LOCK
 

This value can only be returned by '''C_Initialize'''. It means that the type of locking requested by the application for thread-safety is not available in this library, and so the application cannot make use of this library in the specified fashion.

#define CKR_CRYPTOKI_ALREADY_INITIALIZED
 

This value can only be returned by '''C_Initialize'''. It means that the Cryptoki library has already been initialized (by a previous call to '''C_Initialize''' which did not have a matching '''C_Finalize''' call).

#define CKR_CRYPTOKI_NOT_INITIALIZED
 

This value can be returned by any function other than '''C_Initialize''' and '''C_GetFunctionList'''. It indicates that the function cannot be executed because the Cryptoki library has not yet been initialized by a call to '''C_Initialize'''.

#define CKR_DATA_INVALID
 

The plaintext input data to a cryptographic operation is invalid. This return value has lower priority than CKR_DATA_LEN_RANGE.

#define CKR_DATA_LEN_RANGE
 

The plaintext input data to a cryptographic operation has a bad length. Depending on the operation's mechanism, this could mean that the plaintext data is too short, too long, or is not a multiple of some particular blocksize. This return value has higher priority than CKR_DATA_INVALID.

#define CKR_DOMAIN_PARAMS_INVALID
 

Invalid or unsupported domain parameters were supplied to the function. Which representation methods of domain parameters are supported by a given mechanism can vary from token to token.

#define CKR_ENCRYPTED_DATA_INVALID
 

The encrypted input to a decryption operation has been determined to be invalid ciphertext. This return value has lower priority than CKR_ENCRYPTED_DATA_LEN_RANGE.

#define CKR_ENCRYPTED_DATA_LEN_RANGE
 

The ciphertext input to a decryption operation has been determined to be invalid ciphertext solely on the basis of its length. Depending on the operation's mechanism, this could mean that the ciphertext is too short, too long, or is not a multiple of some particular blocksize. This return value has higher priority than CKR_ENCRYPTED_DATA_INVALID.

#define CKR_EXCEEDED_MAX_ITERATIONS
 

An iterative algorithm (for key pair generation, domain parameter generation etc.) failed because we have exceeded the maximum number of iterations. This error code has precedence over CKR_FUNCTION_FAILED. Examples of iterative algorithms include DSA signature generation (retry if either r = 0 or s = 0) and generation of DSA primes p and q specified in FIPS 186-2.

#define CKR_FIPS_SELF_TEST_FAILED
 

A FIPS 140-2 power-up self-test or conditional self-test failed. The token entered an error state. Future calls to cryptographic functions on the token will return CKR_GENERAL_ERROR. CKR_FIPS_SELF_TEST_FAILED has a higher precedence over CKR_GENERAL_ERROR. This error may be returned by C_Initialize, if a power-up self-test failed, by C_GenerateRandom or C_SeedRandom, if the continuous random number generator test failed, or by C_GenerateKeyPair, if the pair-wise consistency test failed.

#define CKR_FUNCTION_CANCELED
 

The function was canceled in mid-execution. This happens to a cryptographic function if the function makes a '''CKN_SURRENDER''' application callback which returns CKR_CANCEL (see CKR_CANCEL). It also happens to a function that performs PIN entry through a protected path. The method used to cancel a protected path PIN entry operation is device dependent.

#define CKR_FUNCTION_NOT_PARALLEL
 

There is currently no function executing in parallel in the specified session. This is a legacy error code which is only returned by the legacy functions '''C_GetFunctionStatus''' and '''C_CancelFunction'''.

#define CKR_FUNCTION_NOT_SUPPORTED
 

The requested function is not supported by this Cryptoki library. Even unsupported functions in the Cryptoki API should have a "stub" in the library; this stub should simply return the value CKR_FUNCTION_NOT_SUPPORTED.

#define CKR_FUNCTION_REJECTED
 

The signature request is rejected by the user.

#define CKR_INFORMATION_SENSITIVE
 

The information requested could not be obtained because the token considers it sensitive, and is not able or willing to reveal it.

#define CKR_KEY_CHANGED
 

This value is only returned by '''C_SetOperationState'''. It indicates that one of the keys specified is not the same key that was being used in the original saved session.

#define CKR_KEY_FUNCTION_NOT_PERMITTED
 

An attempt has been made to use a key for a cryptographic purpose that the key's attributes are not set to allow it to do. For example, to use a key for performing encryption, that key must have its '''CKA_ENCRYPT''' attribute set to CK_TRUE (the fact that the key must have a '''CKA_ENCRYPT''' attribute implies that the key cannot be a private key). This return value has lower priority than CKR_KEY_TYPE_INCONSISTENT.

#define CKR_KEY_HANDLE_INVALID
 

The specified key handle is not valid. It may be the case that the specified handle is a valid handle for an object which is not a key. We reiterate here that 0 is never a valid key handle.

#define CKR_KEY_INDIGESTIBLE
 

This error code can only be returned by '''C_DigestKey'''. It indicates that the value of the specified key cannot be digested for some reason (perhaps the key isn't a secret key, or perhaps the token simply can't digest this kind of key).

#define CKR_KEY_NEEDED
 

This value is only returned by '''C_SetOperationState'''. It indicates that the session state cannot be restored because '''C_SetOperationState''' needs to be supplied with one or more keys that were being used in the original saved session.

#define CKR_KEY_NOT_NEEDED
 

An extraneous key was supplied to '''C_SetOperationState'''. For example, an attempt was made to restore a session that had been performing a message digesting operation, and an encryption key was supplied.

#define CKR_KEY_NOT_WRAPPABLE
 

Although the specified private or secret key does not have its CKA_EXTRACTABLE attribute set to CK_FALSE, Cryptoki (or the token) is unable to wrap the key as requested (possibly the token can only wrap a given key with certain types of keys, and the wrapping key specified is not one of these types). Compare with CKR_KEY_UNEXTRACTABLE.

#define CKR_KEY_SIZE_RANGE
 

Although the requested keyed cryptographic operation could in principle be carried out, this Cryptoki library (or the token) is unable to actually do it because the supplied key's size is outside the range of key sizes that it can handle.

#define CKR_KEY_TYPE_INCONSISTENT
 

The specified key is not the correct type of key to use with the specified mechanism. This return value has a higher priority than CKR_KEY_FUNCTION_NOT_PERMITTED.

#define CKR_KEY_UNEXTRACTABLE
 

The specified private or secret key can't be wrapped because its CKA_EXTRACTABLE attribute is set to CK_FALSE. Compare with CKR_KEY_NOT_WRAPPABLE.

#define CKR_LIBRARY_LOAD_FAILED
 

The Cryptoki library could not load a dependent shared library.

#define CKR_MECHANISM_INVALID
 

An invalid mechanism was specified to the cryptographic operation. This error code is an appropriate return value if an unknown mechanism was specified or if the mechanism specified cannot be used in the selected token with the selected function.

#define CKR_MECHANISM_PARAM_INVALID
 

Invalid parameters were supplied to the mechanism specified to the cryptographic operation. Which parameter values are supported by a given mechanism can vary from token to token.

#define CKR_NEED_TO_CREATE_THREADS
 

This value can only be returned by '''C_Initialize'''. It is returned when two conditions hold:

#define CKR_NO_EVENT
 

This value can only be returned by '''C_GetSlotEvent'''. It is returned when '''C_GetSlotEvent''' is called in non-blocking mode and there are no new slot events to return.

#define CKR_OBJECT_HANDLE_INVALID
 

The specified object handle is not valid. We reiterate here that 0 is never a valid object handle.

#define CKR_OPERATION_ACTIVE
 

There is already an active operation (or combination of active operations) which prevents Cryptoki from activating the specified operation. For example, an active object-searching operation would prevent Cryptoki from activating an encryption operation with '''C_EncryptInit'''. Or, an active digesting operation and an active encryption operation would prevent Cryptoki from activating a signature operation. Or, on a token which doesn't support simultaneous dual cryptographic operations in a session (see the description of the '''CKF_DUAL_CRYPTO_OPERATIONS''' flag in the '''CK_TOKEN_INFO''' structure), an active signature operation would prevent Cryptoki from activating an encryption operation.

#define CKR_OPERATION_NOT_INITIALIZED
 

There is no active operation of an appropriate type in the specified session. For example, an application cannot call '''C_Encrypt''' in a session without having called '''C_EncryptInit''' first to activate an encryption operation.

#define CKR_PIN_EXPIRED
 

The specified PIN has expired, and the requested operation cannot be carried out unless C_SetPIN is called to change the PIN value. Whether or not the normal user's PIN on a token ever expires varies from token to token.

#define CKR_PIN_INCORRECT
 

The specified PIN is incorrect, ''i.e.'', does not match the PIN stored on the token. More generally-- when authentication to the token involves something other than a PIN-- the attempt to authenticate the user has failed.

#define CKR_PIN_INVALID
 

The specified PIN has invalid characters in it. This return code only applies to functions which attempt to set a PIN.

#define CKR_PIN_LEN_RANGE
 

The specified PIN is too long or too short. This return code only applies to functions which attempt to set a PIN.

#define CKR_PIN_LOCKED
 

The specified PIN is "locked", and cannot be used. That is, because some particular number of failed authentication attempts has been reached, the token is unwilling to permit further attempts at authentication. Depending on the token, the specified PIN may or may not remain locked indefinitely.

#define CKR_PIN_TOO_WEAK
 

The specified PIN is too weak so that it could be easy to guess. If the PIN is too short, CKR_PIN_LEN_RANGE should be returned instead. This return code only applies to functions which attempt to set a PIN.

#define CKR_PUBLIC_KEY_INVALID
 

The public key fails a public key validation. For example, an EC public key fails the public key validation specified in Section 5.2.2 of ANSI X9.62. This error code may be returned by C_CreateObject, when the public key is created, or by C_VerifyInit or C_VerifyRecoverInit, when the public key is used. It may also be returned by C_DeriveKey, in preference to CKR_MECHANISM_PARAM_INVALID, if the other party's public key specified in the mechanism's parameters is invalid.

#define CKR_RANDOM_NO_RNG
 

This value can be returned by '''C_SeedRandom''' and '''C_GenerateRandom'''. It indicates that the specified token doesn't have a random number generator. This return value has higher priority than CKR_RANDOM_SEED_NOT_SUPPORTED.

#define CKR_RANDOM_SEED_NOT_SUPPORTED
 

This value can only be returned by '''C_SeedRandom'''. It indicates that the token's random number generator does not accept seeding from an application. This return value has lower priority than CKR_RANDOM_NO_RNG.

#define CKR_SAVED_STATE_INVALID
 

This value can only be returned by '''C_SetOperationState'''. It indicates that the supplied saved cryptographic operations state is invalid, and so it cannot be restored to the specified session.

#define CKR_SESSION_COUNT
 

This value can only be returned by '''C_OpenSession'''. It indicates that the attempt to open a session failed, either because the token has too many sessions already open, or because the token has too many read/write sessions already open.

#define CKR_SESSION_EXISTS
 

This value can only be returned by '''C_InitToken'''. It indicates that a session with the token is already open, and so the token cannot be initialized.

#define CKR_SESSION_PARALLEL_NOT_SUPPORTED
 

The specified token does not support parallel sessions. This is a legacy error code"in Cryptoki Version 2.01 and up, ''no'' token supports parallel sessions. CKR_SESSION_PARALLEL_NOT_SUPPORTED can only be returned by '''C_OpenSession''', and it is only returned when '''C_OpenSession''' is called in a particular [deprecated] way.

#define CKR_SESSION_READ_ONLY
 

The specified session was unable to accomplish the desired action because it is a read-only session. This return value has lower priority than CKR_TOKEN_WRITE_PROTECTED.

#define CKR_SESSION_READ_ONLY_EXISTS
 

A read-only session already exists, and so the SO cannot be logged in.

#define CKR_SESSION_READ_WRITE_SO_EXISTS
 

A read/write SO session already exists, and so a read-only session cannot be opened.

#define CKR_SIGNATURE_LEN_RANGE
 

The provided signature/MAC can be seen to be invalid solely on the basis of its length. This return value has higher priority than CKR_SIGNATURE_INVALID.

#define CKR_SIGNATURE_INVALID
 

The provided signature/MAC is invalid. This return value has lower priority than CKR_SIGNATURE_LEN_RANGE.

#define CKR_SLOT_ID_INVALID
 

The specified slot ID is not valid.

#define CKR_STATE_UNSAVEABLE
 

The cryptographic operations state of the specified session cannot be saved for some reason (possibly the token is simply unable to save the current state). This return value has lower priority than CKR_OPERATION_NOT_INITIALIZED.

#define CKR_TEMPLATE_INCOMPLETE
 

The template specified for creating an object is incomplete, and lacks some necessary attributes. See Section 10.1 for more information.

#define CKR_TEMPLATE_INCONSISTENT
 

The template specified for creating an object has conflicting attributes. See Section 10.1 for more information.

#define CKR_TOKEN_NOT_RECOGNIZED
 

The Cryptoki library and/or slot does not recognize the token in the slot.

#define CKR_TOKEN_WRITE_PROTECTED
 

The requested action could not be performed because the token is write-protected. This return value has higher priority than CKR_SESSION_READ_ONLY.

#define CKR_UNWRAPPING_KEY_HANDLE_INVALID
 

This value can only be returned by '''C_UnwrapKey'''. It indicates that the key handle specified to be used to unwrap another key is not valid.

#define CKR_UNWRAPPING_KEY_SIZE_RANGE
 

This value can only be returned by '''C_UnwrapKey'''. It indicates that although the requested unwrapping operation could in principle be carried out, this Cryptoki library (or the token) is unable to actually do it because the supplied key's size is outside the range of key sizes that it can handle.

#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
 

This value can only be returned by '''C_UnwrapKey'''. It indicates that the type of the key specified to unwrap another key is not consistent with the mechanism specified for unwrapping.

#define CKR_USER_ALREADY_LOGGED_IN
 

This value can only be returned by '''C_Login'''. It indicates that the specified user cannot be logged into the session, because it is already logged into the session. For example, if an application has an open SO session, and it attempts to log the SO into it, it will receive this error code.

#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN
 

This value can only be returned by '''C_Login'''. It indicates that the specified user cannot be logged into the session, because another user is already logged into the session. For example, if an application has an open SO session, and it attempts to log the normal user into it, it will receive this error code.

#define CKR_USER_NOT_LOGGED_IN
 

The desired action cannot be performed because the appropriate user (or ''an'' appropriate user) is not logged in. One example is that a session cannot be logged out unless it is logged in. Another example is that a private object cannot be created on a token unless the session attempting to create it is logged in as the normal user. A final example is that cryptographic operations on certain tokens cannot be performed unless the normal user is logged in.

#define CKR_USER_PIN_NOT_INITIALIZED
 

This value can only be returned by '''C_Login'''. It indicates that the normal user's PIN has not yet been initialized with '''C_InitPIN'''.

#define CKR_USER_TOO_MANY_TYPES
 

An attempt was made to have more distinct users simultaneously logged into the token than the token and/or library permits. For example, if some application has an open SO session, and another application attempts to log the normal user into a session, the attempt may return this error. It is not required to, however. Only if the simultaneous distinct users cannot be supported does '''C_Login''' have to return this value. Note that this error code generalizes to true multi-user tokens.

#define CKR_USER_TYPE_INVALID
 

An invalid value was specified as a '''CK_USER_TYPE'''. Valid types are '''CKU_SO''', '''CKU_USER''', and '''CKU_CONTEXT_SPECIFIC'''.

#define CKR_WRAPPED_KEY_INVALID
 

This value can only be returned by '''C_UnwrapKey'''. It indicates that the provided wrapped key is not valid. If a call is made to '''C_UnwrapKey''' to unwrap a particular type of key (''i.e.'', some particular key type is specified in the template provided to '''C_UnwrapKey'''), and the wrapped key provided to '''C_UnwrapKey''' is recognizably not a wrapped key of the proper type, then '''C_UnwrapKey''' should return CKR_WRAPPED_KEY_INVALID. This return value has lower priority than CKR_WRAPPED_KEY_LEN_RANGE.

#define CKR_WRAPPED_KEY_LEN_RANGE
 

This value can only be returned by '''C_UnwrapKey'''. It indicates that the provided wrapped key can be seen to be invalid solely on the basis of its length. This return value has higher priority than CKR_WRAPPED_KEY_INVALID.

#define CKR_WRAPPING_KEY_HANDLE_INVALID
 

This value can only be returned by '''C_WrapKey'''. It indicates that the key handle specified to be used to wrap another key is not valid.

#define CKR_WRAPPING_KEY_SIZE_RANGE
 

This value can only be returned by '''C_WrapKey'''. It indicates that although the requested wrapping operation could in principle be carried out, this Cryptoki library (or the token) is unable to actually do it because the supplied wrapping key's size is outside the range of key sizes that it can handle.

#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT
 

This value can only be returned by '''C_WrapKey'''. It indicates that the type of the key specified to wrap another key is not consistent with the mechanism specified for wrapping.

#define CKA_MODULUS
 

Modulus ''n''.

#define CKA_MODULUS_BITS
 

Length in bits of modulus ''n''.

#define CKA_PUBLIC_EXPONENT
 

Public exponent ''e''.

#define CKA_MODULUS
 

Modulus ''n''.

#define CKA_PUBLIC_EXPONENT
 

Public exponent ''e''.

#define CKA_PRIVATE_EXPONENT
 

Private exponent ''d''.

#define CKA_PRIME_1
 

Prime ''p''.

#define CKA_PRIME_2
 

Prime ''q''.

#define CKA_EXPONENT_1
 

Private exponent ''d'' modulo ''p''-1.

#define CKA_EXPONENT_2
 

Private exponent ''d'' modulo ''q''-1.

#define CKA_COEFFICIENT
 

CRT coefficient ''q''-1 mod ''p''.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_PRIME_BITS
 

Length of the prime value.

#define CKA_EC_PARAMS
 

DER-encoding of an ANSI X9.62 Parameters value.

#define CKA_EC_POINT
 

DER-encoding of ANSI X9.62 ECPoint value ''Q''.

#define CKA_EC_PARAMS
 

DER-encoding of an ANSI X9.62 Parameters value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_BITS
 

Length in bits of private value ''x''.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_PRIME_BITS
 

Length of the prime value.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_PRIME_BITS
 

Length of the prime value.

#define CKA_SUBPRIME_BITS
 

Length of the subprime value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_REQUIRED_CMS_ATTRIBUTES
 

Attributes the token always will include in the set of CMS signed attributes.

#define CKA_DEFAULT_CMS_ATTRIBUTES
 

Attributes the token will include in the set of CMS signed attributes in the absence of any attributes specified by the application.

#define CKA_SUPPORTED_CMS_ATTRIBUTES
 

Attributes the token may include in the set of CMS signed attributes upon request by the application.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_OTP_FORMAT
 

Format of OTP values produced with this key: CK_OTP_FORMAT_DECIMAL = Decimal (default) (UTF8-encoded) CK_OTP_FORMAT_HEXADECIMAL = Hexadecimal (UTF8-encoded) CK_OTP_FORMAT_ALPHANUMERIC = Alphanumeric (UTF8-encoded) CK_OTP_FORMAT_BINARY = Only binary values.

#define CKA_OTP_LENGTH
 

Default length of OTP values (in the CKA_OTP_FORMAT) produced with this key.

#define CKA_OTP_USER_FRIENDLY_MODE
 

Set to CK_TRUE when the token is capable of returning OTPs suitable for human consumption. See the description of CKF_USER_FRIENDLY_OTP below.

#define CKA_OTP_CHALLENGE_REQUIREMENT
 

Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A challenge must be supplied. CK_OTP_PARAM_OPTIONAL = A challenge may be supplied but need not be. CK_OTP_PARAM_IGNORED = A challenge, if supplied, will be ignored.

#define CKA_OTP_TIME_REQUIREMENT
 

Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A time value must be supplied. CK_OTP_PARAM_OPTIONAL = A time value may be supplied but need not be. CK_OTP_PARAM_IGNORED = A time value, if supplied, will be ignored.

#define CKA_OTP_COUNTER_REQUIREMENT
 

Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A counter value must be supplied. CK_OTP_PARAM_OPTIONAL = A counter value may be supplied but need not be. CK_OTP_PARAM_IGNORED = A counter value, if supplied, will be ignored.

#define CKA_OTP_PIN_REQUIREMENT
 

Parameter requirements when generating or verifying OTP values with this key: CK_OTP_PARAM_MANDATORY = A PIN value must be supplied. CK_OTP_PARAM_OPTIONAL = A PIN value may be supplied but need not be (if not supplied, then library will be responsible for collecting it) CK_OTP_PARAM_IGNORED = A PIN value, if supplied, will be ignored.

#define CKA_OTP_COUNTER
 

Value of the associated internal counter. Default value is empty (i.e. ''ulValueLen'' = 0).

#define CKA_OTP_TIME
 

Value of the associated internal UTC time in the form YYYYMMDDhhmmss. Default value is empty (i.e. ''ulValueLen''= 0).

#define CKA_OTP_USER_IDENTIFIER
 

Text string that identifies a user associated with the OTP key (may be used to enhance the user experience). Default value is empty (i.e. ''ulValueLen'' = 0).

#define CKA_OTP_SERVICE_IDENTIFIER
 

Text string that identifies a service that may validate OTPs generated by this key. Default value is empty (i.e. ''ulValueLen'' = 0).

#define CKA_OTP_SERVICE_LOGO
 

Logotype image that identifies a service that may validate OTPs generated by this key. Default value is empty (i.e. ''ulValueLen'' = 0).

#define CKA_OTP_SERVICE_LOGO_TYPE
 

MIME type of the CKA_OTP_SERVICE_LOGO attribute value. Default value is empty (i.e. ''ulValueLen'' = 0).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CK_OTP_PIN
 

A UTF8 string containing a PIN for use when computing or verifying PIN-based OTP values.

#define CK_OTP_CHALLENGE
 

Challenge to use when computing or verifying challenge-based OTP values.

#define CK_OTP_TIME
 

UTC time value in the form YYYYMMDDhhmmss to use when computing or verifying time-based OTP values.

#define CK_OTP_COUNTER
 

Counter value to use when computing or verifying counter-based OTP values.

#define CK_OTP_FLAGS
 

Bit flags indicating the characteristics of the sought OTP as defined below.

#define CK_OTP_OUTPUT_LENGTH
 

Desired output length (overrides any default value). A Cryptoki library will return CKR_MECHANISM_PARAM_INVALID if a provided length value is not supported.

#define CK_OTP_FORMAT
 

Returned OTP format (allowed values are the same as for CKA_OTP_FORMAT). This parameter is only intended for '''C_Sign''' output, see below. When not present, the returned OTP format will be the same as the value of the CKA_OTP_FORMAT attribute for the key in question.

#define CK_OTP_VALUE
 

An actual OTP value. This parameter type is intended for '''C_Sign''' output, see below.

#define CKF_NEXT_OTP
 

True (i.e. set) if the OTP computation shall be for the next OTP, rather than the current one (current being interpreted in the context of the algorithm, e.g. for the current counter value or current time window). A Cryptoki library shall return CKR_MECHANISM_PARAM_INVALID if the CKF_NEXT_OTP flag is set and the OTP mechanism in question does not support the concept of "next" OTP or the library is not capable of generating the next OTP

Applications that may need to retrieve the next OTP should be prepared to handle this situation. For example, an application could store the OTP value returned by C_Sign so that, if a next OTP is required, it can compare it to the OTP value returned by subsequent calls to C_Sign should it turn out that the library does not support the CKF_NEXT_OTP flag.

.

#define CKF_EXCLUDE_TIME
 

True (i.e. set) if the OTP computation must not include a time value. Will have an effect only on mechanisms that do include a time value in the OTP computation and then only if the mechanism (and token) allows exclusion of this value. A Cryptoki library shall return CKR_MECHANISM_PARAM_INVALID if exclusion of the value is not allowed.

#define CKF_EXCLUDE_COUNTER
 

True (i.e. set) if the OTP computation must not include a counter value. Will have an effect only on mechanisms that do include a counter value in the OTP computation and then only if the mechanism (and token) allows exclusion of this value. A Cryptoki library shall return CKR_MECHANISM_PARAM_INVALID if exclusion of the value is not allowed.

#define CKF_EXCLUDE_CHALLENGE
 

True (i.e. set) if the OTP computation must not include a challenge. Will have an effect only on mechanisms that do include a challenge in the OTP computation and then only if the mechanism (and token) allows exclusion of this value. A Cryptoki library shall return CKR_MECHANISM_PARAM_INVALID if exclusion of the value is not allowed.

#define CKF_EXCLUDE_PIN
 

True (i.e. set) if the OTP computation must not include a PIN value. Will have an effect only on mechanisms that do include a PIN in the OTP computation and then only if the mechanism (and token) allows exclusion of this value. A Cryptoki library shall return CKR_MECHANISM_PARAM_INVALID if exclusion of the value is not allowed.

#define CKF_USER_FRIENDLY_OTP
 

True (i.e. set) if the OTP returned shall be in a form suitable for human consumption. If this flag is set, and the call is successful, then the returned CK_OTP_VALUE shall be a UTF8-encoded printable string. A Cryptoki library shall return CKR_MECHANISM_PARAM_INVALID if this flag is set when CKA_OTP_USER_FRIENDLY_MODE for the key in question is CK_FALSE.

#define CKA_OTP_TIME_INTERVAL
 

Interval between OTP values produced with this key, in seconds. Default is 60.

#define CKR_NEW_PIN_MODE
 

The supplied OTP was not accepted and the library requests a new OTP computed using a new PIN. The new PIN is set through means out of scope for this document.

#define CKR_NEXT_OTP
 

The supplied OTP was correct but indicated a larger than normal drift in the token's internal state (e.g. clock, counter). To ensure this was not due to a temporary problem, the application should provide the next one-time password to the library for verification.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_GOST28147_PARAMS
 

DER-encoding of the object identifier indicating the data object type of GOST 28147-89. When key is used the domain parameter object of key type CKK_GOST28147 must be specified with the same attribute CKA_OBJECT_ID

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_OBJECT_ID
 

DER-encoding of the object identifier indicating the data object type (default empty).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_OBJECT_ID
 

DER-encoding of the object identifier indicating the data object type (default empty).

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_GOSTR3410PARAMS
 

DER-encoding of the object identifier indicating the data object type of GOST R 34.10-2001. When key is used the domain parameter object of key type CKK_GOSTR3410 must be specified with the same attribute CKA_OBJECT_ID

#define CKA_GOSTR3411PARAMS
 

DER-encoding of the object identifier indicating the data object type of GOST R 34.11-94. When key is used the domain parameter object of key type CKK_GOSTR3411 must be specified with the same attribute CKA_OBJECT_ID

#define CKA_GOST28147_PARAMS
 

DER-encoding of the object identifier indicating the data object type of GOST 28147-89. When key is used the domain parameter object of key type CKK_GOST28147 must be specified with the same attribute CKA_OBJECT_ID

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_GOSTR3410PARAMS
 

DER-encoding of the object identifier indicating the data object type of GOST R 34.10-2001. When key is used the domain parameter object of key type CKK_GOSTR3410 must be specified with the same attribute CKA_OBJECT_ID

#define CKA_GOSTR3411PARAMS
 

DER-encoding of the object identifier indicating the data object type of GOST R 34.11-94. When key is used the domain parameter object of key type CKK_GOSTR3411 must be specified with the same attribute CKA_OBJECT_ID

#define CKA_GOST28147_PARAMS4
 

DER-encoding of the object identifier indicating the data object type of GOST 28147-89. When key is used the domain parameter object of key type CKK_GOST28147 must be specified with the same attribute CKA_OBJECT_ID. The attribute value may be omitted

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_OBJECT_ID
 

DER-encoding of the object identifier indicating the data object type (default empty).

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_PRIME
 

Prime ''p'' (512 to 1024 bits, in steps of 64 bits).

#define CKA_SUBPRIME
 

Subprime ''q'' (160 bits).

#define CKA_BASE
 

Base ''g''.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE_LEN
 

Length in bytes of key value.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.

#define CKA_VALUE
 

Current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value is returned in big endian order.


Typedef Documentation

typedef unsigned char CK_BYTE
 

an unsigned 8-bit value.

typedef CK_BYTE CK_CHAR
 

an unsigned 8-bit character.

typedef CK_BYTE CK_UTF8CHAR
 

an 8-bit UTF-8 character.

typedef CK_BYTE CK_BBOOL
 

a BYTE-sized Boolean flag.

typedef unsigned long int CK_ULONG
 

an unsigned value, at least 32 bits long.

typedef long int CK_LONG
 

a signed value, the same size as a CK_ULONG.

typedef CK_ULONG CK_FLAGS
 

at least 32 bits; each bit is a Boolean flag.

typedef CK_BYTE CK_PTR CK_BYTE_PTR
 

Pointer to a CK_BYTE.

typedef CK_CHAR CK_PTR CK_CHAR_PTR
 

Pointer to a CK_CHAR.

typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR
 

Pointer to a CK_UTF8CHAR.

typedef CK_ULONG CK_PTR CK_ULONG_PTR
 

Pointer to a CK_ULONG.

typedef void CK_PTR CK_VOID_PTR
 

Pointer to a void.

typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR
 

Pointer to a CK_VOID_PTR.

typedef NULL CK_PTR NULL_PTR
 

A NULL pointer.

typedef CK_RV(* myCallbackType)(args)
 

CK_CALLBACK_FUNCTION

CK_CALLBACK_FUNCTION(returnType, name), when followed by a parentheses-enclosed list of arguments and a semicolon, declares a variable or type which is a pointer to an application callback function that can be used by a Cryptoki API function in a Cryptoki library. returnType is the return type of the function, and name is its name. It can be used in either of the following fashions to define a function pointer variable, myCallback, which can point to an application callback which takes arguments args and returns a CK_RV (note that neither of the following code snippets actually assigns a value to myCallback):

typedef struct CK_VERSION CK_VERSION
 

CK_VERSION; CK_VERSION_PTR

CK_VERSION is a structure that describes the version of a Cryptoki interface, a Cryptoki library, or an SSL implementation, or the hardware or firmware version of a slot or token.
major major version number (the integer portion of the version)
minor minor version number (the hundredths portion of the version)
Example:

For version 1.0, ''major'' = 1 and ''minor'' = For version 2.10, ''major'' = 2 and ''minor'' = 10. Table 9 below lists the major and minor version values for the officially published Cryptoki specifications.

Table 9, Major and minor version values for published Cryptoki specifications
Version major minor
1.0 0x01 0x00
2.01 0x02 0x01
2.10 0x02 0x0a
2.11 0x02 0x0b
2.20 0x02 0x14
2.30 0x02 0x1e

Minor revisions of the Cryptoki standard are always upwardly compatible within the same major version number.

CK_VERSION_PTR is a pointer to a CK_VERSION.

CK_INFO; CK_INFO_PTR

CK_INFO provides general information about Cryptoki. It is defined as follows:

typedef CK_VERSION CK_PTR CK_VERSION_PTR
 

Pointer to a CK_VERSION.

typedef struct CK_INFO CK_INFO
 

CK_INFO; CK_INFO_PTR

CK_INFO provides general information about Cryptoki. It is defined as follows:
cryptokiVersion Cryptoki interface version number, for compatibility with future revisions of this interface
manufacturerID ID of the Cryptoki library manufacturer. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
flags bit flags reserved for future versions. Must be zero for this version
libraryDescription character-string description of the library. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
libraryVersion Cryptoki library version number

For libraries written to this document, the value of cryptokiVersion should match the version of this documentspecification; the value of libraryVersion is the version number of the library software itself.

CK_INFO_PTR is a pointer to a CK_INFO.

CK_NOTIFICATION

CK_NOTIFICATION holds the types of notifications that Cryptoki provides to an application. It is defined as follows:

For this version of Cryptoki, the following types of notifications are defined:

CKN_SURRENDER

The notifications have the following meanings:

CKN_SURRENDER Cryptoki is surrendering the execution of a function executing in a session so that the application may perform other operations. After performing any desired operations, the application should indicate to Cryptoki whether to continue or cancel the function (see Section 11.17.1).

typedef CK_INFO CK_PTR CK_INFO_PTR
 

Pointer to a CK_INFO.

typedef CK_ULONG CK_NOTIFICATION
 

CK_NOTIFICATION

CK_NOTIFICATION holds the types of notifications that Cryptoki provides to an application.

typedef CK_ULONG CK_SLOT_ID
 

CK_SLOT_ID; CK_SLOT_ID_PTR

CK_SLOT_ID is a Cryptoki-assigned value that identifies a slot. It is defined as follows:

typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR
 

Pointer to a CK_SLOT_ID.

typedef struct CK_SLOT_INFO CK_SLOT_INFO
 

CK_SLOT_INFO; CK_SLOT_INFO_PTR

CK_SLOT_INFO provides information about a slot. It is defined as follows:
slotDescription character-string description of the slot. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
manufacturerID ID of the slot manufacturer. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
flags bits flags that provide capabilities of the slot. The flags are defined below
hardwareVersion version number of the slot's hardware
firmwareVersion version number of the slot's firmware

The following table defines the flags field:

Table 10, Slot Information Flags
Bit Flag Mask Meaning
CKF_TOKEN_PRESENT 0x00000001 True if a token is present in the slot (e.g., a device is in the reader)
CKF_REMOVABLE_DEVICE 0x00000002 True if the reader supports removable devices
CKF_HW_SLOT 0x00000004 True if the slot is a hardware slot, as opposed to a software slot implementing a "soft token"

For a given slot, the value of the CKF_REMOVABLE_DEVICE flag never changes. In addition, if this flag is not set for a given slot, then the CKF_TOKEN_PRESENT flag for that slot is always set. That is, if a slot does not support a removable device, then that slot always has a token in it.

CK_SLOT_INFO_PTR is a pointer to a CK_SLOT_INFO.

CK_TOKEN_INFO; CK_TOKEN_INFO_PTR

CK_TOKEN_INFO provides information about a token. It is defined as follows:

typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR
 

Pointer to a CK_SLOT_INFO.

typedef struct CK_TOKEN_INFO CK_TOKEN_INFO
 

CK_TOKEN_INFO; CK_TOKEN_INFO_PTR

CK_TOKEN_INFO provides information about a token. It is defined as follows:
label application-defined label, assigned during token initialization. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
manufacturerID ID of the device manufacturer. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
model model of the device. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
serialNumber character-string serial number of the device. Must be padded with the blank character (' '). Should ''not'' be null-terminated.
flags bit flags indicating capabilities and status of the device as defined below
ulMaxSessionCount maximum number of sessions that can be opened with the token at one time by a single application (see note below)
ulSessionCount number of sessions that this application currently has open with the token (see note below)
ulMaxRwSessionCount maximum number of read/write sessions that can be opened with the token at one time by a single application (see note below)
ulRwSessionCount number of read/write sessions that this application currently has open with the token (see note below)
ulMaxPinLen maximum length in bytes of the PIN
ulMinPinLen minimum length in bytes of the PIN
ulTotalPublicMemory the total amount of memory on the token in bytes in which public objects may be stored (see note below)
ulFreePublicMemory the amount of free (unused) memory on the token in bytes for public objects (see note below)
ulTotalPrivateMemory the total amount of memory on the token in bytes in which private objects may be stored (see note below)
ulFreePrivateMemory the amount of free (unused) memory on the token in bytes for private objects (see note below)
hardwareVersion version number of hardware
firmwareVersion version number of firmware
utcTime current time as a character-string of length 16, represented in the format YYYYMMDDhhmmssxx (4 characters for the year; 2 characters each for the month, the day, the hour, the minute, and the second; and 2 additional reserved '0' characters). The value of this field only makes sense for tokens equipped with a clock, as indicated in the token information flags (see below)

The following table defines the flags field:

Table 11, Token Information Flags
Bit Flag Mask Meaning
CKF_RNG 0x00000001 True if the token has its own random number generator
CKF_WRITE_PROTECTED 0x00000002 True if the token is write-protected (see below)
CKF_LOGIN_REQUIRED 0x00000004 True if there are some cryptographic functions that a user must be logged in to perform
CKF_USER_PIN_INITIALIZED 0x00000008 True if the normal user's PIN has been initialized
CKF_RESTORE_KEY_NOT_NEEDED 0x00000020 True if a successful save of a session's cryptographic operations state always contains all keys needed to restore the state of the session
CKF_CLOCK_ON_TOKEN 0x00000040 True if token has its own hardware clock
CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100 True if token has a "protected authentication path", whereby a user can log into the token without passing a PIN through the Cryptoki library
CKF_DUAL_CRYPTO_OPERATIONS 0x00000200 True if a single session with the token can perform dual cryptographic operations (see Section 11.13)
CKF_TOKEN_INITIALIZED 0x00000400 True if the token has been initialized using C_InitToken or an equivalent mechanism outside the scope of this standard. Calling C_InitToken when this flag is set will cause the token to be reinitialized.
CKF_SECONDARY_AUTHENTICATION 0x00000800 True if the token supports secondary authentication for private key objects. (Deprecated; new implementations MUST NOT set this flag)
CKF_USER_PIN_COUNT_LOW 0x00010000 True if an incorrect user login PIN has been entered at least once since the last successful authentication.
CKF_USER_PIN_FINAL_TRY 0x00020000 True if supplying an incorrect user PIN will cause it to become locked.
CKF_USER_PIN_LOCKED 0x00040000 True if the user PIN has been locked. User login to the token is not possible.
CKF_USER_PIN_TO_BE_CHANGED 0x00080000 True if the user PIN value is the default value set by token initialization or manufacturing, or the PIN has been expired by the card.
CKF_SO_PIN_COUNT_LOW 0x00100000 True if an incorrect SO login PIN has been entered at least once since the last successful authentication.
CKF_SO_PIN_FINAL_TRY 0x00200000 True if supplying an incorrect SO PIN will cause it to become locked.
CKF_SO_PIN_LOCKED 0x00400000 True if the SO PIN has been locked. SO login to the token is not possible.
CKF_SO_PIN_TO_BE_CHANGED 0x00800000 True if the SO PIN value is the default value set by token initialization or manufacturing, or the PIN has been expired by the card.
CKF_ERROR_STATE 0x01000000 True if the token failed a FIPS 140-2 self-test and entered an error state.

Exactly what the CKF_WRITE_PROTECTED flag means is not specified in Cryptoki. An application may be unable to perform certain actions on a write-protected token; these actions can include any of the following, among others:

  • Creating/modifying/deleting any object on the token.
  • Creating/modifying/deleting a token object on the token.
  • Changing the SO's PIN.
  • Changing the normal user's PIN. The token may change the value of the CKF_WRITE_PROTECTED flag depending on the session state to implement its object management policy. For instance, the token may set the CKF_WRITE_PROTECTED flag unless the session state is R/W SO or R/W User to implement a policy that does not allow any objects, public or private, to be created, modified, or deleted unless the user has successfully called C_Login.
The CKF_USER_PIN_COUNT_LOW, CKF_USER_PIN_COUNT_LOW, CKF_USER_PIN_FINAL_TRY, and CKF_SO_PIN_FINAL_TRY flags may always be set to false if the token does not support the functionality or will not reveal the information because of its security policy.

The CKF_USER_PIN_TO_BE_CHANGED and CKF_SO_PIN_TO_BE_CHANGED flags may always be set to false if the token does not support the functionality. If a PIN is set to the default value, or has expired, the appropriate CKF_USER_PIN_TO_BE_CHANGED or CKF_SO_PIN_TO_BE_CHANGED flag is set to true. When either of these flags are true, logging in with the corresponding PIN will succeed, but only the C_SetPIN function can be called. Calling any other function that required the user to be logged in will cause CKR_PIN_EXPIRED to be returned until C_SetPIN is called successfully.

Note: The fields ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount, ulRwSessionCount, ulTotalPublicMemory, ulFreePublicMemory, ulTotalPrivateMemory, and ulFreePrivateMemory can have the special value CK_UNAVAILABLE_INFORMATION, which means that the token and/or library is unable or unwilling to provide that information. In addition, the fields ulMaxSessionCount and ulMaxRwSessionCount can have the special value CK_EFFECTIVELY_INFINITE, which means that there is no practical limit on the number of sessions (resp. R/W sessions) an application can have open with the token.

It is important to check these fields for these special values. This is particularly true for CK_EFFECTIVELY_INFINITE, since an application seeing this value in the ulMaxSessionCount or ulMaxRwSessionCount field would otherwise conclude that it can't open any sessions with the token, which is far from being the case.

The upshot of all this is that the correct way to interpret (for example) the ulMaxSessionCount field is something along the lines of the following:

CK_TOKEN_INFO info;
.
.
if ((CK_LONG) info.ulMaxSessionCount

== CK_UNAVAILABLE_INFORMATION) {

/* Token refuses to give value of ulMaxSessionCount */
.
.
} else if (info.ulMaxSessionCount == CK_EFFECTIVELY_INFINITE) {
/* Application can open as many sessions as it wants */
.
.
} else {
/* ulMaxSessionCount really does contain what it should */
.
.
}

CK_TOKEN_INFO_PTR is a pointer to a CK_TOKEN_INFO.

typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR
 

Pointer to a CK_TOKEN_INFO.

typedef CK_ULONG CK_SESSION_HANDLE
 

CK_SESSION_HANDLE; CK_SESSION_HANDLE_PTR

CK_SESSION_HANDLE is a Cryptoki-assigned value that identifies a session.

typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR
 

Pointer to a CK_SESSION_HANDLE.

typedef CK_ULONG CK_USER_TYPE
 

CK_USER_TYPE

CK_USER_TYPE holds the types of Cryptoki users described in Section 6.5, and, in addition, a context-specific type described in Section 10.9..

typedef CK_ULONG CK_STATE
 

CK_STATE

CK_STATE holds the session state, as described in Sections 6.7.1 and 6.7.2. It is defined as follows:.

typedef struct CK_SESSION_INFO CK_SESSION_INFO
 

CK_SESSION_INFO; CK_SESSION_INFO_PTR

CK_SESSION_INFO provides information about a session. It is defined as follows:
slotID ID of the slot that interfaces with the token
state the state of the session
flags bit flags that define the type of session; the flags are defined below
ulDeviceError an error code defined by the cryptographic device. Used for errors not covered by Cryptoki.

The following table defines the flags field:

Table 12, Session Information Flags
Bit Flag Mask Meaning
CKF_RW_SESSION 0x00000002 True if the session is read/write; false if the session is read-only
CKF_SERIAL_SESSION 0x00000004 This flag is provided for backward compatibility, and should always be set to true

CK_SESSION_INFO_PTR is a pointer to a CK_SESSION_INFO.

typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR
 

Pointer to a CK_SESSION_INFO.

typedef CK_ULONG CK_OBJECT_HANDLE
 

CK_OBJECT_HANDLE; CK_OBJECT_HANDLE_PTR

CK_OBJECT_HANDLE is a token-specific identifier for an object. It is defined as follows:

typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR
 

Pointer to a CK_OBJECT_HANDLE.

typedef CK_ULONG CK_OBJECT_CLASS
 

CK_OBJECT_CLASS; CK_OBJECT_CLASS_PTR

CK_OBJECT_CLASS is a value that identifies the classes (or types) of objects that Cryptoki recognizes.

typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR
 

Pointer to a CK_OBJECT_CLASS.

typedef CK_ULONG CK_HW_FEATURE_TYPE
 

CK_HW_FEATURE_TYPE

CK_HW_FEATURE_TYPE is a value that identifies a hardware feature type of a device.

typedef CK_ULONG CK_KEY_TYPE
 

CK_KEY_TYPE

CK_KEY_TYPE is a value that identifies a key type. It is defined as follows:

typedef CK_ULONG CK_CERTIFICATE_TYPE
 

CK_CERTIFICATE_TYPE

CK_CERTIFICATE_TYPE is a value that identifies a certificate type.

typedef CK_ULONG CK_ATTRIBUTE_TYPE
 

CK_ATTRIBUTE_TYPE

CK_ATTRIBUTE_TYPE is a value that identifies an attribute type. It is defined as follows:

typedef struct CK_ATTRIBUTE CK_ATTRIBUTE
 

CK_ATTRIBUTE; CK_ATTRIBUTE_PTR

CK_ATTRIBUTE is a structure that includes the type, value, and length of an attribute.
type the attribute type
pValue pointer to the value of the attribute
ulValueLen length in bytes of the value

If an attribute has no value, then ulValueLen = 0, and the value of pValue is irrelevant. An array of CK_ATTRIBUTEs is called a "template" and is used for creating, manipulating and searching for objects. The order of the attributes in a template never matters, even if the template contains vendor-specific attributes. Note that pValue is a "void" pointer, facilitating the passing of arbitrary values. Both the application and Cryptoki library must ensure that the pointer can be safely cast to the expected type (i.e., without word-alignment errors).

CK_ATTRIBUTE_PTR is a pointer to a CK_ATTRIBUTE.

CK_DATE

CK_DATE is a structure that defines a date. It is defined as follows:

typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR
 

Pointer to a CK_ATTRIBUTE.

typedef struct CK_DATE CK_DATE
 

CK_DATE

CK_DATE is a structure that defines a date. It is defined as follows:
year the year ("1900" - "9999")
month the month ("01" - "12")
day the day ("01" - "31")

The fields hold numeric characters from the character set in Table 3 , not the literal byte values.

When a Cryptoki object carries an attribute of this type, and the default value of the attribute is specified to be "empty," then Cryptoki libraries shall set the attribute's ulValueLen to 0.

Note that implementations of previous versions of Cryptoki may have used other methods to identify an "empty" attribute of type CK_DATE, and that applications that needs to interoperate with these libraries therefore have to be flexible in what they accept as an empty value.

typedef CK_ULONG CK_MECHANISM_TYPE
 

CK_MECHANISM_TYPE; CK_MECHANISM_TYPE_PTR

CK_MECHANISM_TYPE is a value that identifies a mechanism type. It is defined as follows:

typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR
 

Pointer to a CK_MECHANISM_TYPE.

typedef struct CK_MECHANISM CK_MECHANISM
 

CK_MECHANISM; CK_MECHANISM_PTR

CK_MECHANISM is a structure that specifies a particular mechanism and any parameters it requires.
mechanism the type of mechanism
pParameter pointer to the parameter if required by the mechanism
ulParameterLen length in bytes of the parameter

Note that pParameter is a "void" pointer, facilitating the passing of arbitrary values. Both the application and the Cryptoki library must ensure that the pointer can be safely cast to the expected type (i.e., without word-alignment errors).

CK_MECHANISM_PTR is a pointer to a CK_MECHANISM.

CK_MECHANISM_INFO; CK_MECHANISM_INFO_PTR

CK_MECHANISM_INFO is a structure that provides information about a particular mechanism. It is defined as follows:

typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR
 

Pointer to a CK_MECHANISM.

typedef struct CK_MECHANISM_INFO CK_MECHANISM_INFO
 

CK_MECHANISM_INFO; CK_MECHANISM_INFO_PTR

CK_MECHANISM_INFO is a structure that provides information about a particular mechanism.
ulMinKeySize the minimum size of the key for the mechanism (whether this is measured in bits or in bytes is mechanism-dependent)
ulMaxKeySize the maximum size of the key for the mechanism (whether this is measured in bits or in bytes is mechanism-dependent)
flags bit flags specifying mechanism capabilities

For some mechanisms, the ulMinKeySize and ulMaxKeySize fields have meaningless values.

The following table defines the flags field:

Table 13, Mechanism Information Flags
Bit Flag Mask Meaning
CKF_HW 0x00000001 True if the mechanism is performed by the device; false if the mechanism is performed in software
CKF_ENCRYPT 0x00000100 True if the mechanism can be used with C_EncryptInit
CKF_DECRYPT 0x00000200 True if the mechanism can be used with C_DecryptInit
CKF_DIGEST 0x00000400 True if the mechanism can be used with C_DigestInit
CKF_SIGN 0x00000800 True if the mechanism can be used with C_SignInit
CKF_SIGN_RECOVER 0x00001000 True if the mechanism can be used with C_SignRecoverInit
CKF_VERIFY 0x00002000 True if the mechanism can be used with C_VerifyInit
CKF_VERIFY_RECOVER 0x00004000 True if the mechanism can be used with C_VerifyRecoverInit
CKF_GENERATE 0x00008000 True if the mechanism can be used with C_GenerateKey
CKF_GENERATE_KEY_PAIR 0x00010000 True if the mechanism can be used with C_GenerateKeyPair
CKF_WRAP 0x00020000 True if the mechanism can be used with C_WrapKey
CKF_UNWRAP 0x00040000 True if the mechanism can be used with C_UnwrapKey
CKF_DERIVE 0x00080000 True if the mechanism can be used with C_DeriveKey
CKF_EXTENSION 0x80000000 True if there is an extension to the flags; false if no extensions. Must be false for this version.

CK_MECHANISM_INFO_PTR is a pointer to a CK_MECHANISM_INFO.

typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR
 

Pointer to a CK_MECHANISM_INFO.

typedef CK_ULONG CK_RV
 

CK_RV

CK_RV is a value that identifies the return value of a Cryptoki function.

typedef CK_RV(* CK_NOTIFY)(CK_SESSION_HANDLE hSession,CK_NOTIFICATION event,CK_VOID_PTR pApplication)
 

CK_NOTIFY

CK_NOTIFY is the type of a pointer to a function used by Cryptoki to perform notification callbacks.

typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST
 

CK_FUNCTION_LIST; CK_FUNCTION_LIST_PTR; CK_FUNCTION_LIST_PTR_PTR

CK_FUNCTION_LIST is a structure which contains a Cryptoki version and a function pointer to each function in the Cryptoki API. It is defined as follows: In this structure 'version' is the cryptoki specification version number. It should match the value of 'cryptokiVersion' returned in the CK_INFO structure.

An application may or may not be able to modify a Cryptoki library's static CK_FUNCTION_LIST structure. Whether or not it can, it should never attempt to do so.

CK_FUNCTION_LIST_PTR is a pointer to a CK_FUNCTION_LIST.

CK_FUNCTION_LIST_PTR_PTR is a pointer to a CK_FUNCTION_LIST_PTR.

typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR
 

Pointer to a CK_FUNCTION_LIST.

typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR
 

Pointer to a CK_FUNCTION_LIST_PTR.

typedef CK_RV(* CK_CREATEMUTEX)(CK_VOID_PTR_PTR ppMutex)
 

CK_CREATEMUTEX

CK_CREATEMUTEX is the type of a pointer to an application-supplied function which creates a new mutex object and returns a pointer to it. It is defined as follows:

typedef CK_RV(* CK_DESTROYMUTEX)(CK_VOID_PTR pMutex)
 

CK_DESTROYMUTEX

CK_DESTROYMUTEX is the type of a pointer to an application-supplied function which destroys an existing mutex object.

typedef CK_RV(* CK_LOCKMUTEX)(CK_VOID_PTR pMutex)
 

If a CK_LOCKMUTEX function is called on a mutex which is not locked, the calling thread obtains a lock on that mutex and returns.

  • - If a CK_LOCKMUTEX function is called on a mutex which is locked by some thread other than the calling thread, the calling thread blocks and waits for that mutex to be unlocked.
If a CK_LOCKMUTEX function is called on a mutex which is locked by the calling thread, the behavior of the function call is undefined.
  • If a CK_UNLOCKMUTEX function is called on a mutex which is locked by the calling thread, that mutex is unlocked and the function call returns. Furthermore:
  • If exactly one thread was blocking on that particular mutex, then that thread stops blocking, obtains a lock on that mutex, and its CK_LOCKMUTEX call returns.
  • If more than one thread was blocking on that particular mutex, then exactly one of the blocking threads is selected somehow. That lucky thread stops blocking, obtains a lock on the mutex, and its CK_LOCKMUTEX call returns. All other threads blocking on that particular mutex continue to block.
  • If a CK_UNLOCKMUTEX function is called on a mutex which is not locked, then the function call returns the error code CKR_MUTEX_NOT_LOCKED.
  • If a CK_UNLOCKMUTEX function is called on a mutex which is locked by some thread other than the calling thread, the behavior of the function call is undefined. CK_LOCKMUTEX is defined as follows:

typedef CK_RV(* CK_UNLOCKMUTEX)(CK_VOID_PTR pMutex)
 

CK_UNLOCKMUTEX is defined as follows:.

typedef struct CK_C_INITIALIZE_ARGS CK_C_INITIALIZE_ARGS
 

CK_C_INITIALIZE_ARGS; CK_C_INITIALIZE_ARGS_PTR

CK_C_INITIALIZE_ARGS is a structure containing the optional arguments for the C_Initialize function. For this version of Cryptoki, these optional arguments are all concerned with the way the library deals with threads. CK_C_INITIALIZE_ARGS is defined as follows:
CreateMutex pointer to a function to use for creating mutex objects
DestroyMutex pointer to a function to use for destroying mutex objects
LockMutex pointer to a function to use for locking mutex objects
UnlockMutex pointer to a function to use for unlocking mutex objects
flags bit flags specifying options for '''C_Initialize'''; the flags are defined below
pReserved reserved for future use. Should be NULL_PTR for this version of Cryptoki

The following table defines the flags field:

Table 14, C_Initialize Parameter Flags
Bit Flag Mask Meaning
CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001 True if application threads which are executing calls to the library may not use native operating system calls to spawn new threads; false if they may
CKF_OS_LOCKING_OK 0x00000002 True if the library can use the native operation system threading model for locking; false otherwise

CK_C_INITIALIZE_ARGS_PTR is a pointer to a CK_C_INITIALIZE_ARGS.

typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR
 

Pointer to a CK_C_INITIALIZE_ARGS.

typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE
 

CK_RSA_PKCS_MGF_TYPE; CK_RSA_PKCS_MGF_TYPE_PTR

CK_RSA_PKCS_MGF_TYPE is used to indicate the Message Generation Function (MGF) applied to a message block when formatting a message block for the PKCS #1 OAEP encryption scheme or the PKCS #1 PSS signature scheme.

typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR
 

Pointer to a CK_RSA_PKCS_MGF_TYPE.

typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE
 

CK_RSA_PKCS_OAEP_SOURCE_TYPE; CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR

CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source of the encoding parameter when formatting a message block for the PKCS #1 OAEP encryption scheme.

typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR
 

Pointer to a CK_RSA_PKCS_OAEP_SOURCE_TYPE.

typedef struct CK_RSA_PKCS_OAEP_PARAMS CK_RSA_PKCS_OAEP_PARAMS
 

CK_RSA_PKCS_OAEP_PARAMS; CK_RSA_PKCS_OAEP_PARAMS_PTR

CK_RSA_PKCS_OAEP_PARAMS is a structure that provides the parameters to the CKM_RSA_PKCS_OAEP mechanism. The structure is defined as follows:
hashAlg mechanism ID of the message digest algorithm used to calculate the digest of the encoding parameter
mgf mask generation function to use on the encoded block
source source of the encoding parameter
pSourceData data used as the input for the encoding parameter source
ulSourceDataLen length of the encoding parameter source input

CK_RSA_PKCS_OAEP_PARAMS_PTR is a pointer to a CK_RSA_PKCS_OAEP_PARAMS.

typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR
 

Pointer to a CK_RSA_PKCS_OAEP_PARAMS.

typedef struct CK_RSA_PKCS_PSS_PARAMS CK_RSA_PKCS_PSS_PARAMS
 

CK_RSA_PKCS_PSS_PARAMS; CK_RSA_PKCS_PSS_PARAMS_PTR

CK_RSA_PKCS_PSS_PARAMS is a structure that provides the parameters to the CKM_RSA_PKCS_PSS mechanism. The structure is defined as follows:
hashAlg hash algorithm used in the PSS encoding; if the signature mechanism does not include message hashing, then this value must be the mechanism used by the application to generate the message hash; if the signature mechanism includes hashing, then this value must match the hash algorithm indicated by the signature mechanism
mgf mask generation function to use on the encoded block
sLen length, in bytes, of the salt value used in the PSS encoding; typical values are the length of the message hash and zero

CK_RSA_PKCS_PSS_PARAMS_PTR is a pointer to a CK_RSA_PKCS_PSS_PARAMS.

typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR
 

Pointer to a CK_RSA_PKCS_PSS_PARAMS.

typedef CK_ULONG CK_EC_KDF_TYPE
 

CK_EC_KDF_TYPE, CK_EC_KDF_TYPE_PTR

CK_EC_KDF_TYPE is used to indicate the Key Derivation Function (KDF) applied to derive keying data from a shared secret. The key derivation function will be used by the EC key agreement schemes. It is defined as follows:

typedef CK_EC_KDF_TYPE CK_PTR CK_EC_KDF_TYPE_PTR
 

Pointer to a CK_EC_KDF_TYPE.

typedef struct CK_ECDH1_DERIVE_PARAMS CK_ECDH1_DERIVE_PARAMS
 

CK_ECDH1_DERIVE_PARAMS, CK_ECDH1_DERIVE_PARAMS_PTR

CK_ECDH1_DERIVE_PARAMS is a structure that provides the parameters for the CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE key derivation mechanisms, where each party contributes one key pair. The structure is defined as follows:
kdf key derivation function used on the shared secret value
ulSharedDataLen the length in bytes of the shared info
pSharedData some data shared between the two parties
ulPublicDataLen the length in bytes of the other party's EC public key
pPublicData

''The encoding in V2.20 was not specified and resulted in different implementations choosing different encodings. Applications relying only on a V2.20 encoding (e.g. the DER variant) other than the one specified now (raw) may not work with all V2.30 compliant tokens.''

pointer to other party's EC public key value. A token MUST be able to accept this value encoded as a raw octet string (as per section A.5.2 of [ANSI X9.62]). A token MAY, in addition, support accepting this value as a DER-encoded ECPoint (as per section E.6 of [ANSI X9.62]) i.e. the same as a CKA_EC_POINT encoding. The calling application is responsible for converting the offered public key to the compressed or uncompressed forms of these encodings if the token does not support the offered form.'' ''

With the key derivation function CKD_NULL, pSharedData must be NULL and ulSharedDataLen must be zero. With the key derivation function CKD_SHA1_KDF, an optional pSharedData may be supplied, which consists of some data shared by the two parties intending to share the shared secret. Otherwise, pSharedData must be NULL and ulSharedDataLen must be zero.

CK_ECDH1_DERIVE_PARAMS_PTR is a pointer to a CK_ECDH1_DERIVE_PARAMS.

CK_ ECMQV _DERIVE_PARAMS, CK_ ECMQV _DERIVE_PARAMS_PTR

CK_ ECMQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_ECMQV_DERIVE key derivation mechanism, where each party contributes two key pairs. The structure is defined as follows:

typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR
 

Pointer to a CK_ECDH1_DERIVE_PARAMS.

typedef struct CK_ECMQV_DERIVE_PARAMS CK_ECMQV_DERIVE_PARAMS
 

CK_ ECMQV _DERIVE_PARAMS, CK_ ECMQV _DERIVE_PARAMS_PTR

CK_ ECMQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_ECMQV_DERIVE key derivation mechanism, where each party contributes two key pairs. The structure is defined as follows:
kdf key derivation function used on the shared secret value
ulSharedDataLen the length in bytes of the shared info
pSharedData some data shared between the two parties
ulPublicDataLen the length in bytes of the other party's first EC public key
pPublicData pointer to other party's first EC public key value. Encoding rules are as per ''pPublicData'' of CK_ECDH1_DERIVE_PARAMS
ulPrivateDataLen the length in bytes of the second EC private key
hPrivateData key handle for second EC private key value
ulPublicDataLen2 the length in bytes of the other party's second EC public key
pPublicData2 pointer to other party's second EC public key value. Encoding rules are as per ''pPublicData'' of CK_ECDH1_DERIVE_PARAMS
publicKey Handle to the first party's ephemeral public key

With the key derivation function CKD_NULL, pSharedData must be NULL and ulSharedDataLen must be zero. With the key derivation function CKD_SHA1_KDF, an optional pSharedData may be supplied, which consists of some data shared by the two parties intending to share the shared secret. Otherwise, pSharedData must be NULL and ulSharedDataLen must be zero.

CK_ECMQV_DERIVE_PARAMS_PTR is a pointer to a CK_ECMQV_DERIVE_PARAMS.

typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR
 

Pointer to a CK_ECMQV_DERIVE_PARAMS.

typedef CK_ULONG CK_X9_42_DH_KDF_TYPE
 

CK_X9_42_DH_KDF_TYPE, CK_X9_42_DH_KDF_TYPE_PTR

CK_X9_42_DH_KDF_TYPE is used to indicate the Key Derivation Function (KDF) applied to derive keying data from a shared secret. The key derivation function will be used by the X9.42 Diffie-Hellman key agreement schemes.

typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR
 

Pointer to a CK_X9_42_DH_KDF_TYPE.

typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_X9_42_DH1_DERIVE_PARAMS
 

CK_X9_42_DH1_DERIVE_PARAMS, CK_X9_42_DH1_DERIVE_PARAMS_PTR

CK_X9_42_DH1_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_DH_DERIVE key derivation mechanism, where each party contributes one key pair. The structure is defined as follows:
kdf key derivation function used on the shared secret value
ulOtherInfoLen the length in bytes of the other info
pOtherInfo some data shared between the two parties
ulPublicDataLen the length in bytes of the other party's X9.42 Diffie-Hellman public key
pPublicData pointer to other party's X9.42 Diffie-Hellman public key value

With the key derivation function CKD_NULL, pOtherInfo must be NULL and ulOtherInfoLen must be zero. With the key derivation function CKD_SHA1_KDF_ASN1, pOtherInfo must be supplied, which contains an octet string, specified in ASN.1 DER encoding, consisting of mandatory and optional data shared by the two parties intending to share the shared secret. With the key derivation function CKD_SHA1_KDF_CONCATENATE, an optional pOtherInfo may be supplied, which consists of some data shared by the two parties intending to share the shared secret. Otherwise, pOtherInfo must be NULL and ulOtherInfoLen must be zero.

CK_X9_42_DH1_DERIVE_PARAMS_PTR is a pointer to a CK_X9_42_DH1_DERIVE_PARAMS.

CK_X9_42_DH2_DERIVE_PARAMS, CK_X9_42_DH2_DERIVE_PARAMS_PTR

CK_X9_42_DH2_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation mechanisms, where each party contributes two key pairs. The structure is defined as follows:

typedef CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR
 

Pointer to a CK_X9_42_DH1_DERIVE_PARAMS.

typedef struct CK_X9_42_DH2_DERIVE_PARAMS CK_X9_42_DH2_DERIVE_PARAMS
 

CK_X9_42_DH2_DERIVE_PARAMS, CK_X9_42_DH2_DERIVE_PARAMS_PTR

CK_X9_42_DH2_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation mechanisms, where each party contributes two key pairs. The structure is defined as follows:
kdf key derivation function used on the shared secret value
ulOtherInfoLen the length in bytes of the other info
pOtherInfo some data shared between the two parties
ulPublicDataLen the length in bytes of the other party's first X9.42 Diffie-Hellman public key
pPublicData pointer to other party's first X9.42 Diffie-Hellman public key value
ulPrivateDataLen the length in bytes of the second X9.42 Diffie-Hellman private key
hPrivateData key handle for second X9.42 Diffie-Hellman private key value
ulPublicDataLen2 the length in bytes of the other party's second X9.42 Diffie-Hellman public key
pPublicData2 pointer to other party's second X9.42 Diffie-Hellman public key value

With the key derivation function CKD_NULL, pOtherInfo must be NULL and ulOtherInfoLen must be zero. With the key derivation function CKD_SHA1_KDF_ASN1, pOtherInfo must be supplied, which contains an octet string, specified in ASN.1 DER encoding, consisting of mandatory and optional data shared by the two parties intending to share the shared secret. With the key derivation function CKD_SHA1_KDF_CONCATENATE, an optional pOtherInfo may be supplied, which consists of some data shared by the two parties intending to share the shared secret. Otherwise, pOtherInfo must be NULL and ulOtherInfoLen must be zero.

CK_X9_42_DH2_DERIVE_PARAMS_PTR is a pointer to a CK_X9_42_DH2_DERIVE_PARAMS.

CK_X9_42_MQV_DERIVE_PARAMS, CK_X9_42_MQV_DERIVE_PARAMS_PTR

CK_X9_42_MQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_MQV_DERIVE key derivation mechanism, where each party contributes two key pairs. The structure is defined as follows:

typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR
 

Pointer to a CK_X9_42_DH2_DERIVE_PARAMS.

typedef struct CK_X9_42_MQV_DERIVE_PARAMS CK_X9_42_MQV_DERIVE_PARAMS
 

CK_X9_42_MQV_DERIVE_PARAMS, CK_X9_42_MQV_DERIVE_PARAMS_PTR

CK_X9_42_MQV_DERIVE_PARAMS is a structure that provides the parameters to the CKM_X9_42_MQV_DERIVE key derivation mechanism, where each party contributes two key pairs. The structure is defined as follows:
kdf key derivation function used on the shared secret value
ulOtherInfoLen the length in bytes of the other info
pOtherInfo some data shared between the two parties
ulPublicDataLen the length in bytes of the other party's first X9.42 Diffie-Hellman public key
pPublicData pointer to other party's first X9.42 Diffie-Hellman public key value
ulPrivateDataLen the length in bytes of the second X9.42 Diffie-Hellman private key
hPrivateData key handle for second X9.42 Diffie-Hellman private key value
ulPublicDataLen2 the length in bytes of the other party's second X9.42 Diffie-Hellman public key
pPublicData2 pointer to other party's second X9.42 Diffie-Hellman public key value
publicKey Handle to the first party's ephemeral public key

With the key derivation function CKD_NULL, pOtherInfo must be NULL and ulOtherInfoLen must be zero. With the key derivation function CKD_SHA1_KDF_ASN1, pOtherInfo must be supplied, which contains an octet string, specified in ASN.1 DER encoding, consisting of mandatory and optional data shared by the two parties intending to share the shared secret. With the key derivation function CKD_SHA1_KDF_CONCATENATE, an optional pOtherInfo may be supplied, which consists of some data shared by the two parties intending to share the shared secret. Otherwise, pOtherInfo must be NULL and ulOtherInfoLen must be zero.

CK_X9_42_MQV_DERIVE_PARAMS_PTR is a pointer to a CK_X9_42_MQV_DERIVE_PARAMS.

typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR
 

Pointer to a CK_X9_42_MQV_DERIVE_PARAMS.

typedef struct CK_AES_CTR_PARAMS CK_AES_CTR_PARAMS
 

CK_AES_CTR_PARAMS; CK_AES_CTR_PARAMS_PTR

CK_AES_CTR_PARAMS is a structure that provides the parameters to the CKM_AES_CTR mechanism. It's up to the caller to initialize all of the bits in the counter block including the counter bits. The counter bits are the least significant bits of the counter block (cb). They are a big-endian value usually starting with 1. The rest of 'cb' is for the nonce, and maybe an optional IV.

E.g. as defined in [RFC 3686]:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Nonce |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Initialization Vector (IV) |

|

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Block Counter |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

This construction permits each packet to consist of up to 232-1 blocks = 4,294,967,295 blocks = 68,719,476,720 octets.

CK_AES_CTR _PARAMS_PTR is a pointer to a CK_AES_CTR _PARAMS.

typedef struct CK_GCM_PARAMS CK_GCM_PARAMS
 

CK_GCM _PARAMS; CK_GCM _PARAMS_PTR

CK_GCM_PARAMS is a structure that provides the parameters to the CKM_AES_GCM mechanism.
pIv pointer to initialization vector
ulIvLen length of initialization vector in bytes. The length of the initialization vector can be any number between 1 and 256. 96-bit (12 byte) IV values can be processed more efficiently, so that length is recommended for situations in which efficiency is critical.
pAAD pointer to additional authentication data. This data is authenticated but not encrypted''.''
ulAADLen length of ''pAAD'' in bytes.
ulTagBits length of authentication tag (output following cipher text) in bits. Can be any value between 0 and 128.

CK_GCM_PARAMS_PTR is a pointer to a CK_GCM_PARAMS.

CK_CCM _PARAMS; CK_CCM _PARAMS_PTR

CK_CCM_PARAMS is a structure that provides the parameters to the CKM_AES_CCM mechanism. It is defined as follows:

typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR
 

Pointer to a CK_GCM_PARAMS.

typedef struct CK_CCM_PARAMS CK_CCM_PARAMS
 

CK_CCM _PARAMS; CK_CCM _PARAMS_PTR

CK_CCM_PARAMS is a structure that provides the parameters to the CKM_AES_CCM mechanism.
ulDataLen length of the data where 0 <= ''ulDataLen'' < 28L.
pNonce the nonce.
ulNonceLen length of ''pNonce'' (<= 15-L) in bytes.
pAAD Additional authentication data. This data is authenticated but not encrypted.
ulAADLen length of ''pAuthData'' in bytes.
ulMACLen length of the MAC (output following cipher text) in bytes. Valid values are 4, 6, 8, 10, 12, 14, and 16.

CK_CCM_PARAMS_PTR is a pointer to a CK_CCM_PARAMS.

typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR
 

Pointer to a CK_CCM_PARAMS.

typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_DES_CBC_ENCRYPT_DATA_PARAMS
 

.
 
Functions
           
Mechanism
Encrypt
&
Decrypt
Sign
&
Verify
SR
&
VR1
Digest
Gen.
Key/
Key
Pair
Wrap
&
Unwrap
Derive
CKM_DES_ECB_ENCRYPT_DATA            
X
CKM_DES_CBC_ENCRYPT_DATA            
X
CKM_DES3_ECB_ENCRYPT_DATA            
X
CKM_DES3_CBC_ENCRYPT_DATA            
X
CKM_AES_ECB_ENCRYPT_DATA            
X
CKM_AES_CBC_ENCRYPT_DATA            
X

Mechanisms:

typedef struct CK_PBE_PARAMS CK_PBE_PARAMS
 

CK_PBE_PARAMS; CK_PBE_PARAMS_PTR

CK_PBE_PARAMS is a structure which provides all of the necessary information required by the CKM_PBE mechanisms (see PKCS #5 and PKCS #12 for information on the PBE generation mechanisms) and the CKM_PBA_SHA1_WITH_SHA1_HMAC mechanism.
pInitVector pointer to the location that receives the 8-byte initialization vector (IV), if an IV is required;
pPassword points to the password to be used in the PBE key generation;
ulPasswordLen length in bytes of the password information;
pSalt points to the salt to be used in the PBE key generation;
ulSaltLen length in bytes of the salt information;
ulIteration number of iterations required for the generation.

CK_PBE_PARAMS_PTR is a pointer to a CK_PBE_PARAMS.

pInitVector pointer to the location that receives the 8-byte initialization vector (IV), if an IV is required;
pPassword points to the password to be used in the PBE key generation;
ulPasswordLen length in bytes of the password information;
pSalt points to the salt to be used in the PBE key generation;
ulSaltLen length in bytes of the salt information;
ulIteration number of iterations required for the generation.

CK_PBE_PARAMS_PTR is a pointer to a CK_PBE_PARAMS.

typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR
 

Pointer to a CK_PBE_PARAMS.

typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
 

CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR

CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to indicate the Pseudo-Random Function (PRF) used to generate key bits using PKCS #5 PBKDF2.

typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR
 

Pointer to a CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE.

typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE
 

CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR

CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the source of the salt value when deriving a key using PKCS #5 PBKDF2. It is defined as follows:

typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR
 

Pointer to a CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE.

typedef struct CK_PKCS5_PBKD2_PARAMS CK_PKCS5_PBKD2_PARAMS
 

CK_PKCS5_PBKD2_PARAMS; CK_PKCS5_PBKD2_PARAMS_PTR

CK_PKCS5_PBKD2_PARAMS is a structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism. The structure is defined as follows:
saltSource source of the salt value
pSaltSourceData data used as the input for the salt source
ulSaltSourceDataLen length of the salt source input
iterations number of iterations to perform when generating each block of random data
prf pseudo-random function to used to generate the key
pPrfData data used as the input for PRF in addition to the salt value
ulPrfDataLen length of the input data for the PRF
pPassword points to the password to be used in the PBE key generation
ulPasswordLen length in bytes of the password information

CK_PKCS5_PBKD2_PARAMS_PTR is a pointer to a CK_PKCS5_PBKD2_PARAMS.

typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR
 

Pointer to a CK_PKCS5_PBKD2_PARAMS.

typedef struct CK_SSL3_RANDOM_DATA CK_SSL3_RANDOM_DATA
 

CK_SSL3_RANDOM_DATA

CK_SSL3_RANDOM_DATA is a structure which provides information about the random data of a client and a server in an SSL context. This structure is used by both the CKM_SSL3_MASTER_KEY_DERIVE and the CKM_SSL3_KEY_AND_MAC_DERIVE mechanisms.
pClientRandom pointer to the client's random data
ulClientRandomLen length in bytes of the client's random data
pServerRandom pointer to the server's random data
ulServerRandomLen length in bytes of the server's random data

CK_SSL3_MASTER_KEY_DERIVE_PARAMS; CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR

CK_SSL3_MASTER_KEY_DERIVE_PARAMS is a structure that provides the parameters to the CKM_SSL3_MASTER_KEY_DERIVE mechanism. It is defined as follows:

typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_SSL3_MASTER_KEY_DERIVE_PARAMS
 

pClientRandom pointer to the client's random data
ulClientRandomLen length in bytes of the client's random data
pServerRandom pointer to the server's random data
ulServerRandomLen length in bytes of the server's random data

CK_SSL3_MASTER_KEY_DERIVE_PARAMS; CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR

CK_SSL3_MASTER_KEY_DERIVE_PARAMS is a structure that provides the parameters to the CKM_SSL3_MASTER_KEY_DERIVE mechanism. It is defined as follows:
RandomInfo client's and server's random data information.
pVersion pointer to a '''CK_VERSION '''structure which receives the SSL protocol version information

CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR is a pointer to a CK_SSL3_MASTER_KEY_DERIVE_PARAMS.

CK_SSL3_KEY_MAT_OUT; CK_SSL3_KEY_MAT_OUT_PTR

CK_SSL3_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. It is defined as follows:

typedef CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR
 

Pointer to a CK_SSL3_MASTER_KEY_DERIVE_PARAMS.

typedef struct CK_SSL3_KEY_MAT_OUT CK_SSL3_KEY_MAT_OUT
 

CK_SSL3_KEY_MAT_OUT; CK_SSL3_KEY_MAT_OUT_PTR

CK_SSL3_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. It is defined as follows:
hClientMacSecret key handle for the resulting Client MAC Secret key
hServerMacSecret key handle for the resulting Server MAC Secret key
hClientKey key handle for the resulting Client Secret key
hServerKey key handle for the resulting Server Secret key
pIVClient pointer to a location which receives the initialization vector (IV) created for the client (if any)
pIVServer pointer to a location which receives the initialization vector (IV) created for the server (if any)

CK_SSL3_KEY_MAT_OUT_PTR is a pointer to a CK_SSL3_KEY_MAT_OUT.

CK_SSL3_KEY_MAT_PARAMS; CK_SSL3_KEY_MAT_PARAMS_PTR

CK_SSL3_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. It is defined as follows:

typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR
 

Pointer to a CK_SSL3_KEY_MAT_OUT.

typedef struct CK_SSL3_KEY_MAT_PARAMS CK_SSL3_KEY_MAT_PARAMS
 

CK_SSL3_KEY_MAT_PARAMS; CK_SSL3_KEY_MAT_PARAMS_PTR

CK_SSL3_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism. It is defined as follows:
ulMacSizeInBits the length (in bits) of the MACing keys agreed upon during the protocol handshake phase
ulKeySizeInBits the length (in bits) of the secret keys agreed upon during the protocol handshake phase
ulIVSizeInBits the length (in bits) of the IV agreed upon during the protocol handshake phase. If no IV is required, the length should be set to 0
bIsExport a Boolean value which indicates whether the keys have to be derived for an export version of the protocol
RandomInfo client's and server's random data information.
pReturnedKeyMaterial points to a '''CK_SSL3_KEY_MAT_OUT''' structures which receives the handles for the keys generated and the IVs

CK_SSL3_KEY_MAT_PARAMS_PTR is a pointer to a CK_SSL3_KEY_MAT_PARAMS.

typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR
 

Pointer to a CK_SSL3_KEY_MAT_PARAMS.

typedef struct CK_TLS_PRF_PARAMS CK_TLS_PRF_PARAMS
 

CK_TLS_PRF_PARAMS; CK_TLS_PRF_PARAMS_PTR

CK_TLS_PRF_PARAMS is a structure, which provides the parameters to the CKM_TLS_PRF mechanism.

pSeed pointer to the input seed
ulSeedLen length in bytes of the input seed
pLabel pointer to the identifying label
ulLabelLen length in bytes of the identifying label
pOutput pointer receiving the output of the operation
pulOutputLen pointer to the length in bytes that the output to be created shall have, has to hold the desired length as input and will receive the calculated length as output

CK_TLS_PRF_PARAMS_PTR is a pointer to a CK_TLS_PRF_PARAMS.

typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR
 

Pointer to a CK_TLS_PRF_PARAMS.

typedef struct CK_WTLS_RANDOM_DATA CK_WTLS_RANDOM_DATA
 

CK_WTLS_RANDOM_DATA; CK_WTLS_RANDOM_DATA_PTR

CK_WTLS_RANDOM_DATA is a structure, which provides information about the random data of a client and a server in a WTLS context. This structure is used by the CKM_WTLS_MASTER_KEY_DERIVE mechanism. It is defined as follows:

pClientRandom pointer to the client's random data
ulClientRandomLen length in bytes of the client's random data
pServerRandom pointer to the server's random data
ulServerRandomLen length in bytes of the server's random data

CK_WTLS_RANDOM_DATA_PTR is a pointer to a CK_WTLS_RANDOM_DATA.

CK_WTLS_MASTER_KEY_DERIVE_PARAMS; CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR

CK_WTLS_MASTER_KEY_DERIVE_PARAMS is a structure, which provides the parameters to the CKM_WTLS_MASTER_KEY_DERIVE mechanism. It is defined as follows:

typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR
 

Pointer to a CK_WTLS_RANDOM_DATA.

typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_WTLS_MASTER_KEY_DERIVE_PARAMS
 

CK_WTLS_MASTER_KEY_DERIVE_PARAMS; CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR

CK_WTLS_MASTER_KEY_DERIVE_PARAMS is a structure, which provides the parameters to the CKM_WTLS_MASTER_KEY_DERIVE mechanism. It is defined as follows:

DigestMechanism the mechanism type of the digest mechanism to be used (possible types can be found in [WTLS])
RandomInfo Client's and server's random data information
pVersion pointer to a CK_BYTE which receives the WTLS protocol version information

CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR is a pointer to a CK_WTLS_MASTER_KEY_DERIVE_PARAMS.

CK_WTLS_PRF_PARAMS; CK_WTLS_PRF_PARAMS_PTR

CK_WTLS_PRF_PARAMS is a structure, which provides the parameters to the CKM_WTLS_PRF mechanism. It is defined as follows:

typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR
 

Pointer to a CK_WTLS_MASTER_KEY_DERIVE_PARAMS.

typedef struct CK_WTLS_PRF_PARAMS CK_WTLS_PRF_PARAMS
 

CK_WTLS_PRF_PARAMS; CK_WTLS_PRF_PARAMS_PTR

CK_WTLS_PRF_PARAMS is a structure, which provides the parameters to the CKM_WTLS_PRF mechanism.

DigestMechanism the mechanism type of the digest mechanism to be used (possible types can be found in [WTLS])
pSeed pointer to the input seed
ulSeedLen length in bytes of the input seed
pLabel pointer to the identifying label
ulLabelLen length in bytes of the identifying label
pOutput pointer receiving the output of the operation
pulOutputLen pointer to the length in bytes that the output to be created shall have, has to hold the desired length as input and will receive the calculated length as output

CK_WTLS_PRF_PARAMS_PTR is a pointer to a CK_WTLS_PRF_PARAMS.

CK_WTLS_KEY_MAT_OUT; CK_WTLS_KEY_MAT_OUT_PTR

CK_WTLS_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE or with the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanism. It is defined as follows:

typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR
 

Pointer to a CK_WTLS_PRF_PARAMS.

typedef struct CK_WTLS_KEY_MAT_OUT CK_WTLS_KEY_MAT_OUT
 

CK_WTLS_KEY_MAT_OUT; CK_WTLS_KEY_MAT_OUT_PTR

CK_WTLS_KEY_MAT_OUT is a structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE or with the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanism. It is defined as follows:

hMacSecret Key handle for the resulting MAC secret key
hKey Key handle for the resulting secret key
pIV Pointer to a location which receives the initialization vector (IV) created (if any)

CK_WTLS_KEY_MAT_OUT_PTR is a pointer to a CK_WTLS_KEY_MAT_OUT.

CK_WTLS_KEY_MAT_PARAMS; CK_WTLS_KEY_MAT_PARAMS_PTR

CK_WTLS_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE and the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanisms. It is defined as follows:

typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR
 

Pointer to a CK_WTLS_KEY_MAT_OUT.

typedef struct CK_WTLS_KEY_MAT_PARAMS CK_WTLS_KEY_MAT_PARAMS
 

CK_WTLS_KEY_MAT_PARAMS; CK_WTLS_KEY_MAT_PARAMS_PTR

CK_WTLS_KEY_MAT_PARAMS is a structure that provides the parameters to the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE and the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanisms. It is defined as follows:

DigestMechanism the mechanism type of the digest mechanism to be used (possible types can be found in [WTLS])
ulMacSizeInBits the length (in bits) of the MACing key agreed upon during the protocol handshake phase
ulKeySizeInBits the length (in bits) of the secret key agreed upon during the handshake phase
ulIVSizeInBits the length (in bits) of the IV agreed upon during the handshake phase. If no IV is required, the length should be set to 0.
ulSequenceNumber The current sequence number used for records sent by the client and server respectively
bIsExport a boolean value which indicates whether the keys have to be derived for an export version of the protocol. If this value is true (i.e. the keys are exportable) then ulKeySizeInBits is the length of the key in bits before expansion. The length of the key after expansion is determined by the information found in the template sent along with this mechanism during a C_DeriveKey function call (either the CKA_KEY_TYPE or the CKA_VALUE_LEN attribute).
RandomInfo client's and server's random data information
pReturnedKeyMaterial points to a CK_WTLS_KEY_MAT_OUT structure which receives the handles for the keys generated and the IV

CK_WTLS_KEY_MAT_PARAMS_PTR is a pointer to a CK_WTLS_KEY_MAT_PARAMS.

typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR
 

Pointer to a CK_WTLS_KEY_MAT_PARAMS.

typedef struct CK_KEY_DERIVATION_STRING_DATA CK_KEY_DERIVATION_STRING_DATA
 

CK_KEY_DERIVATION_STRING_DATA; CK_KEY_DERIVATION_STRING_DATA_PTR

.
pData pointer to the byte string
ulLen length of the byte string

CK_KEY_DERIVATION_STRING_DATA_PTR is a pointer to a CK_KEY_DERIVATION_STRING_DATA.

CK_EXTRACT_PARAMS; CK_EXTRACT_PARAMS_PTR

CK_KEY_EXTRACT_PARAMS provides the parameter to the CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit of the base key should be used as the first bit of the derived key. It is defined as follows:

CK_EXTRACT_PARAMS_PTR is a pointer to a CK_EXTRACT_PARAMS.

typedef CK_ULONG CK_EXTRACT_PARAMS
 

CK_EXTRACT_PARAMS; CK_EXTRACT_PARAMS_PTR

CK_KEY_EXTRACT_PARAMS provides the parameter to the CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit of the base key should be used as the first bit of the derived key. It is defined as follows:

typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR
 

Pointer to a CK_EXTRACT_PARAMS.

typedef struct CK_CMS_SIG_PARAMS CK_CMS_SIG_PARAMS
 

CK_CMS_SIG_PARAMS, CK_CMS_SIG_PARAMS_PTR

CK_CMS_SIG_PARAMS is a structure that provides the parameters to the CKM_CMS_SIG mechanism.
certificateHandle Object handle for a certificate associated with the signing key. The token may use information from this certificate to identify the signer in the '''SignerInfo''' result value. ''CertificateHandle'' may be NULL_PTR if the certificate is not available as a PKCS #11 object or if the calling application leaves the choice of certificate completely to the token.
pSigningMechanism Mechanism to use when signing a constructed CMS '''SignedAttributes''' value. E.g. ''' CKM_SHA1_RSA_PKCS'''.
pDigestMechanism Mechanism to use when digesting the data. Value shall be NULL_PTR when the digest mechanism to use follows from the ''pSigningMechanism'' parameter.
pContentType NULL-terminated string indicating complete MIME Content-type of message to be signed; or the value NULL_PTR if the message is a MIME object (which the token can parse to determine its MIME Content-type if required). Use the value "application/octet-stream" if the MIME type for the message is unknown or undefined. Note that the ''pContentType'' string shall conform to the syntax specified in RFC 2045, i.e. any parameters needed for correct presentation of the content by the token (such as, for example, a non-default "charset") must be present. The token must follow rules and procedures defined in RFC 2045 when presenting the content.
pRequestedAttributes Pointer to DER-encoded list of CMS '''Attributes''' the caller requests to be included in the signed attributes. Token may freely ignore this list or modify any supplied values.
ulRequestedAttributesLen Length in bytes of the value pointed to by ''pRequestedAttributes''
pRequiredAttributes Pointer to DER-encoded list of CMS '''Attributes''' (with accompanying values) required to be included in the resulting signed attributes. Token must not modify any supplied values. If the token does not support one or more of the attributes, or does not accept provided values, the signature operation will fail. The token will use its own default attributes when signing if both the ''pRequestedAttributes'' and ''pRequiredAttributes'' field are set to NULL_PTR.
ulRequiredAttributesLen Length in bytes, of the value pointed to by ''pRequiredAttributes''.

typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS
 

Mechanisms:.

typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_ARIA_CBC_ENCRYPT_DATA_PARAMS
 

Mechanisms:.

typedef struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS CK_CBC_ENCRYPT_DATA_PARAMS
 

Mechanisms:.

typedef CK_ULONG CK_PARAM_TYPE
 

CK_PARAM_TYPE

CK_PARAM_TYPE is a value that identifies an OTP parameter type. It is defined as follows:

typedef struct CK_OTP_PARAM CK_OTP_PARAM
 

CK_OTP_PARAM; CK_OTP_PARAM_PTR

CK_OTP_PARAM is a structure that includes the type, value, and length of an OTP parameter.
type the parameter type
pValue pointer to the value of the parameter
ulValueLen length in bytes of the value

If a parameter has no value, then ulValueLen = 0, and the value of pValue is irrelevant. Note that pValue is a "void" pointer, facilitating the passing of arbitrary values. Both the application and the Cryptoki library must ensure that the pointer can be safely cast to the expected type (i.e., without word-alignment errors).

CK_OTP_PARAM_PTR is a pointer to a CK_OTP_PARAM.

CK_OTP_PARAMS; CK_OTP_PARAMS_PTR CK_OTP_PARAMS is a structure that is used to provide parameters for OTP mechanisms in a generic fashion. It is defined as follows:

typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR
 

Pointer to a CK_OTP_PARAM.

typedef struct CK_OTP_PARAMS CK_OTP_PARAMS
 

CK_OTP_PARAMS; CK_OTP_PARAMS_PTR CK_OTP_PARAMS is a structure that is used to provide parameters for OTP mechanisms in a generic fashion.
pParams pointer to an array of OTP parameters
ulCount the number of parameters in the array

CK_OTP_PARAMS_PTR is a pointer to a CK_OTP_PARAMS.

When calling C_SignInit or C_VerifyInit with a mechanism that takes a CK_OTP_PARAMS structure as a parameter, the CK_OTP_PARAMS structure shall be populated in accordance with the 'CKA_OTP_ X_REQUIREMENT ' key attributes for the identified key, where X is PIN, CHALLENGE, TIME, or COUNTER.

For example, if CKA_OTP_TIME_REQUIREMENT = CK_OTP_PARAM_MANDATORY, then the CK_OTP_TIME parameter shall be present. If CKA_OTP_TIME_REQUIREMENT = CK_OTP_PARAM_OPTIONAL, then a CK_OTP_TIME parameter may be present. If it is not present, then the library may collect it (during the C_Sign call). If CKA_OTP_TIME_REQUIREMENT = CK_OTP_PARAM_IGNORED, then a provided CK_OTP_TIME parameter will always be ignored. Additionally, a provided CK_OTP_TIME parameter will always be ignored if CKF_EXCLUDE_TIME is set in a CK_OTP_FLAGS parameter. Similarly, if this flag is set, a library will not attempt to collect the value itself, and it will also instruct the token not to make use of any internal value, subject to token policies. It is an error (CKR_MECHANISM_PARAM_INVALID) to set the CKF_EXCLUDE_TIME flag when the CKA_TIME_REQUIREMENT attribute is CK_OTP_PARAM_MANDATORY.
The above discussion holds for all CKA_OTP_''X''_REQUIREMENT attributes (''i.e''., CKA_OTP_PIN_REQUIREMENT, CKA_OTP_CHALLENGE_REQURIEMENT, CKA_OTP_COUNTER_REQUIREMENT, CKA_OTP_TIME_REQUIREMENT). A library may set a particular CKA_OTP_''X''_REQUIREMENT attribute to CK_OTP_PARAM_OPTIONAL even if it is required by the mechanism as long as the token (or the library itself) has the capability of providing the value to the computation. One example of this is a token with an on-board clock.

In addition, applications may use the CK_OTP_FLAGS, the CK_OTP_OUTPUT_FORMAT and the CK_OUTPUT_LENGTH parameters to set additional parameters.

CK_OTP_SIGNATURE_INFO, CK_OTP_SIGNATURE_INFO_PTR CK_OTP_SIGNATURE_INFO is a structure that is returned by all OTP mechanisms in successful calls to C_Sign (C_SignFinal). The structure informs applications of actual parameter values used in particular OTP computations in addition to the OTP value itself. It is used by all mechanisms for which the key belongs to the class CKO_OTP_KEY and is defined as follows:

typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR
 

Pointer to a CK_OTP_PARAMS.

typedef struct CK_OTP_SIGNATURE_INFO CK_OTP_SIGNATURE_INFO
 

CK_OTP_SIGNATURE_INFO, CK_OTP_SIGNATURE_INFO_PTR CK_OTP_SIGNATURE_INFO is a structure that is returned by all OTP mechanisms in successful calls to C_Sign (C_SignFinal). The structure informs applications of actual parameter values used in particular OTP computations in addition to the OTP value itself. It is used by all mechanisms for which the key belongs to the class CKO_OTP_KEY and is defined as follows:
pParams pointer to an array of OTP parameter values
ulCount the number of parameters in the array

After successful calls to C_Sign or C_SignFinal with an OTP mechanism, the pSignature parameter will be set to point to a CK_OTP_SIGNATURE_INFO structure. One of the parameters in this structure will be the OTP value itself, identified with the CK_OTP_VALUE tag. Other parameters may be present for informational purposes, e.g. the actual time used in the OTP calculation. In order to simplify OTP validations, authentication protocols may permit authenticating parties to send some or all of these parameters in addition to OTP values themselves. Applications should therefore check for their presence in returned CK_OTP_SIGNATURE_INFO values whenever such circumstances apply.

Since C_Sign and C_SignFinal follows the convention described in Section 11.2 on producing output, a call to C_Sign (or C_SignFinal) with pSignature set to NULL_PTR will return (in the pulSignatureLen parameter) the required number of bytes to hold the CK_OTP_SIGNATURE_INFO structure as well as all the data in all its CK_OTP_PARAM components. If an application allocates a memory block based on this information, it shall therefore not subsequently de-allocate components of such a received value but rather de-allocate the complete CK_OTP_PARAMS structure itself. A Cryptoki library that is called with a non-NULL pSignature pointer will assume that it points to a contiguous memory block of the size indicated by the pulSignatureLen parameter.

When verifying an OTP value using an OTP mechanism, pSignature shall be set to the OTP value itself, e.g. the value of the CK_OTP_VALUE component of a CK_OTP_PARAMS structure returned by a call to C_Sign. The CK_OTP_PARAMS value supplied in the C_VerifyInit call sets the values to use in the verification operation.

CK_OTP_SIGNATURE_INFO_PTR points to a CK_OTP_SIGNATURE_INFO.

typedef struct CK_KIP_PARAMS CK_KIP_PARAMS
 

CK_KIP_ PARAMS; CK_KIP_ PARAMS_PTR

CK_KIP_PARAMS is a structure that provides the parameters to all the CT-KIP related mechanisms: The CKM_KIP_DERIVE key derivation mechanism, the CKM_KIP_WRAP key wrap and key unwrap mechanism, and the CKM_KIP_MAC signature mechanism. The structure is defined as follows:
pMechanism pointer to the underlying cryptographic mechanism (e.g. AES, SHA-256), see further 3, Appendix D
hKey handle to a key that will contribute to the entropy of the derived key ( CKM_KIP_DERIVE) or will be used in the MAC operation ( CKM_KIP_MAC)
pSeed pointer to an input seed
ulSeedLen length in bytes of the input seed

CK_KIP_PARAMS_PTR is a pointer to a CK_KIP_PARAMS structure.

typedef struct CK_GOSTR3410_KEY_WRAP_PARAMS CK_GOSTR3410_KEY_WRAP_PARAMS
 

CK_GOSTR3410_KEY_WRAP_PARAMS is a structure that provides the parameters to the CKM_GOSTR3410_KEY_WRAP mechanism. It is defined as follows:

pWrapOID   pointer to a data with DER-encoding of the object identifier indicating the data object type of GOST 28147-89. If pointer takes NULL_PTR value in C_WrapKey operation then parameters are specified in object identifier of attribute CKA_GOSTR3411PARAMS must be used. For C_UnwrapKey operation the pointer is not used and must take NULL_PTR value anytime
ulWrapOIDLen   length of data with DER-encoding of the object identifier indicating the data object type of GOST 28147-89
pUKM   pointer to a data with UKM. If pointer takes NULL_PTR value in C_WrapKey operation then random value of UKM will be used. If pointer takes non-NULL_PTR value in C_UnwrapKey operation then the pointer value will be compared with UKM value of wrapped key. If these two values do not match the wrapped key will be rejected
ulUKMLen   length of UKM data. If pUKM -pointer is different from NULL_PTR then equal to 8
hKey   key handle. Key handle of a sender for C_WrapKey operation. Key handle of a receiver for C_UnwrapKey operation. When key handle takes CK_INVALID_HANDLE value then an ephemeral (one time) key pair of a sender will be used

*CK_GOSTR3410_DERIVE_PARAMS

CK_GOSTR3410_DERIVE_PARAMS is a structure that provides the parameters to the CKM_GOSTR3410_DERIVE mechanism. It is defined as follows:

typedef struct CK_GOSTR3410_DERIVE_PARAMS CK_GOSTR3410_DERIVE_PARAMS
 

CK_GOSTR3410_DERIVE_PARAMS is a structure that provides the parameters to the CKM_GOSTR3410_DERIVE mechanism. It is defined as follows:

Footnote Meaning
   
ulPublicDataLen  

1 Public key of a receiver is an octet string of 64 bytes long. The public key octets correspond to the concatenation of X and Y coordinates of a point. Any one of them is 32 bytes long and represented in little endian order.

typedef struct CK_KEA_DERIVE_PARAMS CK_KEA_DERIVE_PARAMS
 

isSender Option for generating the key (called a TEK). The value is CK_TRUE if the sender (originator) generates the TEK, CK_FALSE if the recipient is regenerating the TEK.
ulRandomLen size of random Ra and Rb, in bytes
pRandomA pointer to Ra data
pRandomB pointer to Rb data
ulPublicDataLen other party's KEA public key size
pPublicData pointer to other party's KEA public key value

CK_KEA_DERIVE_PARAMS_PTR is a pointer to a CK_KEA_DERIVE_PARAMS.

typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR
 

Pointer to a CK_KEA_DERIVE_PARAMS.

typedef CK_ULONG CK_RC2_PARAMS
 

CK_RC2_PARAMS; CK_RC2_PARAMS_PTR

CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and CKM_RC2_MAC mechanisms. It holds the effective number of bits in the RC2 search space.

typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR
 

Pointer to a CK_RC2_PARAMS.

typedef struct CK_RC2_CBC_PARAMS CK_RC2_CBC_PARAMS
 

CK_RC2_CBC_PARAMS; CK_RC2_CBC_PARAMS_PTR

CK_RC2_CBC_PARAMS is a structure that provides the parameters to the CKM_RC2_CBC and CKM_RC2_CBC_PAD mechanisms. It is defined as follows:
ulEffectiveBits the effective number of bits in the RC2 search space
iv the initialization vector (IV) for cipher block chaining mode

CK_RC2_CBC_PARAMS_PTR is a pointer to a CK_RC2_CBC_PARAMS.

CK_RC2_MAC_GENERAL_PARAMS; CK_RC2_MAC_GENERAL_PARAMS_PTR

CK_RC2_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC2_MAC_GENERAL mechanism. It is defined as follows:

typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR
 

Pointer to a CK_RC2_CBC_PARAMS.

typedef struct CK_RC2_MAC_GENERAL_PARAMS CK_RC2_MAC_GENERAL_PARAMS
 

CK_RC2_MAC_GENERAL_PARAMS; CK_RC2_MAC_GENERAL_PARAMS_PTR

CK_RC2_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC2_MAC_GENERAL mechanism. It is defined as follows:
ulEffectiveBits the effective number of bits in the RC2 search space
ulMacLength length of the MAC produced, in bytes

CK_RC2_MAC_GENERAL_PARAMS_PTR is a pointer to a CK_RC2_MAC_GENERAL_PARAMS.

typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR CK_RC2_MAC_GENERAL_PARAMS_PTR
 

Pointer to a CK_RC2_MAC_GENERAL_PARAMS.

typedef struct CK_RC5_PARAMS CK_RC5_PARAMS
 

CK_RC5_PARAMS; CK_RC5_PARAMS_PTR

CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and CKM_RC5_MAC mechanisms.
ulWordsize wordsize of RC5 cipher in bytes
ulRounds number of rounds of RC5 encipherment

CK_RC5_PARAMS_PTR is a pointer to a CK_RC5_PARAMS.

CK_RC5_CBC_PARAMS; CK_RC5_CBC_PARAMS_PTR

CK_RC5_CBC_PARAMS is a structure that provides the parameters to the CKM_RC5_CBC and CKM_RC5_CBC_PAD mechanisms. It is defined as follows:

typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR
 

Pointer to a CK_RC5_PARAMS.

typedef struct CK_RC5_CBC_PARAMS CK_RC5_CBC_PARAMS
 

CK_RC5_CBC_PARAMS; CK_RC5_CBC_PARAMS_PTR

CK_RC5_CBC_PARAMS is a structure that provides the parameters to the CKM_RC5_CBC and CKM_RC5_CBC_PAD mechanisms. It is defined as follows:
ulWordsize wordsize of RC5 cipher in bytes
ulRounds number of rounds of RC5 encipherment
pIv pointer to initialization vector (IV) for CBC encryption
ulIvLen length of initialization vector (must be same as blocksize)

CK_RC5_CBC_PARAMS_PTR is a pointer to a CK_RC5_CBC_PARAMS.

CK_RC5_MAC_GENERAL_PARAMS; CK_RC5_MAC_GENERAL_PARAMS_PTR

CK_RC5_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC5_MAC_GENERAL mechanism. It is defined as follows:

typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR
 

Pointer to a CK_RC5_CBC_PARAMS.

typedef struct CK_RC5_MAC_GENERAL_PARAMS CK_RC5_MAC_GENERAL_PARAMS
 

CK_RC5_MAC_GENERAL_PARAMS; CK_RC5_MAC_GENERAL_PARAMS_PTR

CK_RC5_MAC_GENERAL_PARAMS is a structure that provides the parameters to the CKM_RC5_MAC_GENERAL mechanism. It is defined as follows:
ulWordsize wordsize of RC5 cipher in bytes
ulRounds number of rounds of RC5 encipherment
ulMacLength length of the MAC produced, in bytes

CK_RC5_MAC_GENERAL_PARAMS_PTR is a pointer to a CK_RC5_MAC_GENERAL_PARAMS.

typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR CK_RC5_MAC_GENERAL_PARAMS_PTR
 

Pointer to a CK_RC5_MAC_GENERAL_PARAMS.

typedef CK_ULONG CK_MAC_GENERAL_PARAMS
 

CK_MAC_GENERAL_PARAMS; CK_MAC_GENERAL_PARAMS_PTR

CK_MAC_GENERAL_PARAMS provides the parameters to the general-length MACing mechanisms of the DES, DES3 (triple-DES), CAST, CAST3, CAST128 (CAST5), IDEA, CDMF and AES ciphers. It also provides the parameters to the general-length HMACing mechanisms (i.e. MD2, MD5, SHA-1, SHA-256, SHA-384, SHA-512, RIPEMD-128 and RIPEMD-160) and the two SSL 3.0 MACing mechanisms (i.e. MD5 and SHA-1). It holds the length of the MAC that these mechanisms will produce.

typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR
 

Pointer to a CK_MAC_GENERAL_PARAMS.

typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_SKIPJACK_PRIVATE_WRAP_PARAMS
 

CK_SKIPJACK_PRIVATE_WRAP_PARAMS; CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR

CK_SKIPJACK_PRIVATE_WRAP_PARAMS is a structure that provides the parameters to the CKM_SKIPJACK_PRIVATE_WRAP mechanism. It is defined as follows:
ulPasswordLen length of the password
pPassword pointer to the buffer which contains the user-supplied password
ulPublicDataLen other party's key exchange public key size
pPublicData pointer to other party's key exchange public key value
ulPandGLen length of prime and base values
ulQLen length of subprime value
ulRandomLen size of random Ra, in bytes
pRandomA pointer to Ra data
pPrimeP pointer to Prime, p, value
pBaseG pointer to Base, g, value
pSubprimeQ pointer to Subprime, q, value

CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR is a pointer to a CK_PRIVATE_WRAP_PARAMS.

CK_SKIPJACK_RELAYX_PARAMS; CK_SKIPJACK_RELAYX_PARAMS_PTR

CK_SKIPJACK_RELAYX_PARAMS is a structure that provides the parameters to the CKM_SKIPJACK_RELAYX mechanism. It is defined as follows:

typedef CK_PRIVATE_WRAP_PARAMS CK_PTR CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR
 

Pointer to a CK_PRIVATE_WRAP_PARAMS.

typedef struct CK_SKIPJACK_RELAYX_PARAMS CK_SKIPJACK_RELAYX_PARAMS
 

CK_SKIPJACK_RELAYX_PARAMS; CK_SKIPJACK_RELAYX_PARAMS_PTR

CK_SKIPJACK_RELAYX_PARAMS is a structure that provides the parameters to the CKM_SKIPJACK_RELAYX mechanism. It is defined as follows:
ulOldWrappedXLen length of old wrapped key in bytes
pOldWrappedX pointer to old wrapper key
ulOldPasswordLen length of the old password
pOldPassword pointer to the buffer which contains the old user-supplied password
ulOldPublicDataLen old key exchange public key size
pOldPublicData pointer to old key exchange public key value
ulOldRandomLen size of old random Ra in bytes
pOldRandomA pointer to old Ra data
ulNewPasswordLen length of the new password
pNewPassword pointer to the buffer which contains the new user-supplied password
ulNewPublicDataLen new key exchange public key size
pNewPublicData pointer to new key exchange public key value
ulNewRandomLen size of new random Ra in bytes
pNewRandomA pointer to new Ra data

CK_SKIPJACK_RELAYX_PARAMS_PTR is a pointer to a CK_SKIPJACK_RELAYX_PARAMS.

typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR CK_SKIPJACK_RELAYX_PARAMS_PTR
 

Pointer to a CK_SKIPJACK_RELAYX_PARAMS.

typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS CK_KEY_WRAP_SET_OAEP_PARAMS
 

CK_KEY_WRAP_SET_OAEP_PARAMS; CK_KEY_WRAP_SET_OAEP_PARAMS_PTR

CK_KEY_WRAP_SET_OAEP_PARAMS is a structure that provides the parameters to the CKM_KEY_WRAP_SET_OAEP mechanism. It is defined as follows:
bBC block contents byte
pX concatenation of hash of plaintext data (if present) and extra data (if present)
ulXLen length in bytes of concatenation of hash of plaintext data (if present) and extra data (if present). 0 if neither is present

CK_KEY_WRAP_SET_OAEP_PARAMS_PTR is a pointer to a CK_KEY_WRAP_SET_OAEP_PARAMS.

typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR CK_KEY_WRAP_SET_OAEP_PARAMS_PTR
 

Pointer to a CK_KEY_WRAP_SET_OAEP_PARAMS.


Function Documentation

CK_RV C_Initialize CK_VOID_PTR    pInitArgs ;
 

C_Initialize initializes the Cryptoki library.

Parameters:
pInitArgs either has the value NULL_PTR or points to a CK_C_INITIALIZE_ARGS structure containing information on how the library should deal with multi-threaded access. If an application will not be accessing Cryptoki through multiple threads simultaneously, it can generally supply the value NULL_PTR to C_Initialize (the consequences of supplying this value will be explained below).
If pInitArgs is non-NULL_PTR, C_Initialize should cast it to a CK_C_INITIALIZE_ARGS_PTR and then dereference the resulting pointer to obtain the CK_C_INITIALIZE_ARGS fields CreateMutex, DestroyMutex, LockMutex, UnlockMutex, flags, and pReserved. For this version of Cryptoki, the value of pReserved thereby obtained must be NULL_PTR; if it's not, then C_Initialize should return with the value CKR_ARGUMENTS_BAD.

If the CKF_LIBRARY_CANT_CREATE_OS_THREADS flag in the flags field is set, that indicates that application threads which are executing calls to the Cryptoki library are not permitted to use the native operation system calls to spawn off new threads. In other words, the library's code may not create its own threads. If the library is unable to function properly under this restriction, C_Initialize should return with the value CKR_NEED_TO_CREATE_THREADS.

A call to C_Initialize specifies one of four different ways to support multi-threaded access via the value of the CKF_OS_LOCKING_OK flag in the flags field and the values of the CreateMutex, DestroyMutex, LockMutex, and UnlockMutex function pointer fields:

  1. If the flag isn't set, and the function pointer fields aren't supplied (i.e., they all have the value NULL_PTR), that means that the application won't be accessing the Cryptoki library from multiple threads simultaneously.

  2. If the flag is set, and the function pointer fields aren't supplied (i.e., they all have the value NULL_PTR), that means that the application will be performing multi-threaded Cryptoki access, and the library needs to use the native operating system primitives to ensure safe multi-threaded access. If the library is unable to do this, C_Initialize should return with the value CKR_CANT_LOCK.

  3. If the flag isn't set, and the function pointer fields are supplied (i.e., they all have non-NULL_PTR values), that means that the application will be performing multi-threaded Cryptoki access, and the library needs to use the supplied function pointers for mutex-handling to ensure safe multi-threaded access. If the library is unable to do this, C_Initialize should return with the value CKR_CANT_LOCK.

  4. If the flag is set, and the function pointer fields are supplied (i.e., they all have non-NULL_PTR values), that means that the application will be performing multi-threaded Cryptoki access, and the library needs to use either the native operating system primitives or the supplied function pointers for mutex-handling to ensure safe multi-threaded access. If the library is unable to do this, C_Initialize should return with the value CKR_CANT_LOCK.

If some, but not all, of the supplied function pointers to C_Initialize are non-NULL_PTR, then C_Initialize should return with the value CKR_ARGUMENTS_BAD.

A call to C_Initialize with pInitArgs set to NULL_PTR is treated like a call to C_Initialize with pInitArgs pointing to a CK_C_INITIALIZE_ARGS which has the CreateMutex, DestroyMutex, LockMutex, UnlockMutex, and pReserved fields set to NULL_PTR, and has the flags field set to 0.

C_Initialize should be the first Cryptoki call made by an application, except for calls to C_GetFunctionList. What this function actually does is implementation-dependent; typically, it might cause Cryptoki to initialize its internal memory buffers, or any other resources it requires.

If several applications are using Cryptoki, each one should call C_Initialize. Every call to C_Initialize should (eventually) be succeeded by a single call to C_Finalize. See Section 6.6 for more details.

Returns:
CKR_ARGUMENTS_BAD, CKR_CANT_LOCK, CKR_CRYPTOKI_ALREADY_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_NEED_TO_CREATE_THREADS, CKR_OK.
See also:
C_GetInfo.

CK_RV C_Finalize CK_VOID_PTR    pReserved ;
 

C_Finalize is called to indicate that an application is finished with the Cryptoki library. It should be the last Cryptoki call made by an application.

Parameters:
pReserved is reserved for future versions: for this version, it should be set to NULL_PTR (if C_Finalize is called with a non-NULL_PTR value for pReserved, it should return the value CKR_ARGUMENTS_BAD.
If several applications are using Cryptoki, each one should call C_Finalize. Each application's call to C_Finalize should be preceded by a single call to C_Initialize ; in between the two calls, an application can make calls to other Cryptoki functions. See Section 6.6 for more details.

''Despite the fact that the parameters supplied to C_Initialize can in general allow for safe multi-threaded access to a Cryptoki library, the behavior of C_Finalize is nevertheless undefined if it is called by an application while other threads of the application are making Cryptoki calls. The exception to this exceptional behavior of C_Finalize occurs when a thread calls C_Finalize while another of the application's threads is blocking on Cryptoki's C_WaitForSlotEvent function. When this happens, the blocked thread becomes unblocked and returns the value CKR_CRYPTOKI_NOT_INITIALIZED.@see C_WaitForSlotEvent for more information.''

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK.
See also:
C_GetInfo.

CK_RV C_GetInfo CK_INFO_PTR    pInfo ;
 

C_GetInfo returns general information about Cryptoki.

Parameters:
pInfo points to the location that receives the information.
Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK.
Example:

CK_INFO info;
CK_RV rv;
CK_C_INITIALIZE_ARGS InitArgs;
InitArgs.CreateMutex = &MyCreateMutex;
InitArgs.DestroyMutex = &MyDestroyMutex;
InitArgs.LockMutex = &MyLockMutex;
InitArgs.UnlockMutex = &MyUnlockMutex;
InitArgs.flags = CKF_OS_LOCKING_OK;
InitArgs.pReserved = NULL_PTR;
rv = C_Initialize((CK_VOID_PTR)&InitArgs);
assert(rv == CKR_OK);
rv = C_GetInfo(&info);
assert(rv == CKR_OK);
if(info.version.major == 2) {
/* Do lots of interesting cryptographic things with the token */
.
.
}
rv = C_Finalize(NULL_PTR);
assert(rv == CKR_OK);

CK_RV C_GetFunctionList CK_FUNCTION_LIST_PTR_PTR    ppFunctionList ;
 

C_GetFunctionList obtains a pointer to the Cryptoki library's list of function pointers.

Parameters:
ppFunctionList points to a value which will receive a pointer to the library's CK_FUNCTION_LIST structure, which in turn contains function pointers for all the Cryptoki API routines in the library. The pointer thus obtained may point into memory which is owned by the Cryptoki library, and which may or may not be writable. Whether or not this is the case, no attempt should be made to write to this memory.
C_GetFunctionList is the only Cryptoki function which an application may call before calling C_Initialize. It is provided to make it easier and faster for applications to use shared Cryptoki libraries and to use more than one Cryptoki library simultaneously.

Returns:
CKR_ARGUMENTS_BAD, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK.
Example:

CK_FUNCTION_LIST_PTR pFunctionList;
CK_C_Initialize pC_Initialize;
CK_RV rv;
/* It's OK to call C_GetFunctionList before calling C_Initialize */
rv = C_GetFunctionList(&pFunctionList);
assert(rv == CKR_OK);
pC_Initialize = pFunctionList -> C_Initialize;
/* Call the C_Initialize function in the library */
rv = (*pC_Initialize)(NULL_PTR);

CK_RV C_GetSlotList CK_BBOOL    tokenPresent,
CK_SLOT_ID_PTR    pSlotList,
CK_ULONG_PTR    pulCount
;
 

C_GetSlotList is used to obtain a list of slots in the system.

Parameters:
tokenPresent indicates whether the list obtained includes only those slots with a token present (CK_TRUE), or all slots (CK_FALSE);
pulCount points to the location that receives the number of slots.
There are two ways for an application to call C_GetSlotList :

  1. If pSlotList is NULL_PTR, then all that C_GetSlotList does is return (in *pulCount) the number of slots, without actually returning a list of slots. The contents of the buffer pointed to by pulCount on entry to C_GetSlotList has no meaning in this case, and the call returns the value CKR_OK.

  2. If pSlotList is not NULL_PTR, then *pulCount must contain the size (in terms of CK_SLOT_ID elements) of the buffer pointed to by pSlotList. If that buffer is large enough to hold the list of slots, then the list is returned in it, and CKR_OK is returned. If not, then the call to C_GetSlotList returns the value CKR_BUFFER_TOO_SMALL. In either case, the value *pulCount is set to hold the number of slots.

Because C_GetSlotList does not allocate any space of its own, an application will often call C_GetSlotList twice (or sometimes even more times"if an application is trying to get a list of all slots with a token present, then the number of such slots can (unfortunately) change between when the application asks for how many such slots there are and when the application asks for the slots themselves). However, multiple calls to C_GetSlotList are by no means required.

All slots which C_GetSlotList reports must be able to be queried as valid slots by C_GetSlotInfo. Furthermore, the set of slots accessible through a Cryptoki library is checked at the time that C_GetSlotList, for list length prediction (NULL pSlotList argument) is called. If an application calls C_GetSlotList with a non-NULL pSlotList, and then the user adds or removes a hardware device, the changed slot list will only be visible and effective if C_GetSlotList is called again with NULL. Even if C_ GetSlotList is successfully called this way, it may or may not be the case that the changed slot list will be successfully recognized depending on the library implementation. On some platforms, or earlier PKCS11 compliant libraries, it may be necessary to successfully call C_Initialize or to restart the entire system.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK.
Example:

CK_ULONG ulSlotCount, ulSlotWithTokenCount;
CK_SLOT_ID_PTR pSlotList, pSlotWithTokenList;
CK_RV rv;
/* Get list of all slots */
rv = C_GetSlotList(CK_FALSE, NULL_PTR, &ulSlotCount);
if (rv == CKR_OK) {
pSlotList =
(CK_SLOT_ID_PTR) malloc(ulSlotCount*sizeof(CK_SLOT_ID));
rv = C_GetSlotList(CK_FALSE, pSlotList, &ulSlotCount);
if (rv == CKR_OK) {
/* Now use that list of all slots */
.
.
}
free(pSlotList);
}
/* Get list of all slots with a token present */
pSlotWithTokenList = (CK_SLOT_ID_PTR) malloc(0);
ulSlotWithTokenCount = 0;
while (1) {
rv = C_GetSlotList(
CK_TRUE, pSlotWithTokenList, ulSlotWithTokenCount);
if (rv != CKR_BUFFER_TOO_SMALL)
break;
pSlotWithTokenList = realloc(
pSlotWithTokenList,
ulSlotWithTokenList*sizeof(CK_SLOT_ID));
}
if (rv == CKR_OK) {
/* Now use that list of all slots with a token present */
.
.
}
free(pSlotWithTokenList);

CK_RV C_GetSlotInfo CK_SLOT_ID    slotID,
CK_SLOT_INFO_PTR    pInfo
;
 

C_GetSlotInfo obtains information about a particular slot in the system.

Parameters:
slotID is the ID of the slot;
pInfo points to the location that receives the slot information.
Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID.
See also:
C_GetTokenInfo.'''

CK_RV C_GetTokenInfo CK_SLOT_ID    slotID,
CK_TOKEN_INFO_PTR    pInfo
;
 

C_GetTokenInfo obtains information about a particular token in the system.

Parameters:
slotID is the ID of the token's slot;
pInfo points to the location that receives the token information.
Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_ARGUMENTS_BAD.
Example:

CK_ULONG ulCount;
CK_SLOT_ID_PTR pSlotList;
CK_SLOT_INFO slotInfo;
CK_TOKEN_INFO tokenInfo;
CK_RV rv;
rv = C_GetSlotList(CK_FALSE, NULL_PTR, &ulCount);
if ((rv == CKR_OK) && (ulCount > 0)) {
pSlotList = (CK_SLOT_ID_PTR) malloc(ulCount*sizeof(CK_SLOT_ID));
rv = C_GetSlotList(CK_FALSE, pSlotList, &ulCount);
assert(rv == CKR_OK);
/* Get slot information for first slot */
rv = C_GetSlotInfo(pSlotList[0], &slotInfo);
assert(rv == CKR_OK);
/* Get token information for first slot */
rv = C_GetTokenInfo(pSlotList[0], &tokenInfo);
if (rv == CKR_TOKEN_NOT_PRESENT) {
.
.
}
.
.
free(pSlotList);
}

CK_RV C_WaitForSlotEvent CK_FLAGS    flags,
CK_SLOT_ID_PTR    pSlot,
CK_VOID_PTR    pReserved
;
 

C_WaitForSlotEvent waits for a slot event, such as token insertion or token removal, to occur.

Parameters:
flags determines whether or not the C_WaitForSlotEvent call blocks (i.e., waits for a slot event to occur);
pSlot points to a location which will receive the ID of the slot that the event occurred in.
pReserved is reserved for future versions: for this version of Cryptoki, it should be NULL_PTR.
At present, the only flag defined for use in the flags argument is CKF_DONT_BLOCK :

Internally, each Cryptoki application has a flag for each slot which is used to track whether or not any unrecognized events involving that slot have occurred. When an application initially calls C_Initialize, every slot's event flag is cleared. Whenever a slot event occurs, the flag corresponding to the slot in which the event occurred is set.

If C_WaitForSlotEvent is called with the CKF_DONT_BLOCK flag set in the flags argument, and some slot's event flag is set, then that event flag is cleared, and the call returns with the ID of that slot in the location pointed to by pSlot. If more than one slot's event flag is set at the time of the call, one such slot is chosen by the library to have its event flag cleared and to have its slot ID returned.

If C_WaitForSlotEvent is called with the CKF_DONT_BLOCK flag set in the flags argument, and no slot's event flag is set, then the call returns with the value CKR_NO_EVENT. In this case, the contents of the location pointed to by pSlot when C_WaitForSlotEvent are undefined.

If C_WaitForSlotEvent is called with the CKF_DONT_BLOCK flag clear in the flags argument, then the call behaves as above, except that it will block. That is, if no slot's event flag is set at the time of the call, C_WaitForSlotEvent will wait until some slot's event flag becomes set. If a thread of an application has a C_WaitForSlotEvent call blocking when another thread of that application calls C_Finalize, the C_WaitForSlotEvent call returns with the value CKR_CRYPTOKI_NOT_INITIALIZED.

Although the parameters supplied to C_Initialize can in general allow for safe multi-threaded access to a Cryptoki library, C_WaitForSlotEvent is exceptional in that the behavior of Cryptoki is undefined if multiple threads of a single application make simultaneous calls to C_WaitForSlotEvent.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_NO_EVENT, CKR_OK.
Example:

CK_FLAGS flags = 0;
CK_SLOT_ID slotID;
CK_SLOT_INFO slotInfo;
.
.
/* Block and wait for a slot event */
rv = C_WaitForSlotEvent(flags, &slotID, NULL_PTR);
assert(rv == CKR_OK);
/* See what's up with that slot */
rv = C_GetSlotInfo(slotID, &slotInfo);
assert(rv == CKR_OK);
.
.

CK_RV C_GetMechanismList CK_SLOT_ID    slotID,
CK_MECHANISM_TYPE_PTR    pMechanismList,
CK_ULONG_PTR    pulCount
;
 

C_GetMechanismList is used to obtain a list of mechanism types supported by a token.

Parameters:
SlotID is the ID of the token's slot;
pulCount points to the location that receives the number of mechanisms.
There are two ways for an application to call C_GetMechanismList :

  1. If pMechanismList is NULL_PTR, then all that C_GetMechanismList does is return (in *pulCount) the number of mechanisms, without actually returning a list of mechanisms. The contents of *pulCount on entry to C_GetMechanismList has no meaning in this case, and the call returns the value CKR_OK.

  2. If pMechanismList is not NULL_PTR, then *pulCount must contain the size (in terms of CK_MECHANISM_TYPE elements) of the buffer pointed to by pMechanismList. If that buffer is large enough to hold the list of mechanisms, then the list is returned in it, and CKR_OK is returned. If not, then the call to C_GetMechanismList returns the value CKR_BUFFER_TOO_SMALL. In either case, the value *pulCount is set to hold the number of mechanisms.

Because C_GetMechanismList does not allocate any space of its own, an application will often call C_GetMechanismList twice. However, this behavior is by no means required.

Returns:
CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_ARGUMENTS_BAD.
Example:

CK_SLOT_ID slotID;
CK_ULONG ulCount;
CK_MECHANISM_TYPE_PTR pMechanismList;
CK_RV rv;
.
.
rv = C_GetMechanismList(slotID, NULL_PTR, &ulCount);
if ((rv == CKR_OK) && (ulCount > 0)) {
pMechanismList =
(CK_MECHANISM_TYPE_PTR)
malloc(ulCount*sizeof(CK_MECHANISM_TYPE));
rv = C_GetMechanismList(slotID, pMechanismList, &ulCount);
if (rv == CKR_OK) {
.
.
}
free(pMechanismList);
}

CK_RV C_GetMechanismInfo CK_SLOT_ID    slotID,
CK_MECHANISM_TYPE    type,
CK_MECHANISM_INFO_PTR    pInfo
;
 

C_GetMechanismInfo obtains information about a particular mechanism possibly supported by a token.

Parameters:
slotID is the ID of the token's slot;
type is the type of mechanism;
pInfo points to the location that receives the mechanism information.
Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_ARGUMENTS_BAD.
Example:

CK_SLOT_ID slotID;
CK_MECHANISM_INFO info;
CK_RV rv;
.
.
/* Get information about the CKM_MD2 mechanism for this token */
rv = C_GetMechanismInfo(slotID, CKM_MD2, &info);
if (rv == CKR_OK) {
if (info.flags & CKF_DIGEST) {
.
.
}
}

CK_RV C_InitToken CK_SLOT_ID    slotID,
CK_UTF8CHAR_PTR    pPin,
CK_ULONG    ulPinLen,
CK_UTF8CHAR_PTR    pLabel
;
 

C_InitToken initializes a token.

Parameters:
slotID is the ID of the token's slot;
pPin points to the SO's initial PIN (which need not be null-terminated);
ulPinLen is the length in bytes of the PIN;
pLabel points to the 32-byte label of the token (which must be padded with blank characters, and which must not be null-terminated). This standard allows PIN values to contain any valid UTF8 character, but the token may impose subset restrictions.
If the token has not been initialized (i.e. new from the factory), then the pPin parameter becomes the initial value of the SO PIN. If the token is being reinitialized, the pPin parameter is checked against the existing SO PIN to authorize the initialization operation. In both cases, the SO PIN is the value pPin after the function completes successfully. If the SO PIN is lost, then the card must be reinitialized using a mechanism outside the scope of this standard. The CKF_TOKEN_INITIALIZED flag in the CK_TOKEN_INFO structure indicates the action that will result from calling C_InitToken. If set, the token will be reinitialized, and the client must supply the existing SO password in pPin.

When a token is initialized, all objects that can be destroyed are destroyed (i.e., all except for "indestructible" objects such as keys built into the token). Also, access by the normal user is disabled until the SO sets the normal user's PIN. Depending on the token, some "default" objects may be created, and attributes of some objects may be set to default values.

If the token has a "protected authentication path", as indicated by the CKF_PROTECTED_AUTHENTICATION_PATH flag in its CK_TOKEN_INFO being set, then that means that there is some way for a user to be authenticated to the token without having the application send a PIN through the Cryptoki library. One such possibility is that the user enters a PIN on a PINpad on the token itself, or on the slot device. To initialize a token with such a protected authentication path, the pPin parameter to C_InitToken should be NULL_PTR. During the execution of C_InitToken, the SO's PIN will be entered through the protected authentication path.

If the token has a protected authentication path other than a PINpad, then it is token-dependent whether or not C_InitToken can be used to initialize the token.

A token cannot be initialized if Cryptoki detects that any application has an open session with it; when a call to C_InitToken is made under such circumstances, the call fails with error CKR_SESSION_EXISTS. Unfortunately, it may happen when C_InitToken is called that some other application does have an open session with the token, but Cryptoki cannot detect this, because it cannot detect anything about other applications using the token. If this is the case, then the consequences of the C_InitToken call are undefined.

The C_InitToken function may not be sufficient to properly initialize complex tokens. In these situations, an initialization mechanism outside the scope of Cryptoki must be employed. The definition of "complex token" is product specific.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_INCORRECT, CKR_PIN_LOCKED, CKR_SESSION_EXISTS, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_TOKEN_WRITE_PROTECTED, CKR_ARGUMENTS_BAD.
Example:

CK_SLOT_ID slotID;
CK_UTF8CHAR_PTR pin = "MyPIN";
CK_UTF8CHAR label[32];
CK_RV rv;
.
.
memset(label, ' ', sizeof(label));
memcpy(label, "My first token", strlen("My first token"));
rv = C_InitToken(slotID, pin, strlen(pin), label);
if (rv == CKR_OK) {
.
.
}

CK_RV C_InitPIN CK_SESSION_HANDLE    hSession,
CK_UTF8CHAR_PTR    pPin,
CK_ULONG    ulPinLen
;
 

C_InitPIN initializes the normal user's PIN.

Parameters:
hSession is the session's handle;
pPin points to the normal user's PIN; ulPinLen is the length in bytes of the PIN. This standard allows PIN values to contain any valid UTF8 character, but the token may impose subset restrictions.
C_InitPIN can only be called in the "R/W SO Functions" state. An attempt to call it from a session in any other state fails with error CKR_USER_NOT_LOGGED_IN.

If the token has a "protected authentication path", as indicated by the CKF_PROTECTED_AUTHENTICATION_PATH flag in its CK_TOKEN_INFO being set, then that means that there is some way for a user to be authenticated to the token without having the application send a PIN through the Cryptoki library. One such possibility is that the user enters a PIN on a PINpad on the token itself, or on the slot device. To initialize the normal user's PIN on a token with such a protected authentication path, the pPin parameter to C_InitPIN should be NULL_PTR. During the execution of C_InitPIN, the SO will enter the new PIN through the protected authentication path.

If the token has a protected authentication path other than a PINpad, then it is token-dependent whether or not C_InitPIN can be used to initialize the normal user's token access.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_INVALID, CKR_PIN_LEN_RANGE, CKR_SESSION_CLOSED, CKR_SESSION_READ_ONLY, CKR_SESSION_HANDLE_INVALID, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN, CKR_ARGUMENTS_BAD.
Example:

CK_SESSION_HANDLE hSession;
CK_UTF8CHAR newPin[]= {"NewPIN"};
CK_RV rv;
rv = C_InitPIN(hSession, newPin, sizeof(newPin)-1);
if (rv == CKR_OK) {
.
.
}

CK_RV C_SetPIN CK_SESSION_HANDLE    hSession,
CK_UTF8CHAR_PTR    pOldPin,
CK_ULONG    ulOldLen,
CK_UTF8CHAR_PTR    pNewPin,
CK_ULONG    ulNewLen
;
 

C_SetPIN modifies the PIN of the user that is currently logged in, or the CKU_USER PIN if the session is not logged in.

Parameters:
hSession is the session's handle;
pOldPin points to the old PIN;
ulOldLen is the length in bytes of the old PIN; pNewPin points to the new PIN;
ulNewLen is the length in bytes of the new PIN. This standard allows PIN values to contain any valid UTF8 character, but the token may impose subset restrictions.
C_SetPIN can only be called in the "R/W Public Session" state, "R/W SO Functions" state, or "R/W User Functions" state. An attempt to call it from a session in any other state fails with error CKR_SESSION_READ_ONLY.

If the token has a "protected authentication path", as indicated by the CKF_PROTECTED_AUTHENTICATION_PATH flag in its CK_TOKEN_INFO being set, then that means that there is some way for a user to be authenticated to the token without having the application send a PIN through the Cryptoki library. One such possibility is that the user enters a PIN on a PINpad on the token itself, or on the slot device. To modify the current user's PIN on a token with such a protected authentication path, the pOldPin and pNewPin parameters to C_SetPIN should be NULL_PTR. During the execution of C_SetPIN, the current user will enter the old PIN and the new PIN through the protected authentication path. It is not specified how the PINpad should be used to enter two PINs; this varies.

If the token has a protected authentication path other than a PINpad, then it is token-dependent whether or not C_SetPIN can be used to modify the current user's PIN.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_INCORRECT, CKR_PIN_INVALID, CKR_PIN_LEN_RANGE, CKR_PIN_LOCKED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TOKEN_WRITE_PROTECTED, CKR_ARGUMENTS_BAD.
Example:

CK_SESSION_HANDLE hSession;
CK_UTF8CHAR oldPin[] = {"OldPIN"};
CK_UTF8CHAR newPin[] = {"NewPIN"};
CK_RV rv;
rv = C_SetPIN(
hSession, oldPin, sizeof(oldPin)-1, newPin, sizeof(newPin)-1);
if (rv == CKR_OK) {
.
.
}

CK_RV C_OpenSession CK_SLOT_ID    slotID,
CK_FLAGS    flags,
CK_VOID_PTR    pApplication,
CK_NOTIFY    Notify,
CK_SESSION_HANDLE_PTR    phSession
;
 

C_OpenSession opens a session between an application and a token in a particular slot.

Parameters:
slotID is the slot's ID;
flags indicates the type of session;
pApplication is an application-defined pointer to be passed to the notification callback; Notify is the address of the notification callback function (see Section 11.17); phSession points to the location that receives the handle for the new session.
When opening a session with C_OpenSession, the flags parameter consists of the logical OR of zero or more bit flags defined in the CK_SESSION_INFO data type. For legacy reasons, the CKF_SERIAL_SESSION bit must always be set; if a call to C_OpenSession does not have this bit set, the call should return unsuccessfully with the error code CKR_SESSION_PARALLEL_NOT_SUPPORTED.

There may be a limit on the number of concurrent sessions an application may have with the token, which may depend on whether the session is "read-only" or "read/write". An attempt to open a session which does not succeed because there are too many existing sessions of some type should return CKR_SESSION_COUNT.

If the token is write-protected (as indicated in the CK_TOKEN_INFO structure), then only read-only sessions may be opened with it.

If the application calling C_OpenSession already has a R/W SO session open with the token, then any attempt to open a R/O session with the token fails with error code CKR_SESSION_READ_WRITE_SO_EXISTS (see Section 6.7.7).

The Notify callback function is used by Cryptoki to notify the application of certain events. If the application does not wish to support callbacks, it should pass a value of NULL_PTR as the Notify parameter. See Section 11.17 for more information about application callbacks.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_COUNT, CKR_SESSION_PARALLEL_NOT_SUPPORTED, CKR_SESSION_READ_WRITE_SO_EXISTS, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED, CKR_TOKEN_WRITE_PROTECTED, CKR_ARGUMENTS_BAD.
See also:
C_CloseSession.

CK_RV C_CloseSession CK_SESSION_HANDLE    hSession ;
 

C_CloseSession closes a session between an application and a token.

Parameters:
hSession is the session's handle.
When a session is closed, all session objects created by the session are destroyed automatically, even if the application has other sessions "using" the objects (see Sections 6.7.5- 6.7.7 for more details).

If this function is successful and it closes the last session between the application and the token, the login state of the token for the application returns to public sessions. Any new sessions to the token opened by the application will be either R/O Public or R/W Public sessions.

Depending on the token, when the last open session any application has with the token is closed, the token may be "ejected" from its reader (if this capability exists).

Despite the fact this C_CloseSession is supposed to close a session, the return value CKR_SESSION_CLOSED is an error return. It actually indicates the (probably somewhat unlikely) event that while this function call was executing, another call was made to C_CloseSession to close this particular session, and that call finished executing first. Such uses of sessions are a bad idea, and Cryptoki makes little promise of what will occur in general if an application indulges in this sort of behavior.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

CK_SLOT_ID slotID;
CK_BYTE application;
CK_NOTIFY MyNotify;
CK_SESSION_HANDLE hSession;
CK_RV rv;
.
.
application = 17;
MyNotify = &EncryptionSessionCallback;
rv = C_OpenSession(
slotID, CKF_SERIAL_SESSION | CKF_RW_SESSION,
(CK_VOID_PTR) &application, MyNotify,
&hSession);
if (rv == CKR_OK) {
.
.
C_CloseSession(hSession);
}

CK_RV C_CloseAllSessions CK_SLOT_ID    slotID ;
 

C_CloseAllSessions closes all sessions an application has with a token.

Parameters:
slotID specifies the token's slot.
When a session is closed, all session objects created by the session are destroyed automatically.

After successful execution of this function, the login state of the token for the application returns to public sessions. Any new sessions to the token opened by the application will be either R/O Public or R/W Public sessions.

Depending on the token, when the last open session any application has with the token is closed, the token may be "ejected" from its reader (if this capability exists).

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT.
Example:

CK_SLOT_ID slotID;
CK_RV rv;
.
.
rv = C_CloseAllSessions(slotID);

CK_RV C_GetSessionInfo CK_SESSION_HANDLE    hSession,
CK_SESSION_INFO_PTR    pInfo
;
 

C_GetSessionInfo obtains information about a session.

Parameters:
hSession is the session's handle;
pInfo points to the location that receives the session information.
Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_ARGUMENTS_BAD.
Example:

CK_SESSION_HANDLE hSession;
CK_SESSION_INFO info;
CK_RV rv;
.
.
rv = C_GetSessionInfo(hSession, &info);
if (rv == CKR_OK) {
if (info.state == CKS_RW_USER_FUNCTIONS) {
.
.
}
.
.
}

CK_RV C_GetOperationState CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pOperationState,
CK_ULONG_PTR    pulOperationStateLen
;
 

C_GetOperationState obtains a copy of the cryptographic operations state of a session, encoded as a string of bytes.

Parameters:
hSession is the session's handle;
pOperationState points to the location that receives the state;
pulOperationStateLen points to the location that receives the length in bytes of the state.
Although the saved state output by C_GetOperationState is not really produced by a "cryptographic mechanism", C_GetOperationState nonetheless uses the convention described in Section 11.2 on producing output.

Precisely what the "cryptographic operations state" this function saves is varies from token to token; however, this state is what is provided as input to C_SetOperationState to restore the cryptographic activities of a session.

Consider a session which is performing a message digest operation using SHA-1 (i.e., the session is using the CKM_SHA_1 mechanism). Suppose that the message digest operation was initialized properly, and that precisely 80 bytes of data have been supplied so far as input to SHA-1. The application now wants to "save the state" of this digest operation, so that it can continue it later. In this particular case, since SHA-1 processes 512 bits (64 bytes) of input at a time, the cryptographic operations state of the session most likely consists of three distinct parts: the state of SHA-1's 160-bit internal chaining variable; the 16 bytes of unprocessed input data; and some administrative data indicating that this saved state comes from a session which was performing SHA-1 hashing. Taken together, these three pieces of information suffice to continue the current hashing operation at a later time.

Consider next a session which is performing an encryption operation with DES (a block cipher with a block size of 64 bits) in CBC (cipher-block chaining) mode (i.e., the session is using the CKM_DES_CBC mechanism). Suppose that precisely 22 bytes of data (in addition to an IV for the CBC mode) have been supplied so far as input to DES, which means that the first two 8-byte blocks of ciphertext have already been produced and output. In this case, the cryptographic operations state of the session most likely consists of three or four distinct parts: the second 8-byte block of ciphertext (this will be used for cipher-block chaining to produce the next block of ciphertext); the 6 bytes of data still awaiting encryption; some administrative data indicating that this saved state comes from a session which was performing DES encryption in CBC mode; and possibly the DES key being used for encryption (see C_SetOperationState for more information on whether or not the key is present in the saved state).

If a session is performing two cryptographic operations simultaneously (see Section 11.13), then the cryptographic operations state of the session will contain all the necessary information to restore both operations.

An attempt to save the cryptographic operations state of a session which does not currently have some active savable cryptographic operation(s) (encryption, decryption, digesting, signing without message recovery, verification without message recovery, or some legal combination of two of these) should fail with the error CKR_OPERATION_NOT_INITIALIZED.

An attempt to save the cryptographic operations state of a session which is performing an appropriate cryptographic operation (or two), but which cannot be satisfied for any of various reasons (certain necessary state information and/or key information can't leave the token, for example) should fail with the error CKR_STATE_UNSAVEABLE.

Returns:
CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_STATE_UNSAVEABLE, CKR_ARGUMENTS_BAD.
See also:
C_SetOperationState.

CK_RV C_SetOperationState CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pOperationState,
CK_ULONG    ulOperationStateLen,
CK_OBJECT_HANDLE    hEncryptionKey,
CK_OBJECT_HANDLE    hAuthenticationKey
;
 

C_SetOperationState restores the cryptographic operations state of a session from a string of bytes obtained with C_GetOperationState.

Parameters:
hSession is the session's handle;
pOperationState points to the location holding the saved state;
ulOperationStateLen holds the length of the saved state;
hEncryptionKey holds a handle to the key which will be used for an ongoing encryption or decryption operation in the restored session (or 0 if no encryption or decryption key is needed, either because no such operation is ongoing in the stored session or because all the necessary key information is present in the saved state);
hAuthenticationKey holds a handle to the key which will be used for an ongoing signature, MACing, or verification operation in the restored session (or 0 if no such key is needed, either because no such operation is ongoing in the stored session or because all the necessary key information is present in the saved state).
The state need not have been obtained from the same session (the "source session") as it is being restored to (the "destination session"). However, the source session and destination session should have a common session state (e.g., CKS_RW_USER_FUNCTIONS), and should be with a common token. There is also no guarantee that cryptographic operations state may be carried across logins, or across different Cryptoki implementations.

If C_SetOperationState is supplied with alleged saved cryptographic operations state which it can determine is not valid saved state (or is cryptographic operations state from a session with a different session state, or is cryptographic operations state from a different token), it fails with the error CKR_SAVED_STATE_INVALID.

Saved state obtained from calls to C_GetOperationState may or may not contain information about keys in use for ongoing cryptographic operations. If a saved cryptographic operations state has an ongoing encryption or decryption operation, and the key in use for the operation is not saved in the state, then it must be supplied to C_SetOperationState in the hEncryptionKey argument. If it is not, then C_SetOperationState will fail and return the error CKR_KEY_NEEDED. If the key in use for the operation is saved in the state, then it can be supplied in the hEncryptionKey argument, but this is not required.

Similarly, if a saved cryptographic operations state has an ongoing signature, MACing, or verification operation, and the key in use for the operation is not saved in the state, then it must be supplied to C_SetOperationState in the hAuthenticationKey argument. If it is not, then C_SetOperationState will fail with the error CKR_KEY_NEEDED. If the key in use for the operation is saved in the state, then it can be supplied in the hAuthenticationKey argument, but this is not required.

If an irrelevant key is supplied to C_SetOperationState call (e.g., a nonzero key handle is submitted in the hEncryptionKey argument, but the saved cryptographic operations state supplied does not have an ongoing encryption or decryption operation, then C_SetOperationState fails with the error CKR_KEY_NOT_NEEDED.

If a key is supplied as an argument to C_SetOperationState, and C_SetOperationState can somehow detect that this key was not the key being used in the source session for the supplied cryptographic operations state (it may be able to detect this if the key or a hash of the key is present in the saved state, for example), then C_SetOperationState fails with the error CKR_KEY_CHANGED.

An application can look at the CKF_RESTORE_KEY_NOT_NEEDED flag in the flags field of the CK_TOKEN_INFO field for a token to determine whether or not it needs to supply key handles to C_SetOperationState calls. If this flag is true, then a call to C_SetOperationState never needs a key handle to be supplied to it. If this flag is false, then at least some of the time, C_SetOperationState requires a key handle, and so the application should probably always pass in any relevant key handles when restoring cryptographic operations state to a session.

C_SetOperationState can successfully restore cryptographic operations state to a session even if that session has active cryptographic or object search operations when C_SetOperationState is called (the ongoing operations are abruptly cancelled).

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_CHANGED, CKR_KEY_NEEDED, CKR_KEY_NOT_NEEDED, CKR_OK, CKR_SAVED_STATE_INVALID, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_ARGUMENTS_BAD.
Example:

CK_SESSION_HANDLE hSession;
CK_MECHANISM digestMechanism;
CK_ULONG ulStateLen;
CK_BYTE data1[] = {0x01, 0x03, 0x05, 0x07};
CK_BYTE data2[] = {0x02, 0x04, 0x08};
CK_BYTE data3[] = {0x10, 0x0F, 0x0E, 0x0D, 0x0C};
CK_BYTE pDigest[20];
CK_ULONG ulDigestLen;
CK_RV rv;
.
.
/* Initialize hash operation */
rv = C_DigestInit(hSession, &digestMechanism);
assert(rv == CKR_OK);
/* Start hashing */
rv = C_DigestUpdate(hSession, data1, sizeof(data1));
assert(rv == CKR_OK);
/* Find out how big the state might be */
rv = C_GetOperationState(hSession, NULL_PTR, &ulStateLen);
assert(rv == CKR_OK);
/* Allocate some memory and then get the state */
pState = (CK_BYTE_PTR) malloc(ulStateLen);
rv = C_GetOperationState(hSession, pState, &ulStateLen);
/* Continue hashing */
rv = C_DigestUpdate(hSession, data2, sizeof(data2));
assert(rv == CKR_OK);
/* Restore state. No key handles needed */
rv = C_SetOperationState(hSession, pState, ulStateLen, 0, 0);
assert(rv == CKR_OK);
/* Continue hashing from where we saved state */
rv = C_DigestUpdate(hSession, data3, sizeof(data3));
assert(rv == CKR_OK);
/* Conclude hashing operation */
ulDigestLen = sizeof(pDigest);
rv = C_DigestFinal(hSession, pDigest, &ulDigestLen);
if (rv == CKR_OK) {
/* pDigest[] now contains the hash of 0x01030507100F0E0D0C */
.
.
}

CK_RV C_Login CK_SESSION_HANDLE    hSession,
CK_USER_TYPE    userType,
CK_UTF8CHAR_PTR    pPin,
CK_ULONG    ulPinLen
;
 

C_Login logs a user into a token.

Parameters:
hSession is a session handle;
userType is the user type;
pPin points to the user's PIN; ulPinLen is the length of the PIN. This standard allows PIN values to contain any valid UTF8 character, but the token may impose subset restrictions.
When the user type is either CKU_SO or CKU_USER, if the call succeeds, each of the application's sessions will enter either the "R/W SO Functions" state, the "R/W User Functions" state, or the "R/O User Functions" state. If the user type is CKU_CONTEXT_SPECIFIC , the behavior of C_Login depends on the context in which it is called. Improper use of this user type will result in a return value CKR_OPERATION_NOT_INITIALIZED..

If the token has a "protected authentication path", as indicated by the CKF_PROTECTED_AUTHENTICATION_PATH flag in its CK_TOKEN_INFO being set, then that means that there is some way for a user to be authenticated to the token without having the application send a PIN through the Cryptoki library. One such possibility is that the user enters a PIN on a PINpad on the token itself, or on the slot device. Or the user might not even use a PIN"authentication could be achieved by some fingerprint-reading device, for example. To log into a token with a protected authentication path, the pPin parameter to C_Login should be NULL_PTR. When C_Login returns, whatever authentication method supported by the token will have been performed; a return value of CKR_OK means that the user was successfully authenticated, and a return value of CKR_PIN_INCORRECT means that the user was denied access.

If there are any active cryptographic or object finding operations in an application's session, and then C_Login is successfully executed by that application, it may or may not be the case that those operations are still active. Therefore, before logging in, any active operations should be finished.

If the application calling C_Login has a R/O session open with the token, then it will be unable to log the SO into a session (see Section 6.7.7). An attempt to do this will result in the error code CKR_SESSION_READ_ONLY_EXISTS.

C_Login may be called repeatedly, without intervening C_Logout calls, if (and only if) a key with the CKA_ALWAYS_AUTHENTICATE attribute set to CK_TRUE exists, and the user needs to do cryptographic operation on this key. See further Section 10.9.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_PIN_INCORRECT, CKR_PIN_LOCKED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY_EXISTS, CKR_USER_ALREADY_LOGGED_IN, CKR_USER_ANOTHER_ALREADY_LOGGED_IN, CKR_USER_PIN_NOT_INITIALIZED, CKR_USER_TOO_MANY_TYPES, CKR_USER_TYPE_INVALID.
See also:
C_Logout.

CK_RV C_Logout CK_SESSION_HANDLE    hSession ;
 

C_Logout logs a user out from a token.

Parameters:
hSession is the session's handle.
Depending on the current user type, if the call succeeds, each of the application's sessions will enter either the "R/W Public Session" state or the "R/O Public Session" state.

When C_Logout successfully executes, any of the application's handles to private objects become invalid (even if a user is later logged back into the token, those handles remain invalid). In addition, all private session objects from sessions belonging to the application are destroyed.

If there are any active cryptographic or object-finding operations in an application's session, and then C_Logout is successfully executed by that application, it may or may not be the case that those operations are still active. Therefore, before logging out, any active operations should be finished.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_UTF8CHAR userPIN[] = {"MyPIN"};
CK_RV rv;
rv = C_Login(hSession, CKU_USER, userPIN, sizeof(userPIN)-1);
if (rv == CKR_OK) {
.
.
rv == C_Logout(hSession);
if (rv == CKR_OK) {
.
.
}
}

CK_RV C_CreateObject CK_SESSION_HANDLE    hSession,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulCount,
CK_OBJECT_HANDLE_PTR    phObject
;
 

C_CreateObject creates a new object.

Parameters:
hSession is the session's handle;
pTemplate points to the object's template;
ulCount is the number of attributes in the template;
phObject points to the location that receives the new object's handle.
If a call to C_CreateObject cannot support the precise template supplied to it, it will fail and return without creating any object.

If C_CreateObject is used to create a key object, the key object will have its CKA_LOCAL attribute set to CK_FALSE. If that key object is a secret or private key then the new key will have the CKA_ALWAYS_SENSITIVE attribute set to CK_FALSE, and the CKA_NEVER_EXTRACTABLE attribute set to CK_FALSE.

Only session objects can be created during a read-only session. Only public objects can be created unless the normal user is logged in.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE
hData,
hCertificate,
hKey;
CK_OBJECT_CLASS
dataClass = CKO_DATA,
certificateClass = CKO_CERTIFICATE,
keyClass = CKO_PUBLIC_KEY;
CK_KEY_TYPE keyType = CKK_RSA;
CK_UTF8CHAR application[] = {"My Application"};
CK_BYTE dataValue[] = {...};
CK_BYTE subject[] = {...};
CK_BYTE id[] = {...};
CK_BYTE certificateValue[] = {...};
CK_BYTE modulus[] = {...};
CK_BYTE exponent[] = {...};
CK_BBOOL true = CK_TRUE;
CK_ATTRIBUTE dataTemplate[] = {
{CKA_CLASS, &dataClass, sizeof(dataClass)},
{CKA_TOKEN, &true, sizeof(true)},
{CKA_APPLICATION, application, sizeof(application)-1},
{CKA_VALUE, dataValue, sizeof(dataValue)}
};
CK_ATTRIBUTE certificateTemplate[] = {
{CKA_CLASS, &certificateClass, sizeof(certificateClass)},
{CKA_TOKEN, &true, sizeof(true)},
{CKA_SUBJECT, subject, sizeof(subject)},
{CKA_ID, id, sizeof(id)},
{CKA_VALUE, certificateValue, sizeof(certificateValue)}
};
CK_ATTRIBUTE keyTemplate[] = {
{CKA_CLASS, &keyClass, sizeof(keyClass)},
{CKA_KEY_TYPE, &keyType, sizeof(keyType)},
{CKA_WRAP, &true, sizeof(true)},
{CKA_MODULUS, modulus, sizeof(modulus)},
{CKA_PUBLIC_EXPONENT, exponent, sizeof(exponent)}
};
CK_RV rv;
.
.
/* Create a data object */
rv = C_CreateObject(hSession, &dataTemplate, 4, &hData);
if (rv == CKR_OK) {
.
.
}
/* Create a certificate object */
rv = C_CreateObject(
hSession, &certificateTemplate, 5, &hCertificate);
if (rv == CKR_OK) {
.
.
}
/* Create an RSA public key object */
rv = C_CreateObject(hSession, &keyTemplate, 5, &hKey);
if (rv == CKR_OK) {
.
.
}

CK_RV C_CopyObject CK_SESSION_HANDLE    hSession,
CK_OBJECT_HANDLE    hObject,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulCount,
CK_OBJECT_HANDLE_PTR    phNewObject
;
 

C_CopyObject copies an object, creating a new object for the copy.

Parameters:
hSession is the session's handle;
hObject is the object's handle;
pTemplate points to the template for the new object;
ulCount is the number of attributes in the template;
phNewObject points to the location that receives the handle for the copy of the object.
The template may specify new values for any attributes of the object that can ordinarily be modified (e.g., in the course of copying a secret key, a key's CKA_EXTRACTABLE attribute may be changed from CK_TRUE to CK_FALSE, but not the other way around. If this change is made, the new key's CKA_NEVER_EXTRACTABLE attribute will have the value CK_FALSE. Similarly, the template may specify that the new key's CKA_SENSITIVE attribute be CK_TRUE; the new key will have the same value for its CKA_ALWAYS_SENSITIVE attribute as the original key). It may also specify new values of the CKA_TOKEN and CKA_PRIVATE attributes (e.g., to copy a session object to a token object). If the template specifies a value of an attribute which is incompatible with other existing attributes of the object, the call fails with the return code CKR_TEMPLATE_INCONSISTENT.

If a call to C_CopyObject cannot support the precise template supplied to it, it will fail and return without creating any object. If the object indicated by hObject has its CKA_COPYABLE attribute set to CK_FALSE, C_CopyObject will return CKR_COPY_PROHIBITED.

Only session objects can be created during a read-only session. Only public objects can be created unless the normal user is logged in.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN, CKR_COPY_PROHIBITED.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey, hNewKey;
CK_OBJECT_CLASS keyClass = CKO_SECRET_KEY;
CK_KEY_TYPE keyType = CKK_DES;
CK_BYTE id[] = {...};
CK_BYTE keyValue[] = {...};
CK_BBOOL false = CK_FALSE;
CK_BBOOL true = CK_TRUE;
CK_ATTRIBUTE keyTemplate[] = {
{CKA_CLASS, &keyClass, sizeof(keyClass)},
{CKA_KEY_TYPE, &keyType, sizeof(keyType)},
{CKA_TOKEN, &false, sizeof(false)},
{CKA_ID, id, sizeof(id)},
{CKA_VALUE, keyValue, sizeof(keyValue)}
};
CK_ATTRIBUTE copyTemplate[] = {
{CKA_TOKEN, &true, sizeof(true)}
};
CK_RV rv;
.
.
/* Create a DES secret key session object */
rv = C_CreateObject(hSession, &keyTemplate, 5, &hKey);
if (rv == CKR_OK) {
/* Create a copy which is a token object */
rv = C_CopyObject(hSession, hKey, &copyTemplate, 1, &hNewKey);
.
.
}

CK_RV C_DestroyObject CK_SESSION_HANDLE    hSession,
CK_OBJECT_HANDLE    hObject
;
 

C_DestroyObject destroys an object.

Parameters:
hSession is the session's handle;
hObject is the object's handle.
Only session objects can be destroyed during a read-only session. Only public objects can be destroyed unless the normal user is logged in.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TOKEN_WRITE_PROTECTED.
See also:
C_GetObjectSize.

CK_RV C_GetObjectSize CK_SESSION_HANDLE    hSession,
CK_OBJECT_HANDLE    hObject,
CK_ULONG_PTR    pulSize
;
 

C_GetObjectSize gets the size of an object in bytes.

Parameters:
hSession is the session's handle;
hObject is the object's handle;
pulSize points to the location that receives the size in bytes of the object.
Cryptoki does not specify what the precise meaning of an object's size is. Intuitively, it is some measure of how much token memory the object takes up. If an application deletes (say) a private object of size S, it might be reasonable to assume that the ulFreePrivateMemory field of the token's CK_TOKEN_INFO structure increases by approximately S.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_INFORMATION_SENSITIVE, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hObject;
CK_OBJECT_CLASS dataClass = CKO_DATA;
CK_UTF8CHAR application[] = {"My Application"};
CK_BYTE dataValue[] = {...};
CK_BYTE value[] = {...};
CK_BBOOL true = CK_TRUE;
CK_ATTRIBUTE template[] = {
{CKA_CLASS, &dataClass, sizeof(dataClass)},
{CKA_TOKEN, &true, sizeof(true)},
{CKA_APPLICATION, application, sizeof(application)-1},
{CKA_VALUE, value, sizeof(value)}
};
CK_ULONG ulSize;
CK_RV rv;
.
.
rv = C_CreateObject(hSession, &template, 4, &hObject);
if (rv == CKR_OK) {
rv = C_GetObjectSize(hSession, hObject, &ulSize);
if (rv != CKR_INFORMATION_SENSITIVE) {
.
.
}
rv = C_DestroyObject(hSession, hObject);
.
.
}

CK_RV C_GetAttributeValue CK_SESSION_HANDLE    hSession,
CK_OBJECT_HANDLE    hObject,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulCount
;
 

C_GetAttributeValue obtains the value of one or more attributes of an object.

Parameters:
hSession is the session's handle;
hObject is the object's handle;
pTemplate points to a template that specifies which attribute values are to be obtained, and receives the attribute values;
ulCount is the number of attributes in the template.
For each (type, pValue, ulValueLen) triple in the template, C_GetAttributeValue performs the following algorithm:

  1. If the specified attribute (i.e., the attribute specified by the type field) for the object cannot be revealed because the object is sensitive or unextractable, then the ulValueLen field in that triple is modified to hold the value -1 (i.e., when it is cast to a CK_LONG, it holds -1).

  2. Otherwise, if the specified attribute for the object is invalid (the object does not possess such an attribute), then the ulValueLen field in that triple is modified to hold the value -1.

  3. Otherwise, if the pValue field has the value NULL_PTR, then the ulValueLen field is modified to hold the exact length of the specified attribute for the object.

  4. Otherwise, if the length specified in ulValueLen is large enough to hold the value of the specified attribute for the object, then that attribute is copied into the buffer located at pValue, and the ulValueLen field is modified to hold the exact length of the attribute.

  5. Otherwise, the ulValueLen field is modified to hold the value -1.

If case 1 applies to any of the requested attributes, then the call should return the value CKR_ATTRIBUTE_SENSITIVE. If case 2 applies to any of the requested attributes, then the call should return the value CKR_ATTRIBUTE_TYPE_INVALID. If case 5 applies to any of the requested attributes, then the call should return the value CKR_BUFFER_TOO_SMALL. As usual, if more than one of these error codes is applicable, Cryptoki may return any of them. Only if none of them applies to any of the requested attributes will CKR_OK be returned.

In the special case of an attribute whose value is an array of attributes, for example CKA_WRAP_TEMPLATE, where it is passed in with pValue not NULL, then if the pValue of elements within the array is NULL_PTR then the ulValueLen of elements within the array will be set to the required length. If the pValue of elements within the array is not NULL_PTR, then the ulValueLen element of attributes within the array must reflect the space that the corresponding pValue points to, and pValue is filled in if there is sufficient room. Therefore it is important to initialize the contents of a buffer before calling C_GetAttributeValue to get such an array value. If any ulValueLen within the array isn't large enough, it will be set to -1 and the function will return CKR_BUFFER_TOO_SMALL, as it does if an attribute in the pTemplate argument has ulValueLen too small. Note that any attribute whose value is an array of attributes is identifiable by virtue of the attribute type having the CKF_ARRAY_ATTRIBUTE bit set.

Note that the error codes CKR_ATTRIBUTE_SENSITIVE, CKR_ATTRIBUTE_TYPE_INVALID, and CKR_BUFFER_TOO_SMALL do not denote true errors for C_GetAttributeValue. If a call to C_GetAttributeValue returns any of these three values, then the call must nonetheless have processed every attribute in the template supplied to C_GetAttributeValue. Each attribute in the template whose value can be returned by the call to C_GetAttributeValue will be returned by the call to C_GetAttributeValue.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_SENSITIVE, CKR_ATTRIBUTE_TYPE_INVALID, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hObject;
CK_BYTE_PTR pModulus, pExponent;
CK_ATTRIBUTE template[] = {
{CKA_MODULUS, NULL_PTR, 0},
{CKA_PUBLIC_EXPONENT, NULL_PTR, 0}
};
CK_RV rv;
.
.
rv = C_GetAttributeValue(hSession, hObject, &template, 2);
if (rv == CKR_OK) {
pModulus = (CK_BYTE_PTR) malloc(template[0].ulValueLen);
template[0].pValue = pModulus;
/* template[0].ulValueLen was set by C_GetAttributeValue */
pExponent = (CK_BYTE_PTR) malloc(template[1].ulValueLen);
template[1].pValue = pExponent;
/* template[1].ulValueLen was set by C_GetAttributeValue */
rv = C_GetAttributeValue(hSession, hObject, &template, 2);
if (rv == CKR_OK) {
.
.
}
free(pModulus);
free(pExponent);
}

CK_RV C_SetAttributeValue CK_SESSION_HANDLE    hSession,
CK_OBJECT_HANDLE    hObject,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulCount
;
 

C_SetAttributeValue modifies the value of one or more attributes of an object.

Parameters:
hSession is the session's handle;
hObject is the object's handle;
pTemplate points to a template that specifies which attribute values are to be modified and their new values;
ulCount is the number of attributes in the template.
Only session objects can be modified during a read-only session.

The template may specify new values for any attributes of the object that can be modified. If the template specifies a value of an attribute which is incompatible with other existing attributes of the object, the call fails with the return code CKR_TEMPLATE_INCONSISTENT.

Not all attributes can be modified; see Section 10.1.2 for more details.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OBJECT_HANDLE_INVALID, CKR_OK, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hObject;
CK_UTF8CHAR label[] = {"New label"};
CK_ATTRIBUTE template[] = {
CKA_LABEL, label, sizeof(label)-1
};
CK_RV rv;
.
.
rv = C_SetAttributeValue(hSession, hObject, &template, 1);
if (rv == CKR_OK) {
.
.
}

CK_RV C_FindObjectsInit CK_SESSION_HANDLE    hSession,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulCount
;
 

C_FindObjectsInit initializes a search for token and session objects that match a template.

Parameters:
hSession is the session's handle;
pTemplate points to a search template that specifies the attribute values to match;
ulCount is the number of attributes in the search template. The matching criterion is an exact byte-for-byte match with all attributes in the template. To find all objects, set ulCount to 0.
After calling C_FindObjectsInit, the application may call C_FindObjects one or more times to obtain handles for objects matching the template, and then eventually call C_FindObjectsFinal to finish the active search operation. At most one search operation may be active at a given time in a given session.

The object search operation will only find objects that the session can view. For example, an object search in an "R/W Public Session" will not find any private objects (even if one of the attributes in the search template specifies that the search is for private objects).

If a search operation is active, and objects are created or destroyed which fit the search template for the active search operation, then those objects may or may not be found by the search operation. Note that this means that, under these circumstances, the search operation may return invalid object handles.

Even though C_FindObjectsInit can return the values CKR_ATTRIBUTE_TYPE_INVALID and CKR_ATTRIBUTE_VALUE_INVALID, it is not required to. For example, if it is given a search template with nonexistent attributes in it, it can return CKR_ATTRIBUTE_TYPE_INVALID, or it can initialize a search operation which will match no objects and return CKR_OK.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_FindObjectsFinal.

CK_RV C_FindObjects CK_SESSION_HANDLE    hSession,
CK_OBJECT_HANDLE_PTR    phObject,
CK_ULONG    ulMaxObjectCount,
CK_ULONG_PTR    pulObjectCount
;
 

C_FindObjects continues a search for token and session objects that match a template, obtaining additional object handles.

Parameters:
hSession is the session's handle;
phObject points to the location that receives the list (array) of additional object handles;
ulMaxObjectCount is the maximum number of object handles to be returned;
pulObjectCount points to the location that receives the actual number of object handles returned.
If there are no more objects matching the template, then the location that pulObjectCount points to receives the value 0.

The search must have been initialized with C_FindObjectsInit.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_FindObjectsFinal.

CK_RV C_FindObjectsFinal CK_SESSION_HANDLE    hSession ;
 

C_FindObjectsFinal terminates a search for token and session objects.

Parameters:
hSession is the session's handle.
Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hObject;
CK_ULONG ulObjectCount;
CK_RV rv;
.
.
rv = C_FindObjectsInit(hSession, NULL_PTR, 0);
assert(rv == CKR_OK);
while (1) {
rv = C_FindObjects(hSession, &hObject, 1, &ulObjectCount);
if (rv != CKR_OK || ulObjectCount == 0)
break;
.
.
}
rv = C_FindObjectsFinal(hSession);
assert(rv == CKR_OK);

CK_RV C_EncryptInit CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hKey
;
 

C_EncryptInit initializes an encryption operation.

Parameters:
hSession is the session's handle;
pMechanism points to the encryption mechanism;
hKey is the handle of the encryption key.
The CKA_ENCRYPT attribute of the encryption key, which indicates whether the key supports encryption, must be CK_TRUE.

After calling C_EncryptInit, the application can either call C_Encrypt to encrypt data in a single part; or call C_EncryptUpdate zero or more times, followed by C_EncryptFinal, to encrypt data in multiple parts. The encryption operation is active until the application uses a call to C_Encrypt or C_EncryptFinal to actually obtain the final piece of ciphertext. To process additional data (in single or multiple parts), the application must call C_EncryptInit again.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_EncryptFinal.

CK_RV C_Encrypt CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pData,
CK_ULONG    ulDataLen,
CK_BYTE_PTR    pEncryptedData,
CK_ULONG_PTR    pulEncryptedDataLen
;
 

C_Encrypt encrypts single-part data.

Parameters:
hSession is the session's handle;
pData points to the data;
ulDataLen is the length in bytes of the data;
pEncryptedData points to the location that receives the encrypted data;
pulEncryptedDataLen points to the location that holds the length in bytes of the encrypted data.
C_Encrypt uses the convention described in Section 11.2 on producing output.

The encryption operation must have been initialized with C_EncryptInit. A call to C_Encrypt always terminates the active encryption operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the ciphertext.

C_Encrypt can not be used to terminate a multi-part operation, and must be called after C_EncryptInit without intervening C_EncryptUpdate calls.

For some encryption mechanisms, the input plaintext data has certain length constraints (either because the mechanism can only encrypt relatively short pieces of plaintext, or because the mechanism's input data must consist of an integral number of blocks). If these constraints are not satisfied, then C_Encrypt will fail with return code CKR_DATA_LEN_RANGE.

The plaintext and ciphertext can be in the same place, i.e., it is OK if pData and pEncryptedData point to the same location.

For most mechanisms, C_Encrypt is equivalent to a sequence of C_EncryptUpdate operations followed by C_EncryptFinal.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_EncryptFinal for an example of similar functions.

CK_RV C_EncryptUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pPart,
CK_ULONG    ulPartLen,
CK_BYTE_PTR    pEncryptedPart,
CK_ULONG_PTR    pulEncryptedPartLen
;
 

C_EncryptUpdate continues a multiple-part encryption operation, processing another data part.

Parameters:
hSession is the session's handle;
pPart points to the data part;
ulPartLen is the length of the data part;
pEncryptedPart points to the location that receives the encrypted data part;
pulEncryptedPartLen points to the location that holds the length in bytes of the encrypted data part.
C_EncryptUpdate uses the convention described in Section 11.2 on producing output.

The encryption operation must have been initialized with C_EncryptInit. This function may be called any number of times in succession. A call to C_EncryptUpdate which results in an error other than CKR_BUFFER_TOO_SMALL terminates the current encryption operation.

The plaintext and ciphertext can be in the same place, i.e., it is OK if pPart and pEncryptedPart point to the same location.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_EncryptFinal.'''

CK_RV C_EncryptFinal CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pLastEncryptedPart,
CK_ULONG_PTR    pulLastEncryptedPartLen
;
 

C_EncryptFinal finishes a multiple-part encryption operation.

Parameters:
hSession is the session's handle;
pLastEncryptedPart points to the location that receives the last encrypted data part, if any;
pulLastEncryptedPartLen points to the location that holds the length of the last encrypted data part.
C_EncryptFinal uses the convention described in Section 11.2 on producing output.

The encryption operation must have been initialized with C_EncryptInit. A call to C_EncryptFinal always terminates the active encryption operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the ciphertext.

For some multi-part encryption mechanisms, the input plaintext data has certain length constraints, because the mechanism's input data must consist of an integral number of blocks. If these constraints are not satisfied, then C_EncryptFinal will fail with return code CKR_DATA_LEN_RANGE.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

#define PLAINTEXT_BUF_SZ 200
#define CIPHERTEXT_BUF_SZ 256
CK_ULONG firstPieceLen, secondPieceLen;
CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_BYTE iv[8];
CK_MECHANISM mechanism = {
CKM_DES_CBC_PAD, iv, sizeof(iv)
};
CK_BYTE data[PLAINTEXT_BUF_SZ];
CK_BYTE encryptedData[CIPHERTEXT_BUF_SZ];
CK_ULONG ulEncryptedData1Len;
CK_ULONG ulEncryptedData2Len;
CK_ULONG ulEncryptedData3Len;
CK_RV rv;
.
.
firstPieceLen = 90;
secondPieceLen = PLAINTEXT_BUF_SZ-firstPieceLen;
rv = C_EncryptInit(hSession, &mechanism, hKey);
if (rv == CKR_OK) {
/* Encrypt first piece */
ulEncryptedData1Len = sizeof(encryptedData);
rv = C_EncryptUpdate(
hSession,
&data[0], firstPieceLen,
&encryptedData[0], &ulEncryptedData1Len);
if (rv != CKR_OK) {
.
.
}
/* Encrypt second piece */
ulEncryptedData2Len = sizeof(encryptedData)-ulEncryptedData1Len;
rv = C_EncryptUpdate(
hSession,
&data[firstPieceLen], secondPieceLen,
&encryptedData[ulEncryptedData1Len], &ulEncryptedData2Len);
if (rv != CKR_OK) {
.
.
}
/* Get last little encrypted bit */
ulEncryptedData3Len =
sizeof(encryptedData)-ulEncryptedData1Len-ulEncryptedData2Len;
rv = C_EncryptFinal(
hSession,
&encryptedData[ulEncryptedData1Len+ulEncryptedData2Len],
&ulEncryptedData3Len);
if (rv != CKR_OK) {
.
.
}
}

CK_RV C_DecryptInit CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hKey
;
 

C_DecryptInit initializes a decryption operation.

Parameters:
hSession is the session's handle;
pMechanism points to the decryption mechanism;
hKey is the handle of the decryption key.
The CKA_DECRYPT attribute of the decryption key, which indicates whether the key supports decryption, must be CK_TRUE.

After calling C_DecryptInit, the application can either call C_Decrypt to decrypt data in a single part; or call C_DecryptUpdate zero or more times, followed by C_DecryptFinal, to decrypt data in multiple parts. The decryption operation is active until the application uses a call to C_Decrypt or C_DecryptFinal to actually obtain the final piece of plaintext. To process additional data (in single or multiple parts), the application must call C_DecryptInit again

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_DecryptFinal.

CK_RV C_Decrypt CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pEncryptedData,
CK_ULONG    ulEncryptedDataLen,
CK_BYTE_PTR    pData,
CK_ULONG_PTR    pulDataLen
;
 

C_Decrypt decrypts encrypted data in a single part.

Parameters:
hSession is the session's handle;
pEncryptedData points to the encrypted data;
ulEncryptedDataLen is the length of the encrypted data;
pData points to the location that receives the recovered data;
pulDataLen points to the location that holds the length of the recovered data.
C_Decrypt uses the convention described in Section 11.2 on producing output.

The decryption operation must have been initialized with C_DecryptInit. A call to C_Decrypt always terminates the active decryption operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the plaintext.

C_Decrypt can not be used to terminate a multi-part operation, and must be called after C_DecryptInit without intervening C_DecryptUpdate calls.

The ciphertext and plaintext can be in the same place, i.e., it is OK if pEncryptedData and pData point to the same location.

If the input ciphertext data cannot be decrypted because it has an inappropriate length, then either CKR_ENCRYPTED_DATA_INVALID or CKR_ENCRYPTED_DATA_LEN_RANGE may be returned.

For most mechanisms, C_Decrypt is equivalent to a sequence of C_DecryptUpdate operations followed by C_DecryptFinal.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_DecryptFinal for an example of similar functions.

CK_RV C_DecryptUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pEncryptedPart,
CK_ULONG    ulEncryptedPartLen,
CK_BYTE_PTR    pPart,
CK_ULONG_PTR    pulPartLen
;
 

C_DecryptUpdate continues a multiple-part decryption operation, processing another encrypted data part.

Parameters:
hSession is the session's handle;
pEncryptedPart points to the encrypted data part;
ulEncryptedPartLen is the length of the encrypted data part;
pPart points to the location that receives the recovered data part;
pulPartLen points to the location that holds the length of the recovered data part.
C_DecryptUpdate uses the convention described in Section 11.2 on producing output.

The decryption operation must have been initialized with C_DecryptInit. This function may be called any number of times in succession. A call to C_DecryptUpdate which results in an error other than CKR_BUFFER_TOO_SMALL terminates the current decryption operation.

The ciphertext and plaintext can be in the same place, i.e., it is OK if pEncryptedPart and pPart point to the same location.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_DecryptFinal.

CK_RV C_DecryptFinal CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pLastPart,
CK_ULONG_PTR    pulLastPartLen
;
 

C_DecryptFinal finishes a multiple-part decryption operation.

Parameters:
hSession is the session's handle;
pLastPart points to the location that receives the last recovered data part, if any;
pulLastPartLen points to the location that holds the length of the last recovered data part.
C_DecryptFinal uses the convention described in Section 11.2 on producing output.

The decryption operation must have been initialized with C_DecryptInit. A call to C_DecryptFinal always terminates the active decryption operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the plaintext.

If the input ciphertext data cannot be decrypted because it has an inappropriate length, then either CKR_ENCRYPTED_DATA_INVALID or CKR_ENCRYPTED_DATA_LEN_RANGE may be returned.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
Example:

#define CIPHERTEXT_BUF_SZ 256
#define PLAINTEXT_BUF_SZ 256
CK_ULONG firstEncryptedPieceLen, secondEncryptedPieceLen;
CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_BYTE iv[8];
CK_MECHANISM mechanism = {
CKM_DES_CBC_PAD, iv, sizeof(iv)
};
CK_BYTE data[PLAINTEXT_BUF_SZ];
CK_BYTE encryptedData[CIPHERTEXT_BUF_SZ];
CK_ULONG ulData1Len, ulData2Len, ulData3Len;
CK_RV rv;
.
.
firstEncryptedPieceLen = 90;
secondEncryptedPieceLen = CIPHERTEXT_BUF_SZ-firstEncryptedPieceLen;
rv = C_DecryptInit(hSession, &mechanism, hKey);
if (rv == CKR_OK) {
/* Decrypt first piece */
ulData1Len = sizeof(data);
rv = C_DecryptUpdate(
hSession,
&encryptedData[0], firstEncryptedPieceLen,
&data[0], &ulData1Len);
if (rv != CKR_OK) {
.
.
}
/* Decrypt second piece */
ulData2Len = sizeof(data)-ulData1Len;
rv = C_DecryptUpdate(
hSession,
&encryptedData[firstEncryptedPieceLen],
secondEncryptedPieceLen,
&data[ulData1Len], &ulData2Len);
if (rv != CKR_OK) {
.
.
}
/* Get last little decrypted bit */
ulData3Len = sizeof(data)-ulData1Len-ulData2Len;
rv = C_DecryptFinal(
hSession,
&data[ulData1Len+ulData2Len], &ulData3Len);
if (rv != CKR_OK) {
.
.
}
}

CK_RV C_DigestInit CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism
;
 

C_DigestInit initializes a message-digesting operation.

Parameters:
hSession is the session's handle;
pMechanism points to the digesting mechanism.
After calling C_DigestInit, the application can either call C_Digest to digest data in a single part; or call C_DigestUpdate zero or more times, followed by C_DigestFinal, to digest data in multiple parts. The message-digesting operation is active until the application uses a call to C_Digest or C_DigestFinal to actually obtain the message digest. To process additional data (in single or multiple parts), the application must call C_DigestInit again.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_DigestFinal.

CK_RV C_Digest CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pData,
CK_ULONG    ulDataLen,
CK_BYTE_PTR    pDigest,
CK_ULONG_PTR    pulDigestLen
;
 

C_Digest digests data in a single part.

Parameters:
hSession is the session's handle, pData points to the data;
ulDataLen is the length of the data;
pDigest points to the location that receives the message digest;
pulDigestLen points to the location that holds the length of the message digest.
C_Digest uses the convention described in Section 11.2 on producing output.

The digest operation must have been initialized with C_DigestInit. A call to C_Digest always terminates the active digest operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the message digest.

C_Digest can not be used to terminate a multi-part operation, and must be called after C_DigestInit without intervening C_DigestUpdate calls.

The input data and digest output can be in the same place, i.e., it is OK if pData and pDigest point to the same location.

C_Digest is equivalent to a sequence of C_DigestUpdate operations followed by C_DigestFinal.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_DigestFinal for an example of similar functions.

CK_RV C_DigestUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pPart,
CK_ULONG    ulPartLen
;
 

C_DigestUpdate continues a multiple-part message-digesting operation, processing another data part.

Parameters:
hSession is the session's handle, pPart points to the data part;
ulPartLen is the length of the data part.
The message-digesting operation must have been initialized with C_DigestInit. Calls to this function and C_DigestKey may be interspersed any number of times in any order. A call to C_DigestUpdate which results in an error terminates the current digest operation.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_DigestFinal.

CK_RV C_DigestKey CK_SESSION_HANDLE    hSession,
CK_OBJECT_HANDLE    hKey
;
 

C_DigestKey continues a multiple-part message-digesting operation by digesting the value of a secret key.

Parameters:
hSession is the session's handle;
hKey is the handle of the secret key to be digested.
The message-digesting operation must have been initialized with C_DigestInit. Calls to this function and C_DigestUpdate may be interspersed any number of times in any order.

If the value of the supplied key cannot be digested purely for some reason related to its length, C_DigestKey should return the error code CKR_KEY_SIZE_RANGE.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_HANDLE_INVALID, CKR_KEY_INDIGESTIBLE, CKR_KEY_SIZE_RANGE, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_DigestFinal.

CK_RV C_DigestFinal CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pDigest,
CK_ULONG_PTR    pulDigestLen
;
 

C_DigestFinal finishes a multiple-part message-digesting operation, returning the message digest.

Parameters:
hSession is the session's handle;
pDigest points to the location that receives the message digest;
pulDigestLen points to the location that holds the length of the message digest.
C_DigestFinal uses the convention described in Section 11.2 on producing output.

The digest operation must have been initialized with C_DigestInit. A call to C_DigestFinal always terminates the active digest operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the message digest.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

CK_SESSION_HANDLE hSession;
CK_MECHANISM mechanism = {
CKM_MD5, NULL_PTR, 0
};
CK_BYTE data[] = {...};
CK_BYTE digest[16];
CK_ULONG ulDigestLen;
CK_RV rv;
.
.
rv = C_DigestInit(hSession, &mechanism);
if (rv != CKR_OK) {
.
.
}
rv = C_DigestUpdate(hSession, data, sizeof(data));
if (rv != CKR_OK) {
.
.
}
rv = C_DigestKey(hSession, hKey);
if (rv != CKR_OK) {
.
.
}
ulDigestLen = sizeof(digest);
rv = C_DigestFinal(hSession, digest, &ulDigestLen);
.
.

CK_RV C_SignInit CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hKey
;
 

C_SignInit initializes a signature operation, where the signature is an appendix to the data.

Parameters:
hSession is the session's handle;
pMechanism points to the signature mechanism;
hKey is the handle of the signature key.
The CKA_SIGN attribute of the signature key, which indicates whether the key supports signatures with appendix, must be CK_TRUE.

After calling C_SignInit, the application can either call C_Sign to sign in a single part; or call C_SignUpdate one or more times, followed by C_SignFinal, to sign data in multiple parts. The signature operation is active until the application uses a call to C_Sign or C_SignFinal to actually obtain the signature. To process additional data (in single or multiple parts), the application must call C_SignInit again.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED,CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_SignFinal.

CK_RV C_Sign CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pData,
CK_ULONG    ulDataLen,
CK_BYTE_PTR    pSignature,
CK_ULONG_PTR    pulSignatureLen
;
 

C_Sign signs data in a single part, where the signature is an appendix to the data.

Parameters:
hSession is the session's handle;
pData points to the data;
ulDataLen is the length of the data;
pSignature points to the location that receives the signature;
pulSignatureLen points to the location that holds the length of the signature.
C_Sign uses the convention described in Section 11.2 on producing output.

The signing operation must have been initialized with C_SignInit. A call to C_Sign always terminates the active signing operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the signature.

C_Sign can not be used to terminate a multi-part operation, and must be called after C_SignInit without intervening C_SignUpdate calls.

For most mechanisms, C_Sign is equivalent to a sequence of C_SignUpdate operations followed by C_SignFinal.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN, CKR_FUNCTION_REJECTED.
See also:
C_SignFinal for an example of similar functions.

CK_RV C_SignUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pPart,
CK_ULONG    ulPartLen
;
 

C_SignUpdate continues a multiple-part signature operation, processing another data part.

Parameters:
hSession is the session's handle, pPart points to the data part;
ulPartLen is the length of the data part.
The signature operation must have been initialized with C_SignInit. This function may be called any number of times in succession. A call to C_SignUpdate which results in an error terminates the current signature operation.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_SignFinal.

CK_RV C_SignFinal CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pSignature,
CK_ULONG_PTR    pulSignatureLen
;
 

C_SignFinal finishes a multiple-part signature operation, returning the signature.

Parameters:
hSession is the session's handle;
pSignature points to the location that receives the signature;
pulSignatureLen points to the location that holds the length of the signature.
C_SignFinal uses the convention described in Section 11.2 on producing output.

The signing operation must have been initialized with C_SignInit. A call to C_SignFinal always terminates the active signing operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the signature.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN, CKR_FUNCTION_REJECTED.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_MECHANISM mechanism = {
CKM_DES_MAC, NULL_PTR, 0
};
CK_BYTE data[] = {...};
CK_BYTE mac[4];
CK_ULONG ulMacLen;
CK_RV rv;
.
.
rv = C_SignInit(hSession, &mechanism, hKey);
if (rv == CKR_OK) {
rv = C_SignUpdate(hSession, data, sizeof(data));
.
.
ulMacLen = sizeof(mac);
rv = C_SignFinal(hSession, mac, &ulMacLen);
.
.
}

CK_RV C_SignRecoverInit CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hKey
;
 

C_SignRecoverInit initializes a signature operation, where the data can be recovered from the signature.

Parameters:
hSession is the session's handle;
pMechanism points to the structure that specifies the signature mechanism;
hKey is the handle of the signature key.
The CKA_SIGN_RECOVER attribute of the signature key, which indicates whether the key supports signatures where the data can be recovered from the signature, must be CK_TRUE.

After calling C_SignRecoverInit, the application may call C_SignRecover to sign in a single part. The signature operation is active until the application uses a call to C_SignRecover to actually obtain the signature. To process additional data in a single part, the application must call C_SignRecoverInit again.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_SignRecover.

CK_RV C_SignRecover CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pData,
CK_ULONG    ulDataLen,
CK_BYTE_PTR    pSignature,
CK_ULONG_PTR    pulSignatureLen
;
 

C_SignRecover signs data in a single operation, where the data can be recovered from the signature.

Parameters:
hSession is the session's handle;
pData points to the data;
ulDataLen is the length of the data;
pSignature points to the location that receives the signature;
pulSignatureLen points to the location that holds the length of the signature.
C_SignRecover uses the convention described in Section 11.2 on producing output.

The signing operation must have been initialized with C_SignRecoverInit. A call to C_SignRecover always terminates the active signing operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the signature.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_MECHANISM mechanism = {
CKM_RSA_9796, NULL_PTR, 0
};
CK_BYTE data[] = {...};
CK_BYTE signature[128];
CK_ULONG ulSignatureLen;
CK_RV rv;
.
.
rv = C_SignRecoverInit(hSession, &mechanism, hKey);
if (rv == CKR_OK) {
ulSignatureLen = sizeof(signature);
rv = C_SignRecover(
hSession, data, sizeof(data), signature, &ulSignatureLen);
if (rv == CKR_OK) {
.
.
}
}

CK_RV C_VerifyInit CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hKey
;
 

C_VerifyInit initializes a verification operation, where the signature is an appendix to the data.

Parameters:
hSession is the session's handle;
pMechanism points to the structure that specifies the verification mechanism;
hKey is the handle of the verification key.
The CKA_VERIFY attribute of the verification key, which indicates whether the key supports verification where the signature is an appendix to the data, must be CK_TRUE.

After calling C_VerifyInit, the application can either call C_Verify to verify a signature on data in a single part; or call C_VerifyUpdate one or more times, followed by C_VerifyFinal, to verify a signature on data in multiple parts. The verification operation is active until the application calls C_Verify or C_VerifyFinal. To process additional data (in single or multiple parts), the application must call C_VerifyInit again.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_VerifyFinal.

CK_RV C_Verify CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pData,
CK_ULONG    ulDataLen,
CK_BYTE_PTR    pSignature,
CK_ULONG    ulSignatureLen
;
 

C_Verify verifies a signature in a single-part operation, where the signature is an appendix to the data.

Parameters:
hSession is the session's handle;
pData points to the data;
ulDataLen is the length of the data;
pSignature points to the signature;
ulSignatureLen is the length of the signature.
The verification operation must have been initialized with C_VerifyInit. A call to C_Verify always terminates the active verification operation.

A successful call to C_Verify should return either the value CKR_OK (indicating that the supplied signature is valid) or CKR_SIGNATURE_INVALID (indicating that the supplied signature is invalid). If the signature can be seen to be invalid purely on the basis of its length, then CKR_SIGNATURE_LEN_RANGE should be returned. In any of these cases, the active signing operation is terminated.

C_Verify can not be used to terminate a multi-part operation, and must be called after C_VerifyInit without intervening C_VerifyUpdate calls.

For most mechanisms, C_Verify is equivalent to a sequence of C_VerifyUpdate operations followed by C_VerifyFinal.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SIGNATURE_INVALID, CKR_SIGNATURE_LEN_RANGE.
See also:
C_VerifyFinal for an example of similar functions.

CK_RV C_VerifyUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pPart,
CK_ULONG    ulPartLen
;
 

C_VerifyUpdate continues a multiple-part verification operation, processing another data part.

Parameters:
hSession is the session's handle, pPart points to the data part;
ulPartLen is the length of the data part.
The verification operation must have been initialized with C_VerifyInit. This function may be called any number of times in succession. A call to C_VerifyUpdate which results in an error terminates the current verification operation.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
See also:
C_VerifyFinal.

CK_RV C_VerifyFinal CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pSignature,
CK_ULONG    ulSignatureLen
;
 

C_VerifyFinal finishes a multiple-part verification operation, checking the signature.

Parameters:
hSession is the session's handle;
pSignature points to the signature;
ulSignatureLen is the length of the signature.
The verification operation must have been initialized with C_VerifyInit. A call to C_VerifyFinal always terminates the active verification operation.

A successful call to C_VerifyFinal should return either the value CKR_OK (indicating that the supplied signature is valid) or CKR_SIGNATURE_INVALID (indicating that the supplied signature is invalid). If the signature can be seen to be invalid purely on the basis of its length, then CKR_SIGNATURE_LEN_RANGE should be returned. In any of these cases, the active verifying operation is terminated.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SIGNATURE_INVALID, CKR_SIGNATURE_LEN_RANGE.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_MECHANISM mechanism = {
CKM_DES_MAC, NULL_PTR, 0
};
CK_BYTE data[] = {...};
CK_BYTE mac[4];
CK_RV rv;
.
.
rv = C_VerifyInit(hSession, &mechanism, hKey);
if (rv == CKR_OK) {
rv = C_VerifyUpdate(hSession, data, sizeof(data));
.
.
rv = C_VerifyFinal(hSession, mac, sizeof(mac));
.
.
}

CK_RV C_VerifyRecoverInit CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hKey
;
 

C_VerifyRecoverInit initializes a signature verification operation, where the data is recovered from the signature.

Parameters:
hSession is the session's handle;
pMechanism points to the structure that specifies the verification mechanism;
hKey is the handle of the verification key.
The CKA_VERIFY_RECOVER attribute of the verification key, which indicates whether the key supports verification where the data is recovered from the signature, must be CK_TRUE.

After calling C_VerifyRecoverInit, the application may call C_VerifyRecover to verify a signature on data in a single part. The verification operation is active until the application uses a call to C_VerifyRecover to actually obtain the recovered message.

Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_FUNCTION_NOT_PERMITTED, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_VerifyRecover.

CK_RV C_VerifyRecover CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pSignature,
CK_ULONG    ulSignatureLen,
CK_BYTE_PTR    pData,
CK_ULONG_PTR    pulDataLen
;
 

C_VerifyRecover verifies a signature in a single-part operation, where the data is recovered from the signature.

Parameters:
hSession is the session's handle;
pSignature points to the signature;
ulSignatureLen is the length of the signature;
pData points to the location that receives the recovered data;
pulDataLen points to the location that holds the length of the recovered data.
C_VerifyRecover uses the convention described in Section 11.2 on producing output.

The verification operation must have been initialized with C_VerifyRecoverInit. A call to C_VerifyRecover always terminates the active verification operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the recovered data.

A successful call to C_VerifyRecover should return either the value CKR_OK (indicating that the supplied signature is valid) or CKR_SIGNATURE_INVALID (indicating that the supplied signature is invalid). If the signature can be seen to be invalid purely on the basis of its length, then CKR_SIGNATURE_LEN_RANGE should be returned. The return codes CKR_SIGNATURE_INVALID and CKR_SIGNATURE_LEN_RANGE have a higher priority than the return code CKR_BUFFER_TOO_SMALL, i.e., if C_VerifyRecover is supplied with an invalid signature, it will never return CKR_BUFFER_TOO_SMALL.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SIGNATURE_LEN_RANGE, CKR_SIGNATURE_INVALID.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_MECHANISM mechanism = {
CKM_RSA_9796, NULL_PTR, 0
};
CK_BYTE data[] = {...};
CK_ULONG ulDataLen;
CK_BYTE signature[128];
CK_RV rv;
.
.
rv = C_VerifyRecoverInit(hSession, &mechanism, hKey);
if (rv == CKR_OK) {
ulDataLen = sizeof(data);
rv = C_VerifyRecover(
hSession, signature, sizeof(signature), data, &ulDataLen);
.
.
}

CK_RV C_DigestEncryptUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pPart,
CK_ULONG    ulPartLen,
CK_BYTE_PTR    pEncryptedPart,
CK_ULONG_PTR    pulEncryptedPartLen
;
 

C_DigestEncryptUpdate continues multiple-part digest and encryption operations, processing another data part.

Parameters:
hSession is the session's handle;
pPart points to the data part;
ulPartLen is the length of the data part;
pEncryptedPart points to the location that receives the digested and encrypted data part;
pulEncryptedPartLen points to the location that holds the length of the encrypted data part.
C_DigestEncryptUpdate uses the convention described in Section 11.2 on producing output. If a C_DigestEncryptUpdate call does not produce encrypted output (because an error occurs, or because pEncryptedPart has the value NULL_PTR, or because pulEncryptedPartLen is too small to hold the entire encrypted part output), then no plaintext is passed to the active digest operation.

Digest and encryption operations must both be active (they must have been initialized with C_DigestInit and C_EncryptInit, respectively). This function may be called any number of times in succession, and may be interspersed with C_DigestUpdate, C_DigestKey, and C_EncryptUpdate calls (it would be somewhat unusual to intersperse calls to C_DigestEncryptUpdate with calls to C_DigestKey, however).

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

#define BUF_SZ 512
CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_BYTE iv[8];
CK_MECHANISM digestMechanism = {
CKM_MD5, NULL_PTR, 0
};
CK_MECHANISM encryptionMechanism = {
CKM_DES_ECB, iv, sizeof(iv)
};
CK_BYTE encryptedData[BUF_SZ];
CK_ULONG ulEncryptedDataLen;
CK_BYTE digest[16];
CK_ULONG ulDigestLen;
CK_BYTE data[(2*BUF_SZ)+8];
CK_RV rv;
int i;
.
.
memset(iv, 0, sizeof(iv));
memset(data, 'A', ((2*BUF_SZ)+5));
rv = C_EncryptInit(hSession, &encryptionMechanism, hKey);
if (rv != CKR_OK) {
.
.
}
rv = C_DigestInit(hSession, &digestMechanism);
if (rv != CKR_OK) {
.
.
}
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_DigestEncryptUpdate(
hSession,
&data[0], BUF_SZ,
encryptedData, &ulEncryptedDataLen);
.
.
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_DigestEncryptUpdate(
hSession,
&data[BUF_SZ], BUF_SZ,
encryptedData, &ulEncryptedDataLen);
.
.
/*
* The last portion of the buffer needs to be handled with 
* separate calls to deal with padding issues in ECB mode
*/
/* First, complete the digest on the buffer */
rv = C_DigestUpdate(hSession, &data[BUF_SZ*2], 5);
.
.
ulDigestLen = sizeof(digest);
rv = C_DigestFinal(hSession, digest, &ulDigestLen);
.
.
/* Then, pad last part with 3 0x00 bytes, and complete encryption */
for(i=0;i<3;i++)
data[((BUF_SZ*2)+5)+i] = 0x00;
/* Now, get second-to-last piece of ciphertext */
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_EncryptUpdate(
hSession,
&data[BUF_SZ*2], 8,
encryptedData, &ulEncryptedDataLen);
.
.
/* Get last piece of ciphertext (should have length 0, here) */
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_EncryptFinal(hSession, encryptedData, &ulEncryptedDataLen);
.
.

CK_RV C_DecryptDigestUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pEncryptedPart,
CK_ULONG    ulEncryptedPartLen,
CK_BYTE_PTR    pPart,
CK_ULONG_PTR    pulPartLen
;
 

C_DecryptDigestUpdate continues a multiple-part combined decryption and digest operation, processing another data part.

Parameters:
hSession is the session's handle;
pEncryptedPart points to the encrypted data part;
ulEncryptedPartLen is the length of the encrypted data part;
pPart points to the location that receives the recovered data part;
pulPartLen points to the location that holds the length of the recovered data part.
C_DecryptDigestUpdate uses the convention described in Section 11.2 on producing output. If a C_DecryptDigestUpdate call does not produce decrypted output (because an error occurs, or because pPart has the value NULL_PTR, or because pulPartLen is too small to hold the entire decrypted part output), then no plaintext is passed to the active digest operation.

Decryption and digesting operations must both be active (they must have been initialized with C_DecryptInit and C_DigestInit, respectively). This function may be called any number of times in succession, and may be interspersed with C_DecryptUpdate, C_DigestUpdate, and C_DigestKey calls (it would be somewhat unusual to intersperse calls to C_DigestEncryptUpdate with calls to C_DigestKey, however).

Use of C_DecryptDigestUpdate involves a pipelining issue that does not arise when using C_DigestEncryptUpdate, the "inverse function" of C_DecryptDigestUpdate. This is because when C_DigestEncryptUpdate is called, precisely the same input is passed to both the active digesting operation and the active encryption operation; however, when C_DecryptDigestUpdate is called, the input passed to the active digesting operation is the output of the active decryption operation. This issue comes up only when the mechanism used for decryption performs padding.

In particular, envision a 24-byte ciphertext which was obtained by encrypting an 18-byte plaintext with DES in CBC mode with PKCS padding. Consider an application which will simultaneously decrypt this ciphertext and digest the original plaintext thereby obtained.

After initializing decryption and digesting operations, the application passes the 24-byte ciphertext (3 DES blocks) into C_DecryptDigestUpdate. C_DecryptDigestUpdate returns exactly 16 bytes of plaintext, since at this point, Cryptoki doesn't know if there's more ciphertext coming, or if the last block of ciphertext held any padding. These 16 bytes of plaintext are passed into the active digesting operation.

Since there is no more ciphertext, the application calls C_DecryptFinal. This tells Cryptoki that there's no more ciphertext coming, and the call returns the last 2 bytes of plaintext. However, since the active decryption and digesting operations are linked only through the C_DecryptDigestUpdate call, these 2 bytes of plaintext are not passed on to be digested.

A call to C_DigestFinal, therefore, would compute the message digest of the first 16 bytes of the plaintext, not the message digest of the entire plaintext. It is crucial that, before C_DigestFinal is called, the last 2 bytes of plaintext get passed into the active digesting operation via a C_DigestUpdate call.

Because of this, it is critical that when an application uses a padded decryption mechanism with C_DecryptDigestUpdate, it knows exactly how much plaintext has been passed into the active digesting operation. Extreme caution is warranted when using a padded decryption mechanism with C_DecryptDigestUpdate.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

#define BUF_SZ 512
CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_BYTE iv[8];
CK_MECHANISM decryptionMechanism = {
CKM_DES_ECB, iv, sizeof(iv)
};
CK_MECHANISM digestMechanism = {
CKM_MD5, NULL_PTR, 0
};
CK_BYTE encryptedData[(2*BUF_SZ)+8];
CK_BYTE digest[16];
CK_ULONG ulDigestLen;
CK_BYTE data[BUF_SZ];
CK_ULONG ulDataLen, ulLastUpdateSize;
CK_RV rv;
.
.
memset(iv, 0, sizeof(iv));
memset(encryptedData, 'A', ((2*BUF_SZ)+8));
rv = C_DecryptInit(hSession, &decryptionMechanism, hKey);
if (rv != CKR_OK) {
.
.
}
rv = C_DigestInit(hSession, &digestMechanism);
if (rv != CKR_OK){
.
.
}
ulDataLen = sizeof(data);
rv = C_DecryptDigestUpdate(
hSession,
&encryptedData[0], BUF_SZ,
data, &ulDataLen);
.
.
ulDataLen = sizeof(data);
rv = C_DecryptDigestUpdate(
hSession,
&encryptedData[BUF_SZ], BUF_SZ,
data, &ulDataLen);
.
.
/*
* The last portion of the buffer needs to be handled with 
* separate calls to deal with padding issues in ECB mode
*/
/* First, complete the decryption of the buffer */
ulLastUpdateSize = sizeof(data);
rv = C_DecryptUpdate(
hSession,
&encryptedData[BUF_SZ*2], 8,
data, &ulLastUpdateSize);
.
.
/* Get last piece of plaintext (should have length 0, here) */
ulDataLen = sizeof(data)-ulLastUpdateSize;
rv = C_DecryptFinal(hSession, &data[ulLastUpdateSize], &ulDataLen);
if (rv != CKR_OK) {
.
.
}
/* Digest last bit of plaintext */
rv = C_DigestUpdate(hSession, &data[BUF_SZ*2], 5);
if (rv != CKR_OK) {
.
.
}
ulDigestLen = sizeof(digest);
rv = C_DigestFinal(hSession, digest, &ulDigestLen);
if (rv != CKR_OK) {
.
.
}

CK_RV C_SignEncryptUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pPart,
CK_ULONG    ulPartLen,
CK_BYTE_PTR    pEncryptedPart,
CK_ULONG_PTR    pulEncryptedPartLen
;
 

C_SignEncryptUpdate continues a multiple-part combined signature and encryption operation, processing another data part.

Parameters:
hSession is the session's handle;
pPart points to the data part;
ulPartLen is the length of the data part;
pEncryptedPart points to the location that receives the digested and encrypted data part;
pulEncryptedPartLen points to the location that holds the length of the encrypted data part.
C_SignEncryptUpdate uses the convention described in Section 11.2 on producing output. If a C_SignEncryptUpdate call does not produce encrypted output (because an error occurs, or because pEncryptedPart has the value NULL_PTR, or because pulEncryptedPartLen is too small to hold the entire encrypted part output), then no plaintext is passed to the active signing operation.

Signature and encryption operations must both be active (they must have been initialized with C_SignInit and C_EncryptInit, respectively). This function may be called any number of times in succession, and may be interspersed with C_SignUpdate and C_EncryptUpdate calls.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
Example:

#define BUF_SZ 512
CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hEncryptionKey, hMacKey;
CK_BYTE iv[8];
CK_MECHANISM signMechanism = {
CKM_DES_MAC, NULL_PTR, 0
};
CK_MECHANISM encryptionMechanism = {
CKM_DES_ECB, iv, sizeof(iv)
};
CK_BYTE encryptedData[BUF_SZ];
CK_ULONG ulEncryptedDataLen;
CK_BYTE MAC[4];
CK_ULONG ulMacLen;
CK_BYTE data[(2*BUF_SZ)+8];
CK_RV rv;
int i;
.
.
memset(iv, 0, sizeof(iv));
memset(data, 'A', ((2*BUF_SZ)+5));
rv = C_EncryptInit(hSession, &encryptionMechanism, hEncryptionKey);
if (rv != CKR_OK) {
.
.
}
rv = C_SignInit(hSession, &signMechanism, hMacKey);
if (rv != CKR_OK) {
.
.
}
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_SignEncryptUpdate(
hSession,
&data[0], BUF_SZ,
encryptedData, &ulEncryptedDataLen);
.
.
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_SignEncryptUpdate(
hSession,
&data[BUF_SZ], BUF_SZ,
encryptedData, &ulEncryptedDataLen);
.
.
/*
* The last portion of the buffer needs to be handled with 
* separate calls to deal with padding issues in ECB mode
*/
/* First, complete the signature on the buffer */
rv = C_SignUpdate(hSession, &data[BUF_SZ*2], 5);
.
.
ulMacLen = sizeof(MAC);
rv = C_SignFinal(hSession, MAC, &ulMacLen);
.
.
/* Then pad last part with 3 0x00 bytes, and complete encryption */
for(i=0;i<3;i++)
data[((BUF_SZ*2)+5)+i] = 0x00;
/* Now, get second-to-last piece of ciphertext */
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_EncryptUpdate(
hSession,
&data[BUF_SZ*2], 8,
encryptedData, &ulEncryptedDataLen);
.
.
/* Get last piece of ciphertext (should have length 0, here) */
ulEncryptedDataLen = sizeof(encryptedData);
rv = C_EncryptFinal(hSession, encryptedData, &ulEncryptedDataLen);
.
.

CK_RV C_DecryptVerifyUpdate CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pEncryptedPart,
CK_ULONG    ulEncryptedPartLen,
CK_BYTE_PTR    pPart,
CK_ULONG_PTR    pulPartLen
;
 

C_DecryptVerifyUpdate continues a multiple-part combined decryption and verification operation, processing another data part.

Parameters:
hSession is the session's handle;
pEncryptedPart points to the encrypted data;
ulEncryptedPartLen is the length of the encrypted data;
pPart points to the location that receives the recovered data;
pulPartLen points to the location that holds the length of the recovered data.
C_DecryptVerifyUpdate uses the convention described in Section 11.2 on producing output. If a C_DecryptVerifyUpdate call does not produce decrypted output (because an error occurs, or because pPart has the value NULL_PTR, or because pulPartLen is too small to hold the entire encrypted part output), then no plaintext is passed to the active verification operation.

Decryption and signature operations must both be active (they must have been initialized with C_DecryptInit and C_VerifyInit, respectively). This function may be called any number of times in succession, and may be interspersed with C_DecryptUpdate and C_VerifyUpdate calls.

Use of C_DecryptVerifyUpdate involves a pipelining issue that does not arise when using C_SignEncryptUpdate, the "inverse function" of C_DecryptVerifyUpdate. This is because when C_SignEncryptUpdate is called, precisely the same input is passed to both the active signing operation and the active encryption operation; however, when C_DecryptVerifyUpdate is called, the input passed to the active verifying operation is the output of the active decryption operation. This issue comes up only when the mechanism used for decryption performs padding.

In particular, envision a 24-byte ciphertext which was obtained by encrypting an 18-byte plaintext with DES in CBC mode with PKCS padding. Consider an application which will simultaneously decrypt this ciphertext and verify a signature on the original plaintext thereby obtained.

After initializing decryption and verification operations, the application passes the 24-byte ciphertext (3 DES blocks) into C_DecryptVerifyUpdate. C_DecryptVerifyUpdate returns exactly 16 bytes of plaintext, since at this point, Cryptoki doesn't know if there's more ciphertext coming, or if the last block of ciphertext held any padding. These 16 bytes of plaintext are passed into the active verification operation.

Since there is no more ciphertext, the application calls C_DecryptFinal. This tells Cryptoki that there's no more ciphertext coming, and the call returns the last 2 bytes of plaintext. However, since the active decryption and verification operations are linked only through the C_DecryptVerifyUpdate call, these 2 bytes of plaintext are not passed on to the verification mechanism.

A call to C_VerifyFinal, therefore, would verify whether or not the signature supplied is a valid signature on the first 16 bytes of the plaintext, not on the entire plaintext. It is crucial that, before C_VerifyFinal is called, the last 2 bytes of plaintext get passed into the active verification operation via a C_VerifyUpdate call.

Because of this, it is critical that when an application uses a padded decryption mechanism with C_DecryptVerifyUpdate, it knows exactly how much plaintext has been passed into the active verification operation. Extreme caution is warranted when using a padded decryption mechanism with C_DecryptVerifyUpdate.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_ENCRYPTED_DATA_INVALID, CKR_ENCRYPTED_DATA_LEN_RANGE, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:

#define BUF_SZ 512
CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hDecryptionKey, hMacKey;
CK_BYTE iv[8];
CK_MECHANISM decryptionMechanism = {
CKM_DES_ECB, iv, sizeof(iv)
};
CK_MECHANISM verifyMechanism = {
CKM_DES_MAC, NULL_PTR, 0
};
CK_BYTE encryptedData[(2*BUF_SZ)+8];
CK_BYTE MAC[4];
CK_ULONG ulMacLen;
CK_BYTE data[BUF_SZ];
CK_ULONG ulDataLen, ulLastUpdateSize;
CK_RV rv;
.
.
memset(iv, 0, sizeof(iv));
memset(encryptedData, 'A', ((2*BUF_SZ)+8));
rv = C_DecryptInit(hSession, &decryptionMechanism, hDecryptionKey);
if (rv != CKR_OK) {
.
.
}
rv = C_VerifyInit(hSession, &verifyMechanism, hMacKey);
if (rv != CKR_OK){
.
.
}
ulDataLen = sizeof(data);
rv = C_DecryptVerifyUpdate(
hSession,
&encryptedData[0], BUF_SZ,
data, &ulDataLen);
.
.
ulDataLen = sizeof(data);
rv = C_DecryptVerifyUpdate(
hSession,
&encryptedData[BUF_SZ], BUF_SZ,
data, &uldataLen);
.
.
/*
* The last portion of the buffer needs to be handled with 
* separate calls to deal with padding issues in ECB mode
*/
/* First, complete the decryption of the buffer */
ulLastUpdateSize = sizeof(data);
rv = C_DecryptUpdate(
hSession,
&encryptedData[BUF_SZ*2], 8,
data, &ulLastUpdateSize);
.
.
/* Get last little piece of plaintext. Should have length 0 */
ulDataLen = sizeof(data)-ulLastUpdateSize;
rv = C_DecryptFinal(hSession, &data[ulLastUpdateSize], &ulDataLen);
if (rv != CKR_OK) {
.
.
}
/* Send last bit of plaintext to verification operation */
rv = C_VerifyUpdate(hSession, &data[BUF_SZ*2], 5);
if (rv != CKR_OK) {
.
.
}
rv = C_VerifyFinal(hSession, MAC, ulMacLen);
if (rv == CKR_SIGNATURE_INVALID) {
.
.
}

CK_RV C_GenerateKey CK_SESSION_HANDLE hSession CK_MECHANISM_PTR    pMechanism,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulCount,
CK_OBJECT_HANDLE_PTR    phKey
;
 

C_GenerateKey generates a secret key or set of domain parameters, creating a new object.

Parameters:
hSession is the session's handle;
pMechanism points to the generation mechanism;
pTemplate points to the template for the new key or set of domain parameters;
ulCount is the number of attributes in the template;
phKey points to the location that receives the handle of the new key or set of domain parameters.
If the generation mechanism is for domain parameter generation, the CKA_CLASS attribute will have the value CKO_DOMAIN_PARAMETERS; otherwise, it will have the value CKO_SECRET_KEY.

Since the type of key or domain parameters to be generated is implicit in the generation mechanism, the template does not need to supply a key type. If it does supply a key type which is inconsistent with the generation mechanism, C_GenerateKey fails and returns the error code CKR_TEMPLATE_INCONSISTENT. The CKA_CLASS attribute is treated similarly.

If a call to C_GenerateKey cannot support the precise template supplied to it, it will fail and return without creating an object.

The object created by a successful call to C_GenerateKey will have its CKA_LOCAL attribute set to CK_TRUE.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_MECHANISM mechanism = {
CKM_DES_KEY_GEN, NULL_PTR, 0
};
CK_RV rv;
.
.
rv = C_GenerateKey(hSession, &mechanism, NULL_PTR, 0, &hKey);
if (rv == CKR_OK) {
.
.
}

CK_RV C_GenerateKeyPair CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_ATTRIBUTE_PTR    pPublicKeyTemplate,
CK_ULONG    ulPublicKeyAttributeCount,
CK_ATTRIBUTE_PTR    pPrivateKeyTemplate,
CK_ULONG    ulPrivateKeyAttributeCount,
CK_OBJECT_HANDLE_PTR    phPublicKey,
CK_OBJECT_HANDLE_PTR    phPrivateKey
;
 

C_GenerateKeyPair generates a public/private key pair, creating new key objects.

Parameters:
hSession is the session's handle;
pMechanism points to the key generation mechanism;
pPublicKeyTemplate points to the template for the public key;
ulPublicKeyAttributeCount is the number of attributes in the public-key template;
pPrivateKeyTemplate points to the template for the private key;
ulPrivateKeyAttributeCount is the number of attributes in the private-key template;
phPublicKey points to the location that receives the handle of the new public key;
phPrivateKey points to the location that receives the handle of the new private key.
Since the types of keys to be generated are implicit in the key pair generation mechanism, the templates do not need to supply key types. If one of the templates does supply a key type which is inconsistent with the key generation mechanism, C_GenerateKeyPair fails and returns the error code CKR_TEMPLATE_INCONSISTENT. The CKA_CLASS attribute is treated similarly.

If a call to C_GenerateKeyPair cannot support the precise templates supplied to it, it will fail and return without creating any key objects.

A call to C_GenerateKeyPair will never create just one key and return. A call can fail, and create no keys; or it can succeed, and create a matching public/private key pair.

The key objects created by a successful call to C_GenerateKeyPair will have their CKA_LOCAL attributes set to CK_TRUE.

Note carefully the order of the arguments to C_GenerateKeyPair. The last two arguments do not have the same order as they did in the original Cryptoki Version 1.0 document. The order of these two arguments has caused some unfortunate confusion.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hPublicKey, hPrivateKey;
CK_MECHANISM mechanism = {
CKM_RSA_PKCS_KEY_PAIR_GEN, NULL_PTR, 0
};
CK_ULONG modulusBits = 768;
CK_BYTE publicExponent[] = { 3 };
CK_BYTE subject[] = {...};
CK_BYTE id[] = {123};
CK_BBOOL true = CK_TRUE;
CK_ATTRIBUTE publicKeyTemplate[] = {
{CKA_ENCRYPT, &true, sizeof(true)},
{CKA_VERIFY, &true, sizeof(true)},
{CKA_WRAP, &true, sizeof(true)},
{CKA_MODULUS_BITS, &modulusBits, sizeof(modulusBits)},
{CKA_PUBLIC_EXPONENT, publicExponent, sizeof (publicExponent)}
};
CK_ATTRIBUTE privateKeyTemplate[] = {
{CKA_TOKEN, &true, sizeof(true)},
{CKA_PRIVATE, &true, sizeof(true)},
{CKA_SUBJECT, subject, sizeof(subject)},
{CKA_ID, id, sizeof(id)},
{CKA_SENSITIVE, &true, sizeof(true)},
{CKA_DECRYPT, &true, sizeof(true)},
{CKA_SIGN, &true, sizeof(true)},
{CKA_UNWRAP, &true, sizeof(true)}
};
CK_RV rv;
rv = C_GenerateKeyPair(
hSession, &mechanism,
publicKeyTemplate, 5,
privateKeyTemplate, 8,
&hPublicKey, &hPrivateKey);
if (rv == CKR_OK) {
.
.
}

CK_RV C_WrapKey CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hWrappingKey,
CK_OBJECT_HANDLE    hKey,
CK_BYTE_PTR    pWrappedKey,
CK_ULONG_PTR    pulWrappedKeyLen
;
 

C_WrapKey wraps (i.e., encrypts) a private or secret key.

Parameters:
hSession is the session's handle;
pMechanism points to the wrapping mechanism;
hWrappingKey is the handle of the wrapping key; hKey is the handle of the key to be wrapped;
pWrappedKey points to the location that receives the wrapped key; and pulWrappedKeyLen points to the location that receives the length of the wrapped key.
C_WrapKey uses the convention described in Section 11.2 on producing output.

The CKA_WRAP attribute of the wrapping key, which indicates whether the key supports wrapping, must be CK_TRUE. The CKA_EXTRACTABLE attribute of the key to be wrapped must also be CK_TRUE.

If the key to be wrapped cannot be wrapped for some token-specific reason, despite its having its CKA_EXTRACTABLE attribute set to CK_TRUE, then C_WrapKey fails with error code CKR_KEY_NOT_WRAPPABLE. If it cannot be wrapped with the specified wrapping key and mechanism solely because of its length, then C_WrapKey fails with error code CKR_KEY_SIZE_RANGE.

C_WrapKey can be used in the following situations:

  • To wrap any secret key with a public key that supports encryption and decryption.
  • To wrap any secret key with any other secret key. Consideration must be given to key size and mechanism strength or the token may not allow the operation.
  • To wrap a private key with any secret key. Of course, tokens vary in which types of keys can actually be wrapped with which mechanisms.
To partition the wrapping keys so they can only wrap a subset of extractable keys the attribute CKA_WRAP_TEMPLATE can be used on the wrapping key to specify an attribute set that will be compared against the attributes of the key to be wrapped. If all attributes match according to the C_FindObject rules of attribute matching then the wrap will proceed. The value of this attribute is an attribute template and the size is the number of items in the template times the size of CK_ATTRIBUTE. If this attribute is not supplied then any template is acceptable. Attributes not present are not checked. If any attribute mismatch occurs on an attempt to wrap a key then the function shall return CKR_KEY_HANDLE_INVALID.

Returns:
CKR_ARGUMENTS_BAD, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_HANDLE_INVALID, CKR_KEY_NOT_WRAPPABLE, CKR_KEY_SIZE_RANGE, CKR_KEY_UNEXTRACTABLE, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN, CKR_WRAPPING_KEY_HANDLE_INVALID, CKR_WRAPPING_KEY_SIZE_RANGE, CKR_WRAPPING_KEY_TYPE_INCONSISTENT.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hWrappingKey, hKey;
CK_MECHANISM mechanism = {
CKM_DES3_ECB, NULL_PTR, 0
};
CK_BYTE wrappedKey[8];
CK_ULONG ulWrappedKeyLen;
CK_RV rv;
.
.
ulWrappedKeyLen = sizeof(wrappedKey);
rv = C_WrapKey(
hSession, &mechanism,
hWrappingKey, hKey,
wrappedKey, &ulWrappedKeyLen);
if (rv == CKR_OK) {
.
.
}

CK_RV C_UnwrapKey CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hUnwrappingKey,
CK_BYTE_PTR    pWrappedKey,
CK_ULONG    ulWrappedKeyLen,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulAttributeCount,
CK_OBJECT_HANDLE_PTR    phKey
;
 

C_UnwrapKey unwraps (i.e. decrypts) a wrapped key, creating a new private key or secret key object.

Parameters:
hSession is the session's handle;
pMechanism points to the unwrapping mechanism;
hUnwrappingKey is the handle of the unwrapping key; pWrappedKey points to the wrapped key;
ulWrappedKeyLen is the length of the wrapped key;
pTemplate points to the template for the new key;
ulAttributeCount is the number of attributes in the template;
phKey points to the location that receives the handle of the recovered key.
The CKA_UNWRAP attribute of the unwrapping key, which indicates whether the key supports unwrapping, must be CK_TRUE.

The new key will have the CKA_ALWAYS_SENSITIVE attribute set to CK_FALSE, and the CKA_NEVER_EXTRACTABLE attribute set to CK_FALSE. The CKA_EXTRACTABLE attribute is by default set to CK_TRUE.

Some mechanisms may modify, or attempt to modify. the contents of the pMechanism structure at the same time that the key is unwrapped.

If a call to C_UnwrapKey cannot support the precise template supplied to it, it will fail and return without creating any key object.

The key object created by a successful call to C_UnwrapKey will have its CKA_LOCAL attribute set to CK_FALSE.

To partition the unwrapping keys so they can only unwrap a subset of keys the attribute CKA_UNWRAP_TEMPLATE can be used on the unwrapping key to specify an attribute set that will be added to attributes of the key to be unwrapped. If the attributes do not conflict with the user supplied attribute template, in 'pTemplate', then the unwrap will proceed. The value of this attribute is an attribute template and the size is the number of items in the template times the size of CK_ATTRIBUTE. If this attribute is not present on the unwrapping key then no additional attributes will be added. If any attribute conflict occurs on an attempt to unwrap a key then the function shall return CKR_TEMPLATE_INCONSISTENT.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_UNWRAPPING_KEY_HANDLE_INVALID, CKR_UNWRAPPING_KEY_SIZE_RANGE, CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT, CKR_USER_NOT_LOGGED_IN, CKR_WRAPPED_KEY_INVALID, CKR_WRAPPED_KEY_LEN_RANGE.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hUnwrappingKey, hKey;
CK_MECHANISM mechanism = {
CKM_DES3_ECB, NULL_PTR, 0
};
CK_BYTE wrappedKey[8] = {...};
CK_OBJECT_CLASS keyClass = CKO_SECRET_KEY;
CK_KEY_TYPE keyType = CKK_DES;
CK_BBOOL true = CK_TRUE;
CK_ATTRIBUTE template[] = {
{CKA_CLASS, &keyClass, sizeof(keyClass)},
{CKA_KEY_TYPE, &keyType, sizeof(keyType)},
{CKA_ENCRYPT, &true, sizeof(true)},
{CKA_DECRYPT, &true, sizeof(true)}
};
CK_RV rv;
.
.
rv = C_UnwrapKey(
hSession, &mechanism, hUnwrappingKey,
wrappedKey, sizeof(wrappedKey), template, 4, &hKey);
if (rv == CKR_OK) {
.
.
}

CK_RV C_DeriveKey CK_SESSION_HANDLE    hSession,
CK_MECHANISM_PTR    pMechanism,
CK_OBJECT_HANDLE    hBaseKey,
CK_ATTRIBUTE_PTR    pTemplate,
CK_ULONG    ulAttributeCount,
CK_OBJECT_HANDLE_PTR    phKey
;
 

C_DeriveKey derives a key from a base key, creating a new key object.

Parameters:
hSession is the session's handle;
pMechanism points to a structure that specifies the key derivation mechanism;
hBaseKey is the handle of the base key;
pTemplate points to the template for the new key;
ulAttributeCount is the number of attributes in the template;
phKey points to the location that receives the handle of the derived key.
The values of the CK_SENSITIVE, CK_ALWAYS_SENSITIVE, CK_EXTRACTABLE, and CK_NEVER_EXTRACTABLE attributes for the base key affect the values that these attributes can hold for the newly-derived key. See the description of each particular key-derivation mechanism in Section 11.17.2 for any constraints of this type.

If a call to C_DeriveKey cannot support the precise template supplied to it, it will fail and return without creating any key object.

The key object created by a successful call to C_DeriveKey will have its CKA_LOCAL attribute set to CK_FALSE.

Returns:
CKR_ARGUMENTS_BAD, CKR_ATTRIBUTE_READ_ONLY, CKR_ATTRIBUTE_TYPE_INVALID, CKR_ATTRIBUTE_VALUE_INVALID, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_DOMAIN_PARAMS_INVALID, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_KEY_HANDLE_INVALID, CKR_KEY_SIZE_RANGE, CKR_KEY_TYPE_INCONSISTENT, CKR_MECHANISM_INVALID, CKR_MECHANISM_PARAM_INVALID, CKR_OK, CKR_OPERATION_ACTIVE, CKR_PIN_EXPIRED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_READ_ONLY, CKR_TEMPLATE_INCOMPLETE, CKR_TEMPLATE_INCONSISTENT, CKR_TOKEN_WRITE_PROTECTED, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hPublicKey, hPrivateKey, hKey;
CK_MECHANISM keyPairMechanism = {
CKM_DH_PKCS_KEY_PAIR_GEN, NULL_PTR, 0
};
CK_BYTE prime[] = {...};
CK_BYTE base[] = {...};
CK_BYTE publicValue[128];
CK_BYTE otherPublicValue[128];
CK_MECHANISM mechanism = {
CKM_DH_PKCS_DERIVE, otherPublicValue, sizeof(otherPublicValue)
};
CK_ATTRIBUTE pTemplate[] = {
CKA_VALUE, &publicValue, sizeof(publicValue)}
};
CK_OBJECT_CLASS keyClass = CKO_SECRET_KEY;
CK_KEY_TYPE keyType = CKK_DES;
CK_BBOOL true = CK_TRUE;
CK_ATTRIBUTE publicKeyTemplate[] = {
{CKA_PRIME, prime, sizeof(prime)},
{CKA_BASE, base, sizeof(base)}
};
CK_ATTRIBUTE privateKeyTemplate[] = {
{CKA_DERIVE, &true, sizeof(true)}
};
CK_ATTRIBUTE template[] = {
{CKA_CLASS, &keyClass, sizeof(keyClass)},
{CKA_KEY_TYPE, &keyType, sizeof(keyType)},
{CKA_ENCRYPT, &true, sizeof(true)},
{CKA_DECRYPT, &true, sizeof(true)}
};
CK_RV rv;
.
.
rv = C_GenerateKeyPair(
hSession, &keyPairMechanism,
publicKeyTemplate, 2,
privateKeyTemplate, 1,
&hPublicKey, &hPrivateKey);
if (rv == CKR_OK) {
rv = C_GetAttributeValue(hSession, hPublicKey, &pTemplate, 1);
if (rv == CKR_OK) {
/* Put other guy's public value in otherPublicValue */
.
.
rv = C_DeriveKey(
hSession, &mechanism,
hPrivateKey, template, 4, &hKey);
if (rv == CKR_OK) {
.
.
}
}
}

CK_RV C_SeedRandom CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pSeed,
CK_ULONG    ulSeedLen
;
 

C_SeedRandom mixes additional seed material into the token's random number generator.

Parameters:
hSession is the session's handle;
pSeed points to the seed material; and ulSeedLen is the length in bytes of the seed material.
Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_ACTIVE, CKR_RANDOM_SEED_NOT_SUPPORTED, CKR_RANDOM_NO_RNG, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
See also:
C_GenerateRandom.

CK_RV C_GenerateRandom CK_SESSION_HANDLE    hSession,
CK_BYTE_PTR    pRandomData,
CK_ULONG    ulRandomLen
;
 

C_GenerateRandom generates random or pseudo-random data.

Parameters:
hSession is the session's handle;
pRandomData points to the location that receives the random data; and ulRandomLen is the length in bytes of the random or pseudo-random data to be generated.
Returns:
CKR_ARGUMENTS_BAD, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_ACTIVE, CKR_RANDOM_NO_RNG, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
Example:

CK_SESSION_HANDLE hSession;
CK_BYTE seed[] = {...};
CK_BYTE randomData[] = {...};
CK_RV rv;
.
.
rv = C_SeedRandom(hSession, seed, sizeof(seed));
if (rv != CKR_OK) {
.
.
}
rv = C_GenerateRandom(hSession, randomData, sizeof(randomData));
if (rv == CKR_OK) {
.
.
}

CK_RV C_GetFunctionStatus CK_SESSION_HANDLE    hSession ;
 

In previous versions of Cryptoki, C_GetFunctionStatus obtained the status of a function running in parallel with an application. Now, however, C_GetFunctionStatus is a legacy function which should simply return the value CKR_FUNCTION_NOT_PARALLEL.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_FUNCTION_NOT_PARALLEL, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_CLOSED.

CK_RV C_CancelFunction CK_SESSION_HANDLE    hSession ;
 

In previous versions of Cryptoki, C_CancelFunction cancelled a function running in parallel with an application. Now, however, C_CancelFunction is a legacy function which should simply return the value CKR_FUNCTION_NOT_PARALLEL.

Returns:
CKR_CRYPTOKI_NOT_INITIALIZED, CKR_FUNCTION_FAILED, CKR_FUNCTION_NOT_PARALLEL, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_SESSION_HANDLE_INVALID, CKR_SESSION_CLOSED.


RSA Security Inc. Public-Key Cryptography Standards - PKCS#11 - v230