⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pctdef.h

📁 RSA C++源代码DEMO,附加DESMD5等众多算法
💻 H
字号:
/****************************************************************************************\
 *  PCTDEF.H										* 
 *											*
 *      This file defined some basic data type about ICC oriented Programming, it based *
 * Giesecke & Devirent's STARCOS S2.1 and PCCTI 3.3.					*
 *											*
 *  Writen by Alfred Meng								*
 *											*
 *  Oct. 15, 1999									*
 *											*
 *@ident "PCTDEF V1.0"									*
 *											*
\****************************************************************************************/
#ifndef __PCTDEF_H
#define __PCTDEF_H

#define  __PCCTI_DLL_CALL

#include "pccti.h"
#include "ctcomm.h"

typedef struct sResponse TCTResp;
typedef struct sCommand  TCTComm;
typedef struct sCTType   TCTType;
typedef struct sDisplay  TCTDisp;
typedef unsigned char    TAC;
typedef unsigned char    TSM;
typedef unsigned long    TRND;

#define  TSI_NOK  -1
#define  COS_RFU   0

#define  MAXKEYLEN     64

/* operator */
#define  AC_EQ	    0x0 	/* == */
#define  AC_LT	    0x40	/* <  */
#define  AC_GE	    0x80	/* >= */
#define  AC_NEQ	    0xc0	/* != */

/* secure message */
#define  AC_NOSM    0x0
#define  AC_SM	    0x20

/* leve */
#define  AC_MF	    0x0
#define  AC_CUR	    0x10

/* state */
#define  AC_HS	    0x0	      /* highest state */
#define  AC_LS	    0x0f      /* lowest state  */

#define  SM_NO	    0x0	      /* No SM */
#define  SM_AUTH    0x01      /* authentic */
#define  SM_RFU	    0x02
#define  SM_COMB    0x03      /* combined */

/* define operation mode for create */
#define  C_OP_MF	    0x00
#define  C_OP_DF	    0x01
#define  C_OP_EF	    0x03
#define  C_OP_END	    0x02

typedef struct {
    char key[8];
    char mf_space[2];
    char isf_space[2];
    TAC  ac_cre_ef;
    TAC  ac_cre_key;
    TAC  ac_cre_df;
    TAC  ac_reg_df;
    TSM  sm_cr;
    TSM  sm_ef;
    TSM  sm_isf;

} THMF;

#define FIDLEN    2
#define AIDLEN   16

typedef struct {
    char dfid[FIDLEN];
    char aidlen;
    char aid[AIDLEN];
    char isf_space[2];
    TAC  ac_cre_ef;
    TAC  ac_cre_key;
    TSM  sm_cr;
    TSM  sm_isf;
} THDF;


/* file attribute */
#define  INF_UNLOCKED	    0x80    /* unlocked */
#define  INF_SWACTIVE	    0x40    /* secure writing */

/* file type */
#define  INF_TRANSPARENT    0x01    /* transparent */
#define	 INF_LINEAR	    0x02    /* linear fixed */
#define  INF_CYCLIC	    0x04    /* cyclic */
#define  INF_COMPUTE	    0x2C    /* compute */
#define  INF_OBJECT	    0x11    /* object */

typedef struct {
    char efid[FIDLEN];
    TAC  ac_read;
    TAC  ac_write;
    TAC  ac_rfu1;
    TAC  ac_lock;
    TAC  ac_unlock;
    TAC  ac_inc;
    TAC  ac_dec;
    TAC  ac_rfc2;
    TAC  ac_rfu3;
    TSM  sm;
    char sid;     /* 1-32 */
    unsigned char info;
    char desc[2];    /* file length or recnum+reclen */
} THEF;


/* define opereate mode for write key */
#define  K_OP_INSTALL	0x00
#define  K_OP_UPDATE    0x01

/* key recod constant define */
#define  KH_TAG		0xc1
#define  KH_LEN		0x0c

typedef struct {
    unsigned char tag;
    unsigned char len;

    unsigned char kid;
    unsigned char klen[2];
    unsigned char acv[2];
    TAC  ac_write;
    unsigned char kfpc;
    TSM  sm;
    unsigned char rfu;
    unsigned char akd;
    unsigned char info;
    unsigned char attr;
} TKHeader;

#define MAXKLEN    8

typedef struct {
	unsigned char tag;
    unsigned char len;

    unsigned char kid;
    unsigned char offset[2];
    unsigned char key[MAXKLEN];
} TKBody;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -