📄 xcos_eclibt.h
字号:
//---------------------------------------------------------------------------
//
// EKEY CSP LIBRARY
//
//---------------------------------------------------------------------------
#ifndef XCOS_ECLIBT_H
#define XCOS_ECLIBT_H
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#define IN
#define OUT
typedef int INT;
typedef int BOOL;
typedef unsigned char BYTE;
typedef char CHAR;
typedef unsigned char UCHAR;
typedef unsigned long DWORD;
typedef long HEKEY;
typedef long HCONTAINER;
typedef long HUSERFILE;
typedef long HCIPHERKEY;
// Maximums dwPort
#define XC_MAX_PORT_NUM 8
#define XC_MAX_CHAR_NUM 16
#define CTRL_CODE_LEN 8
//
//dwParam definitions for XC_GetEkeyParam and XC_SetEkeyParam
//
#define EP_LABEL 0x00000001 //(M)Ekey label.
#define EP_FREE_SIZE 0x00000002 //(M)Ekey free sizes.
#define EP_SERIAL_NUMBER 0x00000003 //(M)Ekey serial number.
#define EP_MANUFACTURER_ID 0x00000004 //(M)Ekey manufacturer ID.
#define EP_ATR 0x00000005 //(M)Ekey ATR(answer to request).
#define EP_STATE 0x00000006 //(M)Ekey states(see below).
#define EP_MAX_CONTAINER_NUM 0x00000007 //(M)Maximums cert number in Ekey.
#define EP_CUR_CONTAINER_NUM 0x00000008 //(M)Current cert number in Ekey.
#define EP_PIN_MODE 0x00000009 //Ekey PIN mode(user pin)
#define EP_SET_USER_PIN 0x0000000a //Set user PIN.
#define EP_CLEAR_PIN 0x0000000b //Clear PIN stored in RAM.
#define EP_FLAGS 0x0000000c //Ekey flags.
#define EP_NO_GUI 0x0000000d //Do not display any dialog to User
//It is a flag for eclib dll,
//not for some specific ekey
//
//Ekey state mask definitions for EP_STATE
//
#define EPS_BLANK 0x00000001 //Ekey is blank.
#define EPS_OPEN 0x00000002 //Ekey is open.
#define EPS_MWEKEY 0x00000004 //Ekey is M&W key.
//
//Ekey flags mask definitions for EP_FLAGS.
//
#define EPF_PRIKEY_UNMODIFIABLE 0x00000001 //Private key is unmodifiable.
#define EPF_NO_UNLOCK 0x00000002 //User PIN cannt be unlocked.
#define EPF_BLANK_EKEY_NO_PROTECTION 0x00000004 //EKey can be blanked without PIN
//
//Ekey PIN mode definitions for EP_PIN_MODE
//
#define EPP_LOW_SECURITY 0x00000001 //PIN store in RAM until releasing dll.
#define EPP_MID_SECURITY 0x00000002 //
#define EPP_HIGH_SECURITY 0x00000003
//
//FORMATINFO definitions for XC_FormatEkey
//
typedef struct FORMATINFOtag {
BYTE Label[17]; //(M)Ekey label.
BYTE ctrlCode[8]; //(M)Ekey contrl code.
BYTE SOPin[17]; //(M)Security Officer PIN.
BYTE UserPin[17]; //(M)User PIN.
DWORD dwSOPinRetryNumber; //(M)SO Pin retry number.
DWORD dwUserPinRetryNumber; //(M)User Pin retry number.
DWORD dwContainerNumber; //(M)Container number.
DWORD dwPinMode; //Ekey PIN mode.
DWORD dwFlags; //Ekey flags.
DWORD dwReserved; //For reserved.
}FORMATINFO, *PFORMATINFO;
//
//dwFlags definitions for XC_VerifyPin XC_ChangePin and XC_UnlockPin
//
#define PF_SO 0x00000001//(M)SO pin.
#define PF_USER 0x00000002//(M)User pin.
//
//dwFlags definitions for XC_CreateUserFile
//
#define UF_PUBLIC 0x00000001
#define UF_PRIVATE 0X00000002
#define UF_CREATE_NEW 0x00000004
#define UF_OPEN_EXISTING 0x00000008
//
//dwFlags definitions for XC_CreateContainer
//
#define CF_CREATE_NEW 0x00000001 //(M)Create new container.
#define CF_OPEN_EXISTING 0x00000002 //(M)Open container.
#define CF_DEFAULT 0x00000100 //Used to open default container
//
//dwParam definitions for XC_GetContainerParam and XC_SetContainerParam
//
#define CP_CONTAINER_NAME 0x00000001 //(M)Container name.
#define CP_CONTAINER_STATE 0x00000002 //(M)Container state.
//
//Container state mask definitions for CP_CONTAINER_STATE.
//
#define CPS_SIGN_CERT_EXISTING 0x00000008 //Exist sign cert.
#define CPS_EXCHANGE_CERT_EXISTING 0x00000004 //Exist exchange cert.
#define CPS_SIGN_KEY_EXISTING 0x00000002 //Exist sign RSA key pair.
#define CPS_EXCHANGE_KEY_EXISTING 0x00000001 //Exist exchange key pair.
//
//dwKeySpec definitions for XC_GenRSAKey.
//
#define RK_EXCHANGE_KEY 0x00000001 //(M)Generate exchange key.
#define RK_SIGNATURE_KEY 0x00000002 //(M)Generate signature key.
#define RK_PADDING_PKCS1 0x00000000 //PKCS#1 padding method(v1.5)BT = 01 or 02, BT 00 is not supported
#define RK_PADDING_NOPADDING 0x00000100 //No padding will be performed.User should pad data properly.
//
//dwAlgId definitions for XC_CreateKey.
//
#define KID_DES 0x00000001
#define KID_3DES 0x00000002
#define KID_SF33 0x00000003
//
//dwParam definitions for XC_SetKeyParam
//
#define XKP_MODE 0x00000001
#define XKP_PADDING 0x00000002
#define XKP_IV 0x00000003
//
//algorithm mode definitions for XKP_MODE
//
#define KPM_ECB 0x00000001
#define KPM_CBC 0x00000002
#define KPM_OFB 0x00000003
#define KPM_CFB 0x00000004
//
// algorithm padding mode for XKP_PADDING
//
#define KPP_NO_PADDING 0x00000001
//
//dwFlags definitions for XC_Encrypt and XC_Decrypt
//
#define ED_UPDATE 0x00000001
#define ED_FINAL 0x00000002
//
//Return flags
//
#define XCR_OK 0x00000000 //Return ok!
#define XCR_FAIL 0x00000001 //
#define XCR_GENERAL_ERROR 0x00000002 //
#define XCR_NO_EKEY 0x00000003 //
#define XCR_CONNECT_ERROR 0x00000004 //
#define XCR_BAD_HANDLE 0x00000005 //
#define XCR_BAD_PARAM 0x00000006 //
#define XCR_BAD_FLAGS 0x00000007 //
#define XCR_DATA_ERROR 0x00000008 //
#define XCR_LEN_ERROR 0x00000009 //
#define XCR_NO_CONTAINER 0x0000000a //
#define XCR_CONTAINERNUM_ERROR 0x0000000b //
#define XCR_KEYSPEC_ERROR 0x0000000c //
#define XCR_CONTAINER_EXIST 0x0000000d //
#define XCR_BUFFER_TOO_SMALL 0x0000000e //
#define XCR_USER_NOT_LOG_IN 0x0000000f //
#define XCR_FILE_NOT_EXIST 0x00000010 //
#define XCR_FILE_ALREADY_EXIST 0X00000011 //
#define XCR_USER_PIN_ERROR 0x00000012 //
#define XCR_HOST_MEMORY 0x00000013 //
#define XCR_ALG_NOT_SUPPORT 0x00000014
#define XCR_OPERATION_ACTIVE 0x00000015
#define XCR_OPERATION_NOT_INIT 0x00000016
#define XCR_FUNCTION_NOT_SUPPORT 0x00000017
#define XCR_CONTAINER_NAME_TOO_LONG 0x00000018
#define XCR_PIN_RETRYNUM 0x00010000 // The low word include PIN retry number,
//
// assistant
//
#define XCA_PIN_RETRYNUM_MASK 0x0000ffff // mask bits for getting the pin retry number.
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -