background image

 

24

3.15 

F_RD_BIN   

This function is used to read a continuous block of bytes in a transparent EF. When secure 

messaging is used the function dose not accept the Read command of length greater than the 

communication buffer size(64 bytes). 

 

Compatible with ISO7816 or Gemplus command set 

 

 

IS7816    if class = normal 

 

 

Genplus  if class = secure 

 

Function call 

void F_RD_BIN( S_RD_BIN* ); 

 

Data structure of S_RD_BIN 

typedef struct 

int Class; 

int Mode; 

unsigned char ShortId; 

int Offset; 

int RbLenIn; 

 

int IdOk; 

unsigned char Sw12[2]; 

unsigned char Response[MaxDATA]; 

int RespLen; 

unsigned char CRYin[3]; 

unsigned char CRYout[3]; 

} S_RD_BIN; 

   

Input parameter : 

     

Class 

 

; 0=NORMAL  

 

1=SECURE 

     Mode   

:0=direct select       

1=implicit select 

     ShortId   

:short EF identifier, This is needed if Mode=1. 

     Offset        :0000-7FFF if Mode=0, 00-FF if Mode=1. 

     RbLenIn      :00-7F,data length to be read. 

   Output parameter :

.

 

IdOk       : 0 = OK   

 

1 = Timeout   

2 = No card 

; 3 = EDC error 

5 = Parity error 

7 = see SW1-SW2 

Sw12[]     :SW1-SW2 

Response[]   :storage for output data 

RespLen     :length of out data 

CRYin[]     :Reserve 

       

CRYout[]    :CRYcks 7,6,5 only for secure message 

Summary of Contents for MR350 MKII

Page 1: ...MR350MKII Data Collection Terminal Smart card reader programming Manual Unitech Electronics Co Ltd April 1999...

Page 2: ...on encryption and accessing creating and verifying different file structure If user is skillful for Smart Card reader program he can skip our function library and directly use MR350MKII s system funct...

Page 3: ...Smart Card 3 Function library 3 1 GEMSmart Card LIB C source code 3 2 GEMSmart Card OBJ object file 3 3 Smart CardINCL h C include file 3 4 MAKE BAT batch file for compile and link user s application...

Page 4: ...mart Card 9 2 2 Power on Smart Card 10 2 3 Power off Smart Card 11 2 4 Exchange message 11 Chapter 3 Function library 12 3 1 Files description of Smart Card function library 12 3 2 How to build up app...

Page 5: ...5 3 18 F_SEL_ID 27 3 19 F_SET_FKEY 28 3 20 F_SET_SC 29 3 21 F_UPD_BIN 30 3 22 F_UPD_REC 31 3 23 F_VERIFY 32 3 24 F_WR_BIN 33...

Page 6: ...o provide a design reference Unitech develops an Smart Card library to provide all MPCOS EMV command set so user can directly use those function libraries to develop their application program without...

Page 7: ...card other function library follow ISO 7816 standard In this diagram F W means MR350MKII system function call Check Smart Card Power on Smart Card Power off Smart Card Exchange APDU AH 3 Check Smart...

Page 8: ...ard reader to provide power to Smart Card Step 3 After Smart Card are inserted into reader and reader feeds VCC to this card application can access this card by system function call or function librar...

Page 9: ...s are implemented on system interrupt vector 06H INT 06H 3 1 Check Smart Card In Smart Card reader there is a detector to check whether Smart Card is inserted After that reader will check whether card...

Page 10: ...f AH 0 CX ATR length 1 Time out 1 Sec RETRY 1 2 No card present 4 Data pin not stable 5 Parity error Below is ATR structure typedef struct int Smart CardType Reserve for Future Use int AtrReady 0 OK 1...

Page 11: ...06H AH 3 SEND COMMAND TO Smart Card DS SI buffer pointer of exchange command buffer output CW length Length of message excahnge buffer ES DI buffer pointer of return message input Return value AH 0 SU...

Page 12: ...le of Smart Card function library GEMSmart Card OBJ Object file of Smart Card function library MAKE BAT Batch file to compile and link user s program 3 2 How to build up application program If user s...

Page 13: ...typedef struct int Class unsigned char ShortId int RecLen unsigned char RecData MaxDATA int IdOk unsigned char Sw12 2 unsigned char CRYin 3 unsigned char CRYout 3 S_APD_REC Input parameter Class 0 NOR...

Page 14: ...re of S_CHK_ICC typedef struct int ChkPower int ChkPresent S_CHK_ICC Input parameter No Output parameter ChkPower currently power stage 0 OFF 1 ON ChkPresent 0 No card present 1 card short 2 card exis...

Page 15: ...f struct int Class unsigned char FileId 2 int Opt int NameLen unsigned char DFName 16 int IdOk unsigned char Sw12 2 unsigned char CRYin 3 unsigned char CRYout 3 S_CRT_DF Input parameter Class 0 NORMAL...

Page 16: ...B int RecLen int BodyLen int IdOk unsigned char Sw12 2 unsigned char CRYin 3 unsigned char CRYout 3 S_CRT_EF Input parameter Class 0 NORMAL 1 SECURE FileId EF identifier FDB File descrirtion byte RecL...

Page 17: ...urn code to text description Compatible with ISO7816 or Gemplus command set Parital Function call void F_ERR_MSG unsigned char p_sw unsigned char msg Input parameter P_sw point to status word Output p...

Page 18: ...PDU int OutLen unsigned char OutApdu MaxAPDU header MAX 255 byte int OutReady int SwOffset S_EX_APDU Input parameter InLen holds the number of APDU byte to send to Smart Card InApdu APDU command to se...

Page 19: ...nt AccNum int Validity int KeyLevel unsigned char KeyId int Sc1Level int Sc1Num int Sc2Level int Sc2Num S_INI_ACC Input parameter AccNum 1 3 for access condition 1 3 Validity 0 unrestricted access 1 S...

Page 20: ...unsigned char KeyValue 16 int IdOk unsigned char Sw12 2 S_LD_KEY Input parameter Class 0 NORMAL 1 SECURE Mode 0 direct select 1 implicit select ShortId short EF identifier This is needed if Mode 1 Key...

Page 21: ...evel int UcrNum unsigned char CodeValue 8 int IdOk unsigned char Sw12 2 S_LD_SC Input parameter Class 0 NORMAL 1 SECURE Mode 0 direct select 1 implicit select ShortId short EFsc identifier This is nee...

Page 22: ...sed to get library version Compatible with ISO7816 or Gemplus command set No Function call void F_LIB_VER int main int extend Input parameter No Output parameter Main store main version of library Ext...

Page 23: ...int Smart CardType int AtrReady int AtrLen unsigned char AtrBuf MaxATR int HistLen int HistOffset S_OPEN_ICC Input parameter Smart CardType Reserve for Future Use Output parameter AtrReady 0 OK 1 Tim...

Page 24: ...s int Mode unsigned char ShortId int Offset int RbLenIn int IdOk unsigned char Sw12 2 unsigned char Response MaxDATA int RespLen unsigned char CRYin 3 unsigned char CRYout 3 S_RD_BIN Input parameter C...

Page 25: ...ass int RecNumber unsigned char ShortId int ExpLen int IdOk unsigned char Sw12 2 unsigned char Response MaxDATA int RespLen unsigned char CRYin 3 unsigned char CRYout 3 S_RD_REC Input parameter Class...

Page 26: ...EL_FKEY typedef struct int KeyNum int KeyLevel unsigned char KeyId unsigned char TerRand 8 int IdOk unsigned char Sw12 2 unsigned char RespRN 8 unsigned char RespR 4 S_SEL_FKEY Input parameter KeyNum...

Page 27: ..._ID S_SEL_ID Data Structure of S_SEL_ID typedef struct int Type unsigned char IdRef 2 int IdOk unsigned char Sw12 2 unsigned char Response 40 85 10 DESCRIPTOR 84 L NAME 36 int RespLen S_SEL_ID Input p...

Page 28: ...lus command set Genplus Function call void F_SET_FKEY S_SEL_FKEY GG unsigned char key Input parameter GG a structure pointer and it is previously returned by function F_SEL_FKEY key point to a specifi...

Page 29: ..._SC Data structure of S_SET_SC typedef struct int Class int Mode int CodeNum unsigned char ChkValue 8 unsigned char NewValue 8 int IdOk unsigned char Sw12 2 S_SET_SC Input parameter Class 0 NORMAL 1 S...

Page 30: ...int UpdateLen unsigned char UpdData MaxDATA int IdOk unsigned char Sw12 2 unsigned char CRYin 3 unsigned char CRYout 3 S_UPD_BIN Input parameter Class 0 NORMAL 1 SECURE Mode 0 direct select 1 implicit...

Page 31: ...int Class int RecNumber unsigned char ShortId int LcLen unsigned char RecData MaxDATA int IdOk unsigned char Sw12 2 unsigned char CRYin 3 unsigned char CRYout 3 S_UPD_REC Input parameter Class 0 NORM...

Page 32: ...Data structure of S_VERIFY typedef struct int Class int ScNumber unsigned char ScValue 9 int IdOk unsigned char Sw12 2 S_VERIFY Input parameter Class 0 NORMAL 1 SECURE ScNumber secret code number from...

Page 33: ...t UpdateLen unsigned char UpdData MaxDATA int IdOk unsigned char Sw12 2 unsigned char CRYin 3 unsigned char CRYout 3 S_UPD_BIN Input parameter Class 0 NORMAL 1 SECURE Mode 0 direct select 1 implicit s...

Reviews: