发布时间:2010-2-11 12:12
分类名称:PKI
Symbols and Abbreviations
Symbols
Symbol | Definition |
N/A | Not applicable |
R/O | Read-on |
R/W | Read/write |
Prefixes
Prefix | Description |
C_ | Function |
CK_ | Da |
CKA_ | Attribute |
CKC_ | Certificate type |
CKD_ | Key derivation function |
CKF_ | Bit flag |
CKG_ | Mask generation function |
CKH_ | Hardware feature type |
CKK_ | Key type |
CKM_ | Mechanism type |
CKN_ | Notification |
CKO_ | Object class |
CKP_ | Pseudo-random function |
CKS_ | Session state |
CKR_ | Return value |
CKU_ | User type |
CKZ_ | Salt/Encoding parameter source |
h | a handle |
ul | a CK_ULONG |
p | a pointer |
pb | a pointer to a CK_BYTE |
ph | a pointer to a handle |
pul | a pointer to a CK_ULONG |
Da
/* an unsigned 8-bit value */
typedef unsigned char CK_BYTE;
/* an unsigned 8-bit character */
typedef CK_BYTE CK_CHAR;
/* an 8-bit UTF-8 character */
typedef CK_BYTE CK_UTF8CHAR;
/* a BYTE-sized Boolean flag */
typedef CK_BYTE CK_BBOOL;
/* an unsigned value, at least 32 bits long */
typedef unsigned long int CK_ULONG;
/* a signed value, the same size as a CK_ULONG */
typedef long int CK_LONG;
/* at least 32 bits; each bit is a Boolean flag */
typedef CK_ULONG CK_FLAGS;
CK_BYTE_PTR /* Pointer to a CK_BYTE */
CK_CHAR_PTR /* Pointer to a CK_CHAR */
CK_UTF8CHAR_PTR /* Pointer to a CK_UTF8CHAR */
CK_ULONG_PTR /* Pointer to a CK_ULONG */
CK_VOID_PTR /* Pointer to a void */
CK_VOID_PTR_PTR /* Pointer to a CK_VOID_PTR */
NULL_PTR /* A NULL pointer */
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
Functions
Category | Function | Description |
General | C_Initialize | initializes Cryptoki |
purpose functions | C_Finalize | clean up miscellaneous Cryptoki-associated resources |
| C_GetInfo | obtains general information about Cryptoki |
| C_GetFunctionList | obtains entry points of Cryptoki library functions |
Slot and token | C_GetSlotList | obtains a list of slots in the system |
management | C_GetSlotInfo | obtains information about a particular slot |
functions | C_GetTokenInfo | obtains information about a particular token |
| C_WaitForSlotEvent | waits for a slot event (token insertion, removal, etc.) to occur |
| C_GetMechanismList | obtains a list of mechanisms supported by a token |
| C_GetMechanismInfo | obtains information about a particular mechanism |
| C_InitToken | initializes a token |
| C_InitPIN | initializes the normal user’s PIN |
| C_SetPIN | modifies the PIN of the current user |
Session management functions | C_OpenSession | opens a connection between an application and a particular token or sets up an application callback for token insertion |
| C_CloseSession | closes a session |
| C_CloseAllSessions | closes all sessions with a token |
| C_GetSessionInfo | obtains information about the session |
| C_GetOperationState | obtains the cryptographic operations state of a session |
| C_SetOperationState | sets the cryptographic operations state of a session |
| C_Login | logs into a token |
| C_Logout | logs out from a token |
Object | C_CreateObject | creates an object |
management | C_CopyObject | creates a copy of an object |
functions | C_DestroyObject | destroys an object |
| C_GetObjectSize | obtains the size of an object in bytes |
| C_GetAttributeValue | obtains an attribute value of an object |
| C_SetAttributeValue | modifies an attribute value of an object |
| C_FindObjectsInit | initializes an object search operation |
| C_FindObjects | continues an object search operation |
| C_FindObjectsFinal | finishes an object search operation |
Encryption | C_EncryptInit | initializes an encryption operation |
functions | C_Encrypt | encrypts single-part da |
| C_EncryptUpdate | continues a multiple-part encryption operation |
| C_EncryptFinal | finishes a multiple-part encryption operation |
Decryption | C_DecryptInit | initializes a decryption operation |
functions | C_Decrypt | decrypts single-part encrypted da |
| C_DecryptUpdate | continues a multiple-part decryption operation |
| C_DecryptFinal | finishes a multiple-part decryption operation |
Message | C_DigestInit | initializes a message-digesting operation |
digesting | C_Digest | digests single-part da |
functions | C_DigestUpdate | continues a multiple-part digesting operation |
| C_DigestKey | digests a key |
| C_DigestFinal | finishes a multiple-part digesting operation |
Signing | C_SignInit | initializes a signature operation |
and MACing | C_Sign | signs single-part da |
functions | C_SignUpdate | continues a multiple-part signature operation |
| C_SignFinal | finishes a multiple-part signature operation |
| C_SignRecoverInit | initializes a signature operation, where the da |
| C_SignRecover | signs single-part da |
Functions for verifying | C_VerifyInit | initializes a verification operation |
signatures | C_Verify | verifies a signature on single-part da |
and MACs | C_VerifyUpdate | continues a multiple-part verification operation |
| C_VerifyFinal | finishes a multiple-part verification operation |
| C_VerifyRecoverInit | initializes a verification operation where the da |
| C_VerifyRecover | verifies a signature on single-part da |
Dual-purpose cryptographic | C_DigestEncryptUpdate | continues simultaneous multiple-part digesting and encryption operations |
functions | C_DecryptDigestUpdate | continues simultaneous multiple-part decryption and digesting operations |
| C_SignEncryptUpdate | continues simultaneous multiple-part signature and encryption operations |
| C_DecryptVerifyUpdate | continues simultaneous multiple-part decryption and verification operations |
Key | C_GenerateKey | generates a secret key |
management | C_GenerateKeyPair | generates a public-key/private-key pair |
functions | C_WrapKey | wraps (encrypts) a key |
| C_UnwrapKey | unwraps (decrypts) a key |
| C_DeriveKey | derives a key from a base key |
Random number generation | C_SeedRandom | mixes in additional seed material to the random number generator |
functions | C_GenerateRandom | generates random da |
Parallel function management | C_GetFunctionStatus | legacy function which always returns CKR_FUNCTION_NOT_PARALLEL |
functions | C_CancelFunction | legacy function which always returns CKR_FUNCTION_NOT_PARALLEL |
Callback function |
| application-supplied function to process notifications from Cryptoki |
不同的平台,修改cryptoki.h头文件即可。
Example:(Win32 Cryptoki.h)
#pragma pack(push, cryptoki, 1)
#define CK_IMP
#ifdef CRYPTOKI_EXPORTS
#define CK_EXPORT_SPEC __declspec(dllexport)
#else
#define CK_EXPORT_SPEC CK_IMP
#endif
#define CK_CALL_SPEC __cdecl
#define CK_PTR *
#define CK_DEFINE_FUNCTION(returnType, name) \
returnType CK_EXPORT_SPEC CK_CALL_SPEC name
#define CK_DECLARE_FUNCTION(returnType, name) \
returnType CK_EXPORT_SPEC CK_CALL_SPEC name
#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
returnType CK_IMP
#define CK_CALLBACK_FUNCTION(returnType, name) \
returnType (CK_CALL_SPEC CK_PTR name)
#ifndef NULL_PTR
#define NULL_PTR 0
#endif
#include "pkcs11.h"
#pragma pack(pop, cryptoki)
Example:(Win16 Cryptoki.h)
#pragma pack(1)
#define CK_PTR far *
#define CK_DEFINE_FUNCTION(returnType, name) \
returnType __export _far _pascal name
#define CK_DECLARE_FUNCTION(returnType, name) \
returnType __export _far _pascal name
#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
returnType __export _far _pascal (* name)
#define CK_CALLBACK_FUNCTION(returnType, name) \
returnType _far _pascal (* name)
#ifndef NULL_PTR
#define NULL_PTR 0
#endif
Example (Unix cryptoki.h)
#define CK_PTR *
#define CK_DEFINE_FUNCTION(returnType, name) \
returnType name
#define CK_DECLARE_FUNCTION(returnType, name) \
returnType name
#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
returnType (* name)
#define CK_CALLBACK_FUNCTION(returnType, name) \
returnType (* name)
#ifndef NULL_PTR
#define NULL_PTR 0
#endif