增加获取HSM私钥句柄

安装包增加libcertex库
增加HSM配置文件rcsp.con
This commit is contained in:
fengweihao
2020-11-25 14:10:26 +08:00
parent d452d7b5f2
commit f3cbd19825
17 changed files with 899 additions and 325 deletions

View File

@@ -0,0 +1,139 @@
//------------------------------------------------------------------------------
// RCSP Project
// Copyright (c) 2007 Scientific Lab. Gamma Technologies. All rights reserved.
//
// R-CSP/R-PKCS11 LIB Loader
//------------------------------------------------------------------------------
#ifndef __RLIB_LOAD_H
#define __RLIB_LOAD_H
//------------------------------------------------------------------------------
#define LOADLIBRARY
//------------------------------------------------------------------------------
#ifndef CK_PTR
#define CK_PTR *
#endif
#ifndef NULL_PTR
#define NULL_PTR 0
#endif
#ifndef CK_CALLBACK_FUNCTION
#define CK_CALLBACK_FUNCTION(returnType, name) returnType (* name)
#endif
#ifndef CK_DEFINE_FUNCTION
#define CK_DEFINE_FUNCTION(returnType, name) returnType name
#endif
#ifndef CK_DECLARE_FUNCTION
#define CK_DECLARE_FUNCTION(returnType, name) returnType name
#endif
#ifndef CK_DECLARE_FUNCTION_POINTER
#define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType (* name)
#endif
#pragma pack(push, cryptoki, 1)
#include "pkcs11.h"
#pragma pack(pop, cryptoki)
//------------------------------------------------------------------------------
#ifdef WIND32
#define CSP_REGKEY "SOFTWARE\\Microsoft\\Cryptography\\Defaults\\Provider\\Tumar CSP"
#define CAPI_LIB_PATH ""
#define PKCS_LIB_PATH ""
#else
#ifdef USE_CRITICAL_SECTION
#if defined HPXX
#define CAPI_LIB_PATH "/usr/lib/libcertex-csp.1.0.0_r.sl"
#define PKCS_LIB_PATH "/usr/lib/libcertex-pkcs11.1.0.0_r.sl"
#elif defined DEC64
#define CAPI_LIB_PATH "/usr/shlib/libcertex-csp.1.0.0_r.so"
#define PKCS_LIB_PATH "/usr/shlib/libcertex-pkcs11.1.0.0_r.so"
#else
#define CAPI_LIB_PATH "/lib/libcertex-csp_r.so.1.0.0"
#define PKCS_LIB_PATH "/lib/libcertex-pkcs11_r.so.1.0.0"
#endif
#else
#if defined HPXX
#define CAPI_LIB_PATH "/usr/lib/libcertex-csp.1.0.0.sl"
#define PKCS_LIB_PATH "/usr/lib/libcertex-pkcs11.1.0.0.sl"
#elif defined DEC64
#define CAPI_LIB_PATH "/usr/shlib/libcertex-csp.1.0.0.so"
#define PKCS_LIB_PATH "/usr/shlib/libcertex-pkcs11.1.0.0.so"
#else
#define CAPI_LIB_PATH "/lib/libcertex-csp.so.1.0.0"
#define PKCS_LIB_PATH "/lib/libcertex-pkcs11.so.1.0.0"
#endif
#endif
#endif
//------------------------------------------------------------------------------
int LoadPkcsLib (char *dllpkcs);
void FreePkcsLib(void);
int do_GetFunctionList( void );
//------------------------------------------------------------------------------
extern CK_C_Initialize FC_Initialize;
extern CK_C_Finalize FC_Finalize;
extern CK_C_GetInfo FC_GetInfo;
extern CK_C_GetFunctionList FC_GetFunctionList;
extern CK_C_GetSlotList FC_GetSlotList;
extern CK_C_GetSlotInfo FC_GetSlotInfo;
extern CK_C_GetTokenInfo FC_GetTokenInfo;
extern CK_C_GetMechanismList FC_GetMechanismList;
extern CK_C_GetMechanismInfo FC_GetMechanismInfo;
extern CK_C_InitToken FC_InitToken;
extern CK_C_InitPIN FC_InitPIN;
extern CK_C_SetPIN FC_SetPIN;
extern CK_C_OpenSession FC_OpenSession;
extern CK_C_CloseSession FC_CloseSession;
extern CK_C_CloseAllSessions FC_CloseAllSessions;
extern CK_C_GetSessionInfo FC_GetSessionInfo;
extern CK_C_GetOperationState FC_GetOperationState;
extern CK_C_SetOperationState FC_SetOperationState;
extern CK_C_Login FC_Login;
extern CK_C_Logout FC_Logout;
extern CK_C_CreateObject FC_CreateObject;
extern CK_C_CopyObject FC_CopyObject;
extern CK_C_DestroyObject FC_DestroyObject;
extern CK_C_GetObjectSize FC_GetObjectSize;
extern CK_C_GetAttributeValue FC_GetAttributeValue;
extern CK_C_SetAttributeValue FC_SetAttributeValue;
extern CK_C_FindObjectsInit FC_FindObjectsInit;
extern CK_C_FindObjects FC_FindObjects;
extern CK_C_FindObjectsFinal FC_FindObjectsFinal;
extern CK_C_EncryptInit FC_EncryptInit;
extern CK_C_Encrypt FC_Encrypt;
extern CK_C_EncryptUpdate FC_EncryptUpdate;
extern CK_C_EncryptFinal FC_EncryptFinal;
extern CK_C_DecryptInit FC_DecryptInit;
extern CK_C_Decrypt FC_Decrypt;
extern CK_C_DecryptUpdate FC_DecryptUpdate;
extern CK_C_DecryptFinal FC_DecryptFinal;
extern CK_C_DigestInit FC_DigestInit;
extern CK_C_Digest FC_Digest;
extern CK_C_DigestUpdate FC_DigestUpdate;
extern CK_C_DigestKey FC_DigestKey;
extern CK_C_DigestFinal FC_DigestFinal;
extern CK_C_SignInit FC_SignInit;
extern CK_C_Sign FC_Sign;
extern CK_C_SignUpdate FC_SignUpdate;
extern CK_C_SignFinal FC_SignFinal;
extern CK_C_SignRecoverInit FC_SignRecoverInit;
extern CK_C_SignRecover FC_SignRecover;
extern CK_C_VerifyInit FC_VerifyInit;
extern CK_C_Verify FC_Verify;
extern CK_C_VerifyUpdate FC_VerifyUpdate;
extern CK_C_VerifyFinal FC_VerifyFinal;
extern CK_C_VerifyRecoverInit FC_VerifyRecoverInit;
extern CK_C_VerifyRecover FC_VerifyRecover;
extern CK_C_DigestEncryptUpdate FC_DigestEncryptUpdate;
extern CK_C_DecryptDigestUpdate FC_DecryptDigestUpdate;
extern CK_C_SignEncryptUpdate FC_SignEncryptUpdate;
extern CK_C_DecryptVerifyUpdate FC_DecryptVerifyUpdate;
extern CK_C_GenerateKey FC_GenerateKey;
extern CK_C_GenerateKeyPair FC_GenerateKeyPair;
extern CK_C_WrapKey FC_WrapKey;
extern CK_C_UnwrapKey FC_UnwrapKey;
extern CK_C_DeriveKey FC_DeriveKey;
extern CK_C_SeedRandom FC_SeedRandom;
extern CK_C_GenerateRandom FC_GenerateRandom;
extern CK_C_GetFunctionStatus FC_GetFunctionStatus;
extern CK_C_CancelFunction FC_CancelFunction;
extern CK_C_WaitForSlotEvent FC_WaitForSlotEvent;
//------------------------------------------------------------------------------
#endif