此示例称为演示提供者,是指可用作自定义提供者的基础的工作提供者。此示例可打开 PKCS#11 会话并创建对象。如果该提供者与包含 MD5Init()、MD5Update 和 MD5Final() 函数的库链接,则可通过使用 CKM_MD5 机制来执行摘要操作。该提供者基于 PKCS#11 V2.11。完整的提供者软件可以从 http://www.sun.com/download/products.xml?id=41912db5 下载。一些 PKCS#11 函数已在该示例代码中完全实现,而其他一些 CS#11 函数仅定义为返回 CKR_FUNCTION_NOT_SUPPORTED。
该示例由以下源代码和头文件组成:
exampleDigest.c -完全实现以下函数:C_DigestInit()、C_Digest()、C_DigestUpdate()、C_DigestKey() 和 C_DigestFinal()。
exampleDigestUtil.c -包含与摘要有关的实用程序函数。
exampleAttributeUtil.c -针对属性进行定义、分析、验证和执行各种操作。
exampleGeneral.c -完全实现以下函数:C_Initialize()、C_Finalize()、C_GetInfo()、C_GetFunctionList()、C_GetFunctionStatus() 和 C_CancelFunction()。
exampleObject.c -完全实现以下函数:C_CreateObject()、C_CopyObject()、C_DestroyObject()、C_GetAttributeValue() 和 C_SetAttributeValue()。
exampleObject.h -为密钥、属性和对象提供各种结构和函数原型。
exampleObjectUtil.c -定义用于管理密钥、对象和属性的特殊函数。
exampleOps.h -提供示例摘要函数的原型。
exampleRand.c -完全实现以下函数:C_SeedRandom() 和 C_GenerateRandom()。
exampleRandUtil.c -包含随机数实用程序函数。
exampleRand.h -提供 random_generator() 函数的原型。
exampleSession.c -完全实现以下函数:C_OpenSession()、C_CloseSession()、C_CloseAllSessions() 和 C_GetSessionInfo()。
exampleSessionUtil.c -包含与会话有关的实用程序函数。
exampleSession.h -提供会话所需的各种标志、结构、函数原型和宏。
exampleSlotToken.c -完全实现 C_GetSlotList()、C_GetSlotInfo()、C_GetTokenInfo()、C_GetMechanismList() 和 C_GetMechanismInfo()。
exampleKeys.c -包含以下可返回 CKR_FUNCTION_NOT_SUPPORTED 的函数:C_GenerateKey()、C_GenerateKeyPair()、C_WrapKey()、C_UnwrapKey() 和 C_DeriveKey()。
exampleEncrypt.c -包含以下可返回 CKR_FUNCTION_NOT_SUPPORTED 的函数:C_EncryptInit()、C_Encrypt()、C_EncryptUpdate() 和 C_EncryptFinal()。
exampleDecrypt.c -包含以下函数,这些函数可返回 CKR_FUNCTION_NOT_SUPPORTED:C_DecryptInit()、C_Decrypt()、C_DecryptUpdate() 和 C_DecryptFinal()。
exampleSign.c -包含以下函数,这些函数可返回 CKR_FUNCTION_NOT_SUPPORTED:C_SignInit()、C_Sign()、C_SignUpdate()、C_SignFinal()、C_SignRecoverInit() 和 C_SignRecover()。
exampleVerify.c -包含以下函数,这些函数可返回 CKR_FUNCTION_NOT_SUPPORTED:C_VerifyInit()、C_Verify()、C_VerifyUpdate()、C_VerifyFinal()、C_VerifyRecoverInit() 和 C_VerifyRecover()。
exampleDualCrypt.c -包含以下可返回 CKR_FUNCTION_NOT_SUPPORTED 的函数:C_DigestEncryptUpdate()、C_DecryptDigestUpdate()、C_SignEncryptUpdate() 和 C_DecryptVerifyUpdate()。
exampleGlobal.h -提供全局变量和常数的定义。