| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764 |
- #pragma once
- /*
- 中间接口相关的数据结构和宏定义。
- */
- #include "sys/time.h"
- #include <vector>
- #include <string>
- #include "CommDef.h"
- #pragma pack(push,1)
- using namespace std;
- #define MAX_PATH 260
- #define DEV_TYPE_M1FD 0
- #define DEV_TYPE_M5D 1
- //wType
- #define PIN_TYPEEPP 0x0001
- #define PIN_TYPEEDM 0x0002
- #define PIN_TYPEHSM 0x0004
- #define PIN_TYPEOTHER 0xFFFF
- //#define PIN_UNIONPAYEPP 0x08
- //#define PIN_PCI3xEPP 0x10
- //#define PIN_PCI4xEPP 0x20
- //CryptAlgorithms
- #define PIN_CRYPTDESECB 0x0001
- #define PIN_CRYPTDESCBC 0x0002
- #define PIN_CRYPTDESCFB 0x0004
- #define PIN_CRYPTRSA 0x0008
- #define PIN_CRYPTECMA 0x0010
- #define PIN_CRYPTDESMAC 0x0020
- #define PIN_CRYPTTRIDESECB 0x0040
- #define PIN_CRYPTTRIDESCBC 0x0080
- #define PIN_CRYPTTRIDESCFB 0x0100
- #define PIN_CRYPTTRIDESMAC 0x0200
- #define PIN_CRYPTMAAMAC 0x0400
- #define PIN_CRYPTSM4ECB 0x1000
- #define PIN_CRYPTSM4CBC 0x2000
- //wDerivationAlgorithms
- #define PIN_CHIP_NONE 0x00
- #define PIN_CHIP_ZKA 0x01
- //wPresentationAlgorithms
- #define PIN_PRESENT_NONE 0x00
- #define PIN_PRESENT_CLEAR 0x01
- //wIDKey
- #define PIN_IDKEYINITIALIZATION (0x0001)
- #define PIN_IDKEYIMPORT (0x0002)
- //wValidationAlgorithms
- #define PIN_DES 0x0001
- #define PIN_EUROCHEQUE 0x0002
- #define PIN_VISA 0x0004
- #define PIN_DES_OFFSET 0x0008
- #define PIN_BANKSYS 0x0010
- //wRemoteKeySupp
- #define PIN_REMOTE_KEY_NONE 0x0000
- #define PIN_REMOTE_KEY_SIGNATURES 0x0001
- #define PIN_REMOTE_KEY_CERTIFICATES 0x0002
- //wGMKeySupp
- #define PIN_GM_KEY_NONE 0x0000
- #define PIN_GM_KEY_SM2 0x0001
- #define PIN_GM_KEY_SM3 0x0002
- #define PIN_GM_KEY_SM4 0x0004
- //wCommPattern
- #define PIN_COMM_RS232 0x0001
- #define PIN_COMM_USB 0x0002
- #define PIN_COMM_AUTO 0x0004
- //wResetMode
- #define PIN_SOFT_RESET (0x0000)
- #define PIN_HARD_RESET_DES (0x0001)
- #define PIN_HARD_RESET_SM4 (0x0002)
- #define PIN_HARD_RESET_RSA (0x0003)
- #define PIN_HARD_RESET_ALL (0xFFFF)
- //DelEntryPinKey.byMode
- #define PIN_DEL_ONE (0x30)
- #define PIN_DEL_ALL (0x31)
- //wPswType
- #define PIN_PSW_OLD (1)
- #define PIN_PSW_NEW (2)
- //wFormat
- #define PIN_FORM3624 0x0001
- #define PIN_FORMANSI 0x0002
- #define PIN_FORMISO0 0x0004
- #define PIN_FORMISO1 0x0008
- #define PIN_FORMECI2 0x0010
- #define PIN_FORMECI3 0x0020
- #define PIN_FORMVISA 0x0040
- #define PIN_FORMDIEBOLD 0x0080
- #define PIN_FORMDIEBOLDCO 0x0100
- #define PIN_FORMVISA3 0x0200
- #define PIN_FORMBANKSYS 0x0400
- #define PIN_FORMEMV 0x0800
- #define PIN_FORMISO3 0x2000
- #define PIN_FREEMODE 0x8000
- //wPswType
- #define PIN_PSW_KEY1 (901) //手动密钥
- #define PIN_PSW_KEY2 (902)
- #define PIN_PSW_KEY3 (903)
- #define PIN_PSW_EPP1 (904) //授权安装
- #define PIN_PSW_EPP2 (905)
- //RemoveInstallAuthen.byMode
- #define PIN_REMOVE (0x31)
- #define PIN_INSTALL (0x32)
- //wKeyType
- #define KEY_TYPE_DES 0x0001
- #define KEY_TYPE_SM4 0x0002
- #define KEY_TYPE_RSA 0x0003
- //dwUse密钥属性
- #define PIN_USECRYPT (0x00000001)
- #define PIN_USEFUNCTION (0x00000002)
- #define PIN_USEMACING (0x00000004)
- #define PIN_USEKEYENCKEY (0x00000020)
- #define PIN_USENODUPLICATE (0x00000040)
- #define PIN_USESVENCKEY (0x00000080)
- #define PIN_USECONSTRUCT (0x00000100)
- #define PIN_USESECURECONSTRUCT (0x00000200)
- #define PIN_USESM4 (0X00008000)
- #define PIN_USEPINLOCAL (0x00010000)
- #define PIN_USERSAPUBLIC (0x00020000)
- #define PIN_USERSAPRIVATE (0x00040000)
- #define PIN_USECHIPINFO (0x00100000)
- #define PIN_USECHIPPIN (0x00200000)
- #define PIN_USECHIPPS (0x00400000)
- #define PIN_USECHIPMAC (0x00800000)
- #define PIN_USECHIPLT (0x01000000)
- #define PIN_USECHIPMACLZ (0x02000000)
- #define PIN_USECHIPMACAZ (0x04000000)
- #define PIN_USERSAPUBLICVERIFY (0x08000000)
- #define PIN_USERSAPRIVATESIGN (0x10000000)
- #define PIN_USERSAVND (0x20000000)
- #define PIN_USERSAUID (0x40000000)
- #define PIN_USERSAPKHOST (0x80000000)
- //wCheckMode.wKeyCheckModes
- #define PIN_KCVNONE (0)
- #define PIN_KCVSELF (1)
- #define PIN_KCVZERO (2)
- //byAlgorithm
- #define PIN_MAC_X9 (0x41)
- #define PIN_MAC_X919 (0x42)
- #define PIN_MAC_CBC (0x43)
- #define PIN_MAC_PBOC (0x44)
- #define PIN_MAC_UNIONPAY (0x45)
- //CryptData.wMode
- #define PIN_MODEENCRYPT (1)
- #define PIN_MODEDECRYPT (2)
- //CryptData.byAlgorithm
- #define PIN_CRYPT_ECB (0x01)
- #define PIN_CRYPT_CBC (0x02)
- //CryptData.byPattern
- #define PIN_CRYPT_DES (0x31)
- #define PIN_CRYPT_TDES (0x32)
- #define MAX_KEY_NAME_LEN 32
- //wKeyState
- #define PIN_KEY_STATE_NONE 0
- #define PIN_KEY_STATE_EXIST 1
- #define PIN_KEY_STATE_FULL 2
- #define PIN_KEY_STATE_LOCK 3
- #define PIN_KEY_STATE_UNKNOWN 128
- //wBattery
- #define PIN_BATTERY_OK 0
- #define PIN_BATTERY_LOW 1
- #define PIN_BATTERY_NONE 2
- #define PIN_BATTERY_UNKNOWN 128
- //wDisplay
- #define PIN_DISPNONE 0x00
- #define PIN_DISPLEDTHROUGH 0x01
- #define PIN_DISPDISPLAY 0x02
- //硬件返回错误码宏定义
- #define STATUS_SUCCESS 0x00
- #define STATUS_INVALID_COMMAND_LENGTH 0x01
- #define STATUS_INVALID_KEYID 0x02
- #define STATUS_INVALID_WRITE_MODE 0x03
- #define STATUS_KEYID_NOT_EXIST 0x04
- #define STATUS_KEYID_LOCKED 0x05
- #define STATUS_INVALID_KEY_LENGTH 0x06
- #define STATUS_INVALID_KEY_ATTRIBUTES 0x07
- #define STATUS_INVALID_IV_ATTRIBUTES 0x08
- #define STATUS_KEY_ATTRIBUTES_NOT_MATCHED 0x09
- #define STATUS_KCV_VERIFICATION_FAIL 0x0A
- #define STATUS_INVALID_KEY_VALUE 0x0B
- #define STATUS_KEY_USEVIOLATION 0x10
- #define STATUS_KEY_NOTALLOWED 0x11
- #define STATUS_INVALID_CHECK_MODE 0x12
- #define STATUS_INVALID_VERIFY_MODE 0x13
- #define STATUS_INVALID_MACING 0x14
- #define STATUS_INVALID_AUTHENTICATION_MODE 0x15
- #define STATUS_INVALID_MODE 0x16
- #define STATUS_INVALID_DATA_SPECIFIED 0x17
- #define STATUS_INVALID_LENGTH_OR_SUM 0x18
- #define STATUS_INVALID_OFFSET_LENGTH 0x19
- #define STATUS_INVALID_PIN_LENGTH 0x20
- #define STATUS_PIN_VERIFICATION_FAIL 0x21
- #define STATUS_PIN_ENCRYPTION_SUSPENDED 0x22
- #define STATUS_PIN_NOPIN 0x23
- #define STATUS_INVALID_PIN2_LENGTH 0x24
- #define STATUS_PIN2_VERIFICATION_FAIL 0x25
- #define STATUS_INVALID_MODULUS_LENGTH 0x31
- #define STATUS_INVALID_EXPONENT_LENGTH 0x32
- #define STATUS_INVALID_PKCS_STRUCTURE 0x33
- #define STATUS_INVALID_PKCS_PADDING 0x34
- #define STATUS_INVALID_SIGNATURE_LENGTH 0x35
- #define STATUS_SIGNATURE_VERIFICATION_FAIL 0x36
- #define STATUS_KEY_NOT_LOADED 0x37
- #define STATUS_INVALID_CERTIFICATE_FROMAT 0x41
- #define STATUS_INVALID_CERTIFICATE_VERSION 0x42
- #define STATUS_INVALID_CERTIFICATE_VALIDITY 0x43
- #define STATUS_INVALID_CERTIFICATE_ISSUER 0x44
- #define STATUS_INVALID_CERTIFICATE_SUBJECT 0x45
- #define STATUS_INVALID_CERTIFICATE_ALGOR 0x46
- #define STATUS_CERTIFICATE_NOT_EXIST 0x47
- #define STATUS_INVALID_DATA_DISABLEED 0x50
- #define STATUS_INVALID_USERBLOCK_ADDRESS 0x51
- #define STATUS_INVALID_SERIALNO_SPECIFIED 0x52
- #define STATUS_NO_CARD 0x55
- #define STATUS_CARD_APDU_ERROR 0x56
- #define STATUS_KEY_INVALID 0x60
- #define STATUS_EMV_NOT_INITIALIZED 0x61
- #define STATUS_EMV_NOT_READY 0x62
- #define STATUS_EMV_ALREADY_INITIALIZED 0x63
- #define STATUS_EMV_NEED_REINITIALIZE 0x64
- #define STATUS_EMV_TIMEOUT 0x65
- #define STATUS_ALGORITHMNOTSUPP 0x71
- #define STATUS_COMMANDUPSUPP 0x72
- #define STATUS_ERROR_INTER_ERROR 0x73
- #define STATUS_COMMAND_LOCK 0x74
- #define STATUS_INVALID_COMMAND_MAC 0x75
- #define STATUS_AUTHENTICATION_FAILED 0x80
- #define STATUS_NOT_AUTHENTE 0x81
- #define STATUS_EPP_NOT_INITIALIZED 0x82
- #define STATUS_EPP_ALREADY_INITIALIZED 0x83
- #define STATUS_CERTIFICATE_ALREADY 0x84
- #define STATUS_PHYSICALLY_NOT_INSTALLED 0x90
- #define STATUS_LOGICALLY_NOT_INSTALLED 0x91
- #define STATUS_INPUT_KEY_TIMEOUT 0x92
- #define STATUS_INVLAID_PASSWORD_LENGTH 0x93
- #define STATUS_INVALID_PASSWORD 0x94
- #define STATUS_INPUT_PASSWORD_LOCKED 0x95
- #define STATUS_SYSTEM_TIME_NOT_SET 0x96
- #define STATUS_SYSTEM_TIME_ALREADY_SET 0x97
- #define STATUS_MRAM_HARDWARE_ERROR 0x98
- #define STATUS_DEVICE_TAMPERED 0x99
- #define STATUS_SM2_ENCRYPT_FAILURE 0xA0
- #define STATUS_SM2_DECRYPT_FAILURE 0xA1
- #define STATUS_SM2_SIGNATURE_FAILURE 0xA2
- #define STATUS_SM2_VERSIG_FAILURE 0xA3
- #define STATUS_SM2_KEYEXC_FAILURE 0xA4
- #define STATUS_SM2_VER_KEYEXC_FAILURE 0xA5
- #define STATUS_A980_NO_RESPONSE 0xA6
- #define STATUS_INVALID_SM4_KEYVAL 0xA8
- #define STATUS_OTHER_ABNORMAL_ERROR 0xAF
- #define STATUS_FW_VERIFY_FIAL 0x0100
- #define STATUS_FW_WRITE_FAIL 0x0101
- #define STATUS_FW_EARSE_FAIL 0x0102
- #define STATUS_EXTERNAL_FALSH_WRITE_ERROR 0x0103
- #define STATUS_ADDRESS_OUTRANG 0x0104
- #define STATUS_FLASH_CRC_CHECK_ERROR 0x0105
- #define STATUS_APPCODE_NOT_COMPLETE 0x1006
- //自定义错误码
- #define ERR_EXCHANGE_FAILED 0x1000
- #define ERR_COMMON_ERROR 0x1001
- #define ERR_INTERNAL_ERROR 0x1002
- #define ERR_PIN_HOST_AUTHENTICATE_FAILED 0x1003
- #define ERR_PIN_KEYNOTFOUND 0x1004
- #define ERR_PARAM_ERROR 0x1005
- #define ERR_DATA_TOO_LONG 0x1006
- #define ERR_PIN_DUPLICATEKEY 0x1007
- #define ERR_PIN_USEVIOLATION 0x1008
- #define ERR_PIN_UNSUPPORT 0x1009
- #define ERR_PIN_CHECK_KCV_FAILED 0x100A
- #define ERR_PIN_INVALIDKEYLENGTH 0x100B
- #define ERR_PIN_NOKEYRAM 0x100C
- #define ERR_PIN_ENC_KEYUSEVIOLATION 0x100D
- #define ERR_PIN_ENC_KEYNOTFOUND 0x100E
- #define ERR_PIN_PHYSICALLY_UNINSTALLED 0x100F
- #define ERR_PIN_AUTHENTICATION_FAILED 0x1010
- #define ERR_PIN_STARTVALUE_KEYNOTFOUND 0x1011
- #define ERR_PIN_STARTVALUE_KEYUSEVIOLATION 0x1012
- #define ERR_PIN_INVALIDDATA 0x1013
- #define ERR_PIN_KEY_CODE_NOT_FOUND 0x1014
- #define ERR_PIN_LOGICALLY_UNINSTALLED 0x1015
- #define ERR_PIN_NEED_INITIALIZATION 0x1016
- #define ERR_PIN_BATTERY_LOW 0x1017
- #define ERR_PIN_PRESS_KEY_OVERTIME 0x1018
- #define ERR_PIN_INVALID_MOD_LEN 0x1019
- #define ERR_PIN_SIG_NOT_SUPP 0x101A
- #define ERR_PIN_SIG_KEYNOTFOUND 0x101B
- #define ERR_PIN_SIG_KEYUSEVIOLATION 0x101C
- #define ERR_PIN_NOT_SUPP 0x101D
- #define ERR_PIN_INVALID_FW_FILE 0x101E
- #define ERR_PIN_TIMEOUT 0x101F
- #define ERR_PIN_INVALIDCUSTOMERDATA 0x1020
- #define ERR_PIN_DEVNOTOPEN 0x1021
- #define KEYBOARD_CODE_NULL 0x00
- #define KEYBOARD_CODE_SHIFT 0x10
- #define KEYBOARD_CODE_LONG_PRESS_OVERTIME 0x80 //长按键超时
- #define KEYBOARD_CODE_PIN_INPUT_OVERTIME 0x81 //PIN输入(两次按键间隔)超时
- #define KEYBOARD_CODE_ENCRYPT_PIN_OVERTIME 0x82
- #define KEYBOARD_CODE_HW_ERR 0xFF
- #define CUSTOMER_DATA_LENGTH 12
- #define ONE_LOGICKEY_MAX_HWKEY_COUNT 16
- #define MAX_LOGICKEY_COUNT 255
- #define RSA_ONE_LOGICKEY_MAX_HWKEY_COUNT 2
- #define RSA_MAX_LOGICKEY_COUNT 32
- #define DES_DATA_GROUP_LENGTH 8
- #define SM4_DATA_GROUP_LENGTH 16
- #define PIN_SIGN_NA (0)
- #define PIN_SIGN_RSASSA_PKCS1_V1_5 (0x00000001)
- #define PIN_SIGN_RSASSA_PSS (0x00000002)
- #define PIN_EXPORT_EPP_ID (0x0001)
- #define PIN_EXPORT_PUBLIC_KEY (0x0002)
- #define PIN_CRYPT_RSAES_PKCS1_V1_5 (0x00000001)
- #define PIN_CRYPT_RSAES_OAEP (0x00000002)
- #define PIN_DEFAULT (0)
- #define PIN_EXPONENT_1 (1)
- #define PIN_EXPONENT_4 (2)
- #define PIN_EXPONENT_16 (3)
- #define PIN_RSA_KCV_NONE (0x00000000)
- #define PIN_RSA_KCV_SHA1 (0x00000001)
- #define RSA_KEY_LENGTH_128_BYTE 128
- #define RSA_KEY_LENGTH_256_BYTE 256
- enum WaitEventIndex
- {
- CANCEL_EVENT = 0,
- TIMEOUT_EVENT,
- ERROR_EVENT,
- EXEE_KEY_EVENT,
- SRVE_INITIALIZED_EVENT,
- SRVE_ILLEGAL_KEY_ACCESS_EVENT,
- SRVE_OPT_REQUIRED_EVENT,
- SRVE_CERTIFICATE_CHANGE_EVENT,
- SRVE_HSM_TDATA_CHANGED_EVENT,
- WM_SP_USER_PIN_KEYPRESS,
- PRESS_KEY_EVENT,
- PRESS_KEY_OVERTIME,
- KEY_INPUT_COMPLETED_EVENT,
- EVENT_COUNT
- };
- //todo:delete this structure
- typedef struct tag_SpecialKeys
- {
- BYTE byUAK[48];
- int nUAKLen;
- BYTE byKBPK[48];
- int nKBPKLen;
- } SpecialKeys, *LPSpecialKeys;
- // 影响硬件行为的配置项
- typedef struct tag_PinpadDevConfig
- {
- BYTE usAutoUpdatePWD;
- BYTE byRemoveInstall;
- BYTE usPort;
- BYTE usBaudrate;
- BYTE byBeepLength; //0x00:一直Beep直到释放按键 0x01~0xFF:10~2550ms, 0x10 is default.
- BYTE byLongPressTime; //EPP send 0x80. 11..1F=1..15 second, 10= EPP not send 0x80. 0x15 is default.
- BYTE byKCVLength; //KCV字节数
- BYTE bySM4KCVLength;
- WORD wStartValueUsingPos; //Crypt的StartValue在加密前使用还是在加密后使用
- BYTE byKeyCodeMatrix[8][8]; //主键盘按键码(下标:[横向x][纵向y])
- BYTE byKeyShiftCodeMatrix[8][8]; //主键盘Shift模式下按键码(下标:[横向x][纵向y])
- BYTE byFuncKeyCodeMatrix[8][8]; //功能键盘按键码(下标:[横向x][纵向y])
- BYTE byFuncKeyShiftCodeMatrix[8][8]; //功能键盘Shift模式下按键码(下标:[横向x][纵向y])
- BYTE byKeyInputWaitTime; //Set timeout waiting for key input when set PIN ENTRY mode or PIN ENTRY mode Set 1~60s by 0x01~0x3C
- BYTE byEncPinTotalTime; //从按密码到Pinblock结束的超时时间(min)00:不超时
- BOOL bRandomDataForAuthentication; //认证密钥时是否使用随机数
- CHAR sDESKeyIndexFilePath[MAX_PATH]; //DES密钥索引文件全路径
- CHAR sSM4KeyIndexFilePath[MAX_PATH]; //SM4密钥索引文件全路径
- BYTE byIndexFileXORData; //加密密钥索引文件的XOR数据(隐藏配置,默认加密)
- SpecialKeys lpSpecialKeys; //特殊地位的密钥
- BYTE byDuplicateKeyCheckMode; //是否下载同名秘钥的检查范围 0:同类型秘钥内检查 1:DES和国密秘钥全范围检查
- BOOL bKeyIndexFileSaveToEPP;
- BOOL bInternalTestFlag;
- USHORT usDESKeyMaxNum;
- USHORT usSM4KeyMaxNum;
- CHAR sRSAKeyIndexFilePath[MAX_PATH]; //RSA密钥索引文件全路径
- USHORT usRSABitLen;
- BYTE byTImportRSAKey;
- BYTE byHWDESKCVMaxLen;
- BOOL bHideRSADefKey;
- BOOL bImportRSASignedDESKeyWithoutSignature;
- BOOL bImportRSASignedDESKeyWithCheckValue;
- } PinpadDevConfig, *LPPinpadDevConfig;
- typedef struct tag_PinpadStatus
- {
- WORD wDevState;//整个设备的状态
- WORD wEnc_Stat;
- WORD wKeyState; //EPP中Key相关状态 0:无Key;2:存在Key;3:Key存满;128:Unknown;
- WORD wBattery; //EPP电池状态 0:正常;1:电量低; 2:没电; 128:Unknown;
- CHAR sErrorCode[MAX_ERRCODE_LEN];
- CHAR sDescription[MAX_DESC_LEN];
- } PinpadStatus, *LPPinpadStatus;
- //EPP存储KeyMap
- typedef struct tag_SaveToEPPHWKeyInfo
- {
- WORD wID;
- BYTE byAttributes;
- } SaveToEPPHWKeyInfo, *LPSaveToEPPHWKeyInfo;
- typedef struct tag_SaveToEPPLogicKeyInfo
- {
- BYTE byID;
- BYTE byKeyLen; //秘钥长度及内容有无
- BYTE byKeyNameLen;
- LPSTR lpszKeyName;
- DWORD dwUse;
- BYTE byHWKeyNum;
- LPSaveToEPPHWKeyInfo lpstSaveToEPPHWKeyInfo;
- BYTE byEnKeyID;
- LPBYTE lpbyKeyValue;
- } SaveToEPPLogicKeyInfo, *LPSaveToEPPLogicKeyInfo;
- typedef struct tag_SaveToEPPKeyMap
- {
- WORD wTotalLen;
- BYTE byLogicKeyNum;
- LPSaveToEPPLogicKeyInfo lpstSaveToEPPLogicKeyInfo;
- } SaveToEPPKeyMap, *LPSaveToEPPKeyMap;
- typedef struct tag_PinpadCap
- {
- int fwType;
- bool bCompound; //是否为复合设备 TRUE:复合设备;FALSE:非复合设备
- int usKeyNum;
- USHORT usDesKeyNum; //最大DesKey数量
- USHORT usRsaKeyNum; //最大RsaKey数量
- USHORT usCertificateNum; //最大证书数量
- USHORT usSM2KeyNum; //最大SM2Key数量
- USHORT usSM4KeyNum; //最大SM4Key数量
- USHORT usButtonNum[2]; //主键盘按键数量 下标0:横向个数 1:纵向个数
- USHORT usFuncButtonNum[2]; //Function按键数量下标0:横向个数 1:纵向个数
- BOOL bShiftSupp; //TRUE:支持Shift按键;FALSE:不支持
- USHORT usMaxTxtBufSize; //最大明文缓冲区长度
- USHORT usMaxPinBufSize; //最大PIN缓冲区长度
- USHORT usMaxKeyBufSize; //最大密钥缓冲区长度
- int fwAlgorithms;
- int fwPinFormats; //PinBlock算法
- int fwDerivationAlgorithms; //Derivation算法
- int fwPresentationAlgorithms; //Presentation算法
- int fwDisplay; //Display
- bool bIDConnect; //是否连接ID Card
- int fwIDKey; //支持的ID Key操作
- int fwValidationAlgorithms; //Validation算法
- int fwKeyCheckModes; //KCV方式
- std::vector<std::string> lpszExtra;
- WORD wKeyCheckModes; //KCV方式
- WORD wMaxKCVLen; //硬件能返回的KCV最大长度
- WORD wMinPinPressNum; //输入密码的最小长度
- WORD wMaxPinPressNum; //输入密码的最大长度
- BOOL bEchoCharSupp; //输入密码时EPP是否支持Echo字符的设置
- BYTE byMaxLongPressTime; //最大长按键超时时间(s)
- BYTE byMaxKeyInputWaitTime; //相邻按键超时时间的最大值
- WORD wMaxMKCount; //MK最大保存个数
- WORD wMaxTPKCount; //TPK最大保存个数
- WORD wMaxTAKCount; //TAK最大保存个数
- WORD wMaxTDKCount; //TDK最大保存个数
- WORD wMaxIVCount; //Initial Vector最大保存个数
- WORD wUserAreaNum; //可读写的用户区域数量
- WORD wUserAreaSize[256]; //每个用户区域的容量(字节数)
- WORD wRemoteKeySupp; //Remote Key支持
- WORD wGMKeySupp; //国密Key支持
- WORD wCommPattern;
- BYTE byMaxPinBlockPadding; //PinBlock支持的Padding最大值
- DWORD dwMaxDESCryptDataSize; //一次DES加解密数据的最大长度
- DWORD dwMaxDESMacDataSize; //一次参与MAC运算(DES密钥)的数据最大长度
- DWORD dwMaxSM4CryptDataSize; //一次SM4加解密数据的最大长度
- DWORD dwMaxSM4MacDataSize; //一次参与MAC运算(SM4密钥)的数据最大长度
- } PinpadCap, *LPPinpadCap;
- typedef struct PinpadKeyDetailIn
- {
- string kd;
- }PinpadKeyDetailIn, *LPPinpadKeyDetailIn;
- typedef struct PinpadKeyDetailOut
- {
- struct KeyDetail
- {
- string lpsKeyName;
- int fwUse;
- bool bLoaded;
- };
- std::vector<KeyDetail> vKD;
- }PinpadKeyDetailOut, *LPPinpadKeyDetailOut;
- typedef struct tag_PinpadFuncKeyDetailIn
- {
- int fdk;
- }PinpadFuncKeyDetailIn, *LPPinpadFuncKeyDetailIn;
- typedef struct PinpadFuncKeyDetailOut
- {
- int ulFuncMask;
- struct FunctionKeyDetail
- {
- int ulFDK;
- int usXPosition;
- int usYPosition;
- FunctionKeyDetail( int iValue, int iX, int iY )
- :ulFDK(iValue), usXPosition(iX), usYPosition(iY)
- {
- }
- };
- std::vector<FunctionKeyDetail> vFDK;
- }PinpadFuncKeyDetailOut, *LPPinpadFuncKeyDetailOut;
- typedef struct tag_PinpadCryptIn
- {
- int wMode;
- string lpsKey;
- std::vector<BYTE> lpxKeyEncKey;
- int wAlgorithm;
- string lpsStartValueKey;
- std::vector<BYTE> lpxStartValue;
- BYTE bPadding;
- BYTE bCompression;
- std::vector<BYTE> lpxCryptData;
- }PinpadCryptIn, *LPPinpadCryptIn;
- typedef struct tag_PinpadCryptOut
- {
- std::vector<BYTE> vC;
- }PinpadCryptOut, *LPPinpadCryptOut;
- typedef struct tag_PinpadImportKeyIn
- {
- string lpsKey;
- string lpsEncKey;
- std::vector<BYTE> lpxIdent;
- std::vector<BYTE> lpxValue;
- int fwUse;
- }PinpadImportKeyIn, *LPPinpadImportKeyIn;
- typedef struct tag_PinpadImportKeyOut
- {
- std::vector<BYTE> vIK;
- }PinpadImportKeyOut, *LPPinpadImportKeyOut;
- typedef struct tag_PinpadPinBlockIn
- {
- string lpsCustomerData;
- string lpsXORData;
- BYTE bPadding;
- int wFormat;
- string lpsKey;
- string lpsKeyEncKey;
- int wAlgorithm;
- }PinpadPinBlockIn, *LPPinpadPinBlockIn;
- typedef struct tag_PinpadPinBlockOut
- {
- std::vector<BYTE> vGPB;
- }PinpadPinBlockOut, *LPPinpadPinBlockOut;
- typedef struct tag_PinpadIntializationIn
- {
- std::vector<BYTE> lpxIdent;
- std::vector<BYTE> lpxKey;
- }PinpadIntializationIn, *LPPinpadIntializationIn;
- typedef struct PinpadIntializationOut
- {
- std::vector<BYTE> vGI;
- }PinpadIntializationOut, *LPPinpadIntializationOut;
- typedef struct tag_PinpadGetPinIn
- {
- int usMinLen;
- int usMaxLen;
- bool bAutoEnd;
- BYTE cEcho;
- int ulActiveFDKs;
- int ulActiveKeys;
- int ulTerminateFDKs;
- int ulTerminateKeys;
- }PinpadGetPinIn, *LPPinpadGetPinIn;
- typedef struct PinpadGetPinOut
- {
- int usDigits;
- int wCompletion;
- }PinpadGetPinOut, *LPPinpadGetPinOut;
- typedef struct tag_PinpadGetDataIn
- {
- int usMaxLen;
- bool bAutoEnd;
- int ulActiveFDKs;
- int ulActiveKeys;
- int ulTerminateFDKs;
- int ulTerminateKeys;
- }PinpadGetDataIn, *LPPinpadGetDataIn;
- typedef struct tag_PinpadGetDataOut
- {
- struct GetData
- {
- int wCompletion;
- int ulDigit;
- GetData( int iDigit, int iCompletion )
- :ulDigit(iDigit), wCompletion(iCompletion)
- {
- }
- };
- std::vector<GetData> vGD;
- int wCompletion;
- }PinpadGetDataOut, *LPPinpadGetDataOut;
- typedef struct tag_PinpadInputLimitInfo
- {
- BOOL bIsTextInput;
- BYTE lpbyActiveKeyArray[32];
- BYTE lpbyActiveFDKArray[32];
- WORD wMinLen;
- WORD wMaxLen;
- BOOL bAutoEnd;
- BYTE byKeyInputWaitTime;
- CHAR cEcho;
- BOOL bBeep;
- BYTE byLongPressTime;
- HWND hWnd;
- UINT uMsg;
- WORD wInputLen;
- } PinpadInputLimitInfo, *LPPinpadInputLimitInfo;
- typedef struct tag_EPPHWKeyInfo
- {
- WORD wID;
- WORD wAttributes;
- WORD wVI; //非必要信息
- BYTE byReserve[64];
- } EPPHWKeyInfo, *LPEPPHWKeyInfo;
- typedef struct tag_EPPLogicKeyInfo
- {
- BYTE byID;
- BYTE byKeyLen;
- CHAR szKeyName[MAX_KEY_NAME_LEN];
- DWORD dwUse;
- BYTE byHWKeyNum;
- EPPHWKeyInfo stEPPHWKeyInfo[ONE_LOGICKEY_MAX_HWKEY_COUNT];
- BYTE byEnKeyID;
- BYTE byKCVType;
- BYTE byKCVLen; //非必要信息
- BYTE byKCVValue[16]; //非必要信息
- BYTE byKeyValue[48]; //非必要信息
- BYTE byReseve[512];
- } EPPLogicKeyInfo, *LPEPPLogicKeyInfo;
- typedef struct tag_EPPKeyMap
- {
- BYTE byLogicKeyNum;
- EPPLogicKeyInfo stEPPLogicKeyInfo[MAX_LOGICKEY_COUNT];
- BYTE byHOSTRandomLen;
- BYTE byHOSTRandomValue[32];
- BYTE byReserve[1925];
- } EPPKeyMap, *LPEPPKeyMap;
- typedef struct tag_RSAHWKeyInfo
- {
- WORD wID;
- WORD wAttributes;
- BYTE byReserve[64];
- }RSAHWKeyInfo, *LPRSAHWKeyInfo;
- typedef struct tag_RSAKeyInfo
- {
- BYTE byID;
- BYTE byKeyLen;
- CHAR szKeyName[MAX_KEY_NAME_LEN];
- DWORD dwUse;
- BYTE byHWKeyNum;
- RSAHWKeyInfo stRSAHWKeyInfo[RSA_ONE_LOGICKEY_MAX_HWKEY_COUNT];
- BYTE bySigKeyID;
- BYTE byKCVType;
- BYTE byKCVLen;
- BYTE byKCVValue[32];
- BYTE byReseve[512];
- }RSAKeyInfo, *LPRSAKeyInfo;
- typedef struct tag_RSAKeyMap
- {
- BYTE byRSAKeyNum;
- RSAKeyInfo stRSAKeyInfo[RSA_MAX_LOGICKEY_COUNT];
- BYTE byReserve[1024];
- }RSAKeyMap, *LPRSAKeyMap;
- #pragma pack(pop)
|