background image

 

2

Introduction: 

Why this manual 

It is not easy for users to develop their application program according ISO-7816 standard, user 

should know detail command format, computing cryptography .. etc. That is why Unitech 

provide this manual and utility library to help user to develop application program by simple API. 

This utility library also include functions for decryption and encryption. We hope it can speed up 

programmer’s developing time.   

 

Objective of this manual 

This manual introduces MR350MKII’s system function call and function library, user can use 

them to control our Smart Card reader to access GEMPLUS’s PCOS-EMV card. So, our function 

library is compliant to MPCOS-EMV administration command, it includes decryption, 

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 function call to develop their application program. Currently, MR350MKII supports T=0 

and T=1 protocol 

 

Programmer requirement 

Before you use this manual, we presume that you are good at or you have studied below 3 items 

1. C programming   

2. MR350MKII programming 

3. MPCOS-EMV 

 

Main topic of this manual 

1. 

System architecture

 – This chapter helps user to know the relationship between application 

program, function library , system function call and Smart Card. 

2. 

System call

 – This chapter introduces MR350MKII’s system function call for access generic 

Smart Card. 

3. 

Function library

 – This chapter introduces detail of Smart Card function libraries including 

argument, parameter and data structure for ISO7816 standard or MPCOS-EMV card. 

 

Содержание MR350 MKII

Страница 1: ...MR350MKII Data Collection Terminal Smart card reader programming Manual Unitech Electronics Co Ltd April 1999...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Отзывы: