FONGWAH E7 User Manual

Secret key ic card reader

Advertisement

E7 Secret Key IC card Reader

User Manual

SHENZHEN FONGWAH TECHNOLOGY CO.,LTD
Address:The 3rd floor , Dakan industrial Road 1 14A# , Xili Town,
Nanshan District , Shenzhen, Guangdong , China .
Zip Code: 518000
Tel: (086-755) 26923337
Fax: (086-755) 26922227
E-mail:market@fongwah.com
URL: http://www.fongwah.com
1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the E7 and is the answer not in the manual?

Questions and answers

Summary of Contents for FONGWAH E7

  • Page 1: E7 Secret Key Ic Card Reader

    E7 Secret Key IC card Reader User Manual SHENZHEN FONGWAH TECHNOLOGY CO.,LTD Address:The 3rd floor , Dakan industrial Road 1 14A# , Xili Town, Nanshan District , Shenzhen, Guangdong , China . Zip Code: 518000 Tel: (086-755) 26923337 Fax: (086-755) 26922227 E-mail:market@fongwah.com...
  • Page 2: Table Of Contents

    Contents E7 Secret Key IC card Reader................1 User Manual........................1 E7 IC Card Reader Introduction................4 1.1 Overview........................... 4 1.2 Features..........................4 1.3 Device Interface........................4 1.4 Peader Packing List......................6 1.5 Software..........................6 1.6 Reader Type Description....................7 1.7 Function Instruction......................7 1.8 API Function List........................
  • Page 3 4.Appendix....................... 68 4.1 Table 1(Mifare Plus card personalized structure)..........68...
  • Page 4: E7 Ic Card Reader Introduction

    And E7 smart IC Reader supports USB interface that meets HID protocol. In order to improve safety factor, users can configurate a standard SAM card that meets ISO 7816-3 and GSM11.11 protocol in the device.
  • Page 6: Peader Packing List

    1.4 Peader Packing List Contains:Reader,Communication cable and Warranty Card 1.5 Software Contains:Demo Program,Lib of Function and Application Examples a. Demo Program E7.exe...
  • Page 7: Reader Type Description

    b. Lib of Function E7umf.dll c. Application Examples There are some examples supported for various of development platform(such as VC,Java etc) under the directory of SDK. 1.6 Reader Type Description 1.7 Function Instruction Function call should follow the following rules: (1)Call function fw_init() first to initial Serial Interface or USB interface.
  • Page 8: Api Function List

    verifying the password. Each time you do these operations of card, you should repeat the stpes (3), (4) . (6)Afer operation with certain card,the function fw_halt() should be called to abort operation. (7)Before exit program,the function fw_exit had better be called to close communication port. (8)Please refer to the examples under SDK directory to develop your program.
  • Page 9: Keyboard Specific Functions

    fw_lcd_dispstr_ex LCD display string (extension function) fw_lcd_dispclear Keyboard Specific Functions Function Name Description fw_PassIn Enter the status of getting keyboard password , only to receive fw_PassGet and fw_PassCancel command after that fw_PassGet Inquiry and get input passwoard fw_PassCancel Cancel the status of getting keyboard password,the device return to normal state after that fw_CheckKeyValue Inquiry the key value...
  • Page 10: S70 Card Specific Function

    fw_initval Initialize the value of block fw_increment Do increment fw_decrement Do decrement fw_readval Read value fw_restore Store the data from the EEPROM to card’s internal register fw_transfer Transfer the data from card to EEPROM S70 card specific function Function Name Description fw_read_S70 Read S70 card...
  • Page 11: Mifare Pro Card Specific Function

    Mifare pro card specific function Function Name Description fw_reset_mifarepro Reset Mifare Pro card fw_apdu_mifarepro Information transfer between Mifare Pro card and APDU Mifare PLUS card specific function Function Name Description fw_MFPlusL0_WritePerso Personalized setting fw_MFPlusL0_CommitPerso Submit personalized setting,then upgrade to level 1 fw_MFPlusL1_AuthenKeyL1 Verify the secret key of the level 1 fw_MFPlusL1_SwitchToL2...
  • Page 12: Desfire Card Specific Function

    fw_pro_commandlink Information exchange function Desfire card specific function Function Name Description fw_anticoll2 The second anti-collision fw_select2 The second finding card fw_reset_desfire Reset card fw_authen_desfire Verify secret key fw_getver_desfire Get the related data of the card fw_getAIDs_desfire Get application identifier fw_selectApp_desfire Select application fw_getKeySetting_desfire Get the setting information of the master secret key...
  • Page 13: Cpu(Sam) Card Specific Functions

    fw_debit_desfire Decrement fw_writeRecord_desfire Write record fw_readRecord_desfire Read record fw_clearRecord_desfire Clear record fw_commitTransfer_desfire Commit data transmission fw_abortTransfer_desfire Abort data transmission fw_formatPICC_desfire Format card CPU(SAM) card specific functions Function Name Description fw_cpureset Power-on reset fw_setcpu Set SAM card or CPU card slots for operation fw_cpuapdu Information transfer between CPU and APDU 4442 card-specific functions...
  • Page 14: Error Codes And Meanings

    fw_getProtectData_4428 Get protected data fw_setProtectData_4428 Set protected data fw_changkey_4428 Change key of 4428 card fw_cntReadError_4428 Read counts of Error-Code 1.9 Error codes and Meanings Error Return Values Positive/Negative Meanings 0x20(032) Communication handler error 0x72(114) Don’t support this function 0x7D(125) Parameter invalid 0x95(149) Port is occupied 0x8F(143)
  • Page 15: Api Function

    0x1b(027) Module communication timeout 0x3c(060) Non-normal operation 0x64(100) Wrong data 0x7c(124) Parameter error 2. API Function Common Functions int fw_init(int port,long baud); Description: Initialize the communication port. Parameters: port:COM Type.Serial port 1~100 when set value 0~99. USB port when set value 100(baud rate invalid in this case).
  • Page 16 __int16 fw_config_card(HANDLE icdev,unsigned char flags); Description Configure the card type. Parameters icdev:Value of Device Handle. flags:Card type for operation(0x41=TYPEA,0x42=TYPEB,0x31=ISO15693) Return Value 0 if successful; otherwise, Nonzero. Example int st; st=fw_config_card(icdev,1); __int16 a_hex(unsigned char *a,unsigned char *hex,__int16 len) Description String conversion function, hexadecimal characters convert into ordinary characters (long to short).
  • Page 17: Device Functions

    int fw_des(unsigned char *key,unsigned char *sour,unsigned char *dest,__int16 m) Description Encrypt or Decrypt with DES algorithm Parameters key:secret key sour:source of data for encrypt/decrypt dest:out data after encrypt/decrypt m:model of encrypt/decrypt,encrypt when m=1;decrypt when m=0 Return Value 0 if successful; otherwise, Nonzero. Example:...
  • Page 18 Return Value 0 if successful; otherwise, Nonzero. Example unsigned char buff[512]; fw_getver(icdev,buff); int fw_GetDevSN(int icdev,unsinged char *bufSN, int* snSize); Description Get serial number of device Parameters icdev:Value of Device Handle. buff:[out]string of serial number(end with ’\0’) snSize:[out] string length Return Value 0 if successful;...
  • Page 19 unsigned char buffer[100]; st=fw_srd_eeprom(icdev,0,100,buffer); int fw_swr_eeprom(int icdev,int offset,int length,unsigned char* buffer); Description Write remark information to Reader Parameters icdev:Value of Device Handle. offset:Offset address(0~1278) length:Length of information to write(1~1279) buffer:Information to write Return Value 0 if successful; otherwise, Nonzero. __int16 fw_reset(HANDLE icdev,unsigned __int16 _Msec) Description Reset the MCM(MIFARE read/write device core module) Parameters...
  • Page 20: Keyboard Special Functions

    Example char* sendchs=”abcdefgh”; st=fw_lcd_dispstr(icdev,sendchs); //display abcdefgh int fw_lcd_dispstr_ex(int icdev,wchar_t *str,int line, int offset, int len, int flag) Description Set LCD display string Parameters icdev:Value of Device Handle. str :The string to display line: 1 or 2, show at line 1 or 2 offset: Value from 0 to 8 len: Size of string to show(in bytes) flag: 0, show as bytes;...
  • Page 21: S50(M1)Functions

    Query and get the input password Parameter: icdev :Value of device handle rlen :The length of returned data cpass :The input password Return: type = 0x0,succeed to get password, rlen = the length of password( 1-8, according to the user’s input),cpass is password type =...
  • Page 22 Parameters icdev:Value of Device Handle. _Mode: Model of find card. Value: 0——IDLE mode,can operate one card once; 1——ALL mode,can operate serval card once; _Snr:returned Card serial number. Return Value 0 if successful; otherwise, Nonzero. Example int st; unsigned long snr; st=fw_card(icdev,0,&snr);...
  • Page 23 Value: 0——IDLE mode,can operate one card once; 1——ALL mode,can operate serval card once; strSnr: the decimal string card number returned (10 digit sequence) Return Value 0 if successful; otherwise, Nonzero. Example int st; unsigned char snr[11]={0}; st=fw_card_str(icdev,1,snr); int fw_request(int icdev,unsigned char _Mode,unsigned int *TagType); Description Find card request.
  • Page 24 Example int st; unsigned long snr; st=fw_anticoll(icdev,0,&snr); Remark This function shoud be called immediately after the function fw_request unless we have know the card serial number. int fw_select(int icdev,unsigned long _Snr,unsigned char *_Size); Description Select one card with specified serial number from several cards Parameters icdev:Value of Device Handle.
  • Page 25 Example //key A and key B unsigned char password[7]={0xa0,0xa1,0xa2,0xa3,0xa4,0xa5}; /*Load section 1 key with 0 model */ if((fw_load_key(icdev,0,1,password))!=0) printf("Load key error!"); fw_exit(icdev); int fw_authentication(int icdev,unsigned char _Mode,unsigned char _SecNr) Description Verify Key. Parameters icdev:Value of Device Handle. _Mode:The mode of loading key Value are as follows: For each sector of M1 card, there are three sets of corresponding password (KEYSET0, KEYSET1, KEYSET2) in the reader, each password include A password (KEYA)
  • Page 26 (KEYSET0, KEYSET1, KEYSET2) in the reader, each password include A password (KEYA) and B password (KEYB), a total of six passwords, use 0~2,4 ~ 6 to represent the six Password: 0 - KEYSET0 of KEYA ` 1 - KEYSET1 of KEYA 2 - KEYSET2 of KEYA 4 - KEYSET0 of KEYB 5 - KEYSET1 of KEYB...
  • Page 27 "31323334353637383930616263646566." The same below. int fw_write(int icdev,unsingned char _Adr,unsigned char *_Data); Description Write data to card. For M1 card :Write one block data(16 bytes) once. For ML card :Write one page data(4 bytes)once Parameters icdev:Value of Device Handle. _Adr:M1 Card——Address of block M1(0~63),MS70(0-255); _Data:data for write Return Value 0 if successful;...
  • Page 28 number >31) Parameters icdev:Value of Device Handle. _SecNr:Section number(M1:0~15,M1S70:0-39) _KeyA:Key A _CtrlW:Control Word of key _Bk:Set value 0 _KeyB:Key B Return Value 0 if successful; otherwise, Nonzero. Example int st; unsigned char keya; unsigned char keyb; unsigned char ctrlword={0xff,0x07,0x80,0x69}; memset(keya,0xff,6); memset(keyb,0xff,6);...
  • Page 29 Example int st; unsigned long value; value=10; st=fw_increment(icdev,1,value); /*Increment 10 to the value of block 1*/ st=fw_transfer(icdev,1); Remark After call this function,the function fw_transfer should be called immediately, otherwise,the value will not be updated. fw_readval(int icdev,unsigned char _Adr,unsigned long *_Value); Description Read value of certain block.
  • Page 30: S70 Card Specific Function

    Return function, transfer the contents of EEPROM to the card's internal registers Parameters icdev:Value of Device Handle. _Adr: Block address used to transfer. Return Value 0 if successful; otherwise, Nonzero. Example int st; st=fw_restore(icdev,1); Remark Use this function transfers the contents from one block of card to the internal register.and then use the function fw_transfer() transfers the contents from internal register to the other block of card.
  • Page 31: Ultralight Card Specific Function

    0 if successful; otherwise, nonzero. Example int st; unsigned char data [16]; St=fw_read_S70 (icdev, 100, data); //read block 100 of S70 card int fw_write_S70 (int icdev, unsigned char _Adr, unsigned char *_Data); Description Write S70 card, only can write one block once, 16 bytes. Parameters icdev: Value of Device Handle.
  • Page 32 st= fw_anticall_ultralt (icdev, &nCard); int fw_select_ultralt (int icdev, unsigned long _Snr); Description Select certain Card from several Ultralight cards. Parameters icdev: Value of Device Handle. _ Snr: Card serial number. Return Value 0 if successful; otherwise, Nonzero. Example int st; st= fw_select_ultralt (icdev, nCard);...
  • Page 33: Ultralight-Ccard Specific Function

    int fw_halt_ultralt(int icdev); Description Abort operation with ultralight card. Parameters icdev: Value of Device Handle. Return Value 0 if successful; otherwise, Nonzero. Example int st; st= fw_halt_ultralt(icdev); Remark When you finish calling this functionl,you should call the below functions before read data next time: fw_request_ultralt first, fw_anticall_ultralt second and fw_select_ultralt finally.
  • Page 34: Mifare Pro Card Specific Function

    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; unsigned char pnewkey[17] = {0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f}; st= fw_ultralt_C_authen (icdev, poldkey,pnewkey); int fw_ultralt_C_setSafePage(int icdev, int ipage, BOOL readSec); Description: Set secure page Parameters: icdev:handle of the device ipage:the old password(16 bytes) readSec:read permission,if need to verify password before reading, 1,need; 0,no need Return:...
  • Page 35: Contactless Cpu Card(Iso1443) Specific Functions

    icdev: Value of Device Handle. rlen: Length of reset information rbuff: buff for returned reset Information Return Value 0 if successful; otherwise, Nonzero. Example int st; int relen; unsigned char rebuff[255]={0}; st= fw_reset_mifarepro(icdev,&relen,rebuff); int fw_apdu_mifarepro(int icdev,unsigned char slen,unsigned char * sbuff, unsigned char *rlen,unsigned char * rbuff);...
  • Page 36: Desfirecard Specific Function

    __int16 st; unsigned char len; Unsigned char revbuf[20]={0}; st= fw_pro_reset(icdev,&len,revbuf); Remark: You should call function “fw_card” once first before this function is called. __int16 fw_pro_commandlink(int ICDev,unsigned char slen,unsigned char * sbuff,unsigned char *rlen,unsigned char * rbuff,unsigned char tt,unsigned char FG); Description APDU data exchange function Parameters...
  • Page 37 int st; unsigned long snr2; st= fw_anticoll2 (icdev,0,&snr2); int fw_select2(int icdev,unsigned long _Snr); int fw_select2(int icdev,unsigned long _Snr); Description The second time to select a card Parameters icdev: Value of Device Handle. _Snr: card serial number gotten by the second Anti-collision Return Value 0 if successful;...
  • Page 38 int st; char curkey[17]={0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x11,0x22,0x33,0x44, 0x55,0x66,0x77,0x88}; unsigned char sessionkey[50]; st= fw_authen_desfire(icdev,1,curkey,sessionkey); int fw_getver_desfire(int icdev,unsigned char* rlen,unsigned char* version); Description Get version of DESFIRE Parameters icdev: Value of Device Handle. rlen: length of returned data version: returned card manufacturer data Return Value 0 if successful;...
  • Page 39 int st; unsigned char aid[4]={0x01,0x00,0x00}; st= fw_selectApp_desfire(icdev,aid); fw_getKeySetting_desfire(int icdev,unsigned char* rlen,unsigned char* setbuf); Description Get the master key settings Parameters icdev: Value of Device Handle. Rlen: the length of returned data Setbuf: set the master of key (card) application Return Value 0 if successful;...
  • Page 40 Bit3 Rights Rights Rights list master Bit2 Bit1 Bit0 access NumOfKey: the number of keys Return Value 0 if successful; otherwise, Nonzero. Reference Table 1.11 Example int st; unsigned char aid[4]={0x02,0x00,0x00}; unsigned char setting=0xef; st= fw_createApp_desfire(icdev,aid,setting,0x0e);/* With 14 keys */ int fw_delAID_desfire(int icdev,unsigned char* AID);...
  • Page 41 create/delete director changeable change Withiout PICC y list master master Key access without PICC master Each bit of Card-level key settings represents the meaning as follows: Bit7-Bit4: reserved, must be set to 0. Bit3: Code which determines whether it allows changing the master key settings: 0: configuration can not be changed no longer (frozen).
  • Page 42 Description Change the master key Parameters icdev: Value of Device Handle. sessionKey: session key curkey: the current key keyNo: key number newkey: new key Return Value 0 if successful; otherwise, Nonzero. Reference Table 1.11 Example int st; unsigned char currentkey[17]={0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x11,0x22,0x33,0x44,0x5 5,0x66,0x77,0x88};...
  • Page 43 0 if successful; otherwise, Nonzero. Reference Table 1.11 Example int st; unsigned char revlen; unsigned char fileset[20]; st= fw_getFileProper (icdev,&revlen,fileset); int fw_changeFileSetting(int icdev,unsigned char fileNo,unsigned char comSet,unsigned char* accessRight,char* sessionKey); Description Change the file settings Parameters icdev: Value of Device Handle. fileNo: File ID comSet: data transmission form: 0: transmission in the clear,...
  • Page 44 accessRight: Access right accessRight [0]:Low nibble has the right to modify access permissions High nibble has the right to read / write the file accessRight [1]:Low nibble has the access to write to the file High nibble has the access to read the file FileSize: File Size Return Value 0 if successful;...
  • Page 45 unsigned char upper[4]={0xff,0xff,0xff,0x00};// Maximum is 0xffffff unsigned char value[4]={0x32,0x00,0x00,0x00};// Current value is set to 50 (0x32) unsigned char enable=0x01;// Support limited memory st=fw_createValueFile_desfire(icdev,0x02,comSetting,accessRights,lower,uppe r,value,enabled); createCsyRecord_desfire(int icdev,unsigned char fileNo,unsigned charcomSet,unsignedchar*AccessRight,unsignedchar* RecordSize,unsigned char* MaxNum); Description Create cycle record file Parameters icdev: Value of Device Handle. fileNo: File ID comSet: data transmission form: 0: Express transmission,...
  • Page 46 int st; st= fw_delFile_desfire(icdev,0x03); int fw_write_desfire(int icdev,unsigned char fileNo,unsigned int offset,unsigned int length,unsigned char* data,char* sessionKey); Description Write data file Parameters icdev: Value of Device Handle. fileNo: File ID offset: offset address length: length of data to write data: data to be written, sessionKey: session key Return Value 0 if successful;...
  • Page 47 icdev: Value of Device Handle. fileNo: File ID value: the gotten value sessionKey: session key Return Value 0 if successful; otherwise, Nonzero. Reference Table 1.11 Example int st; unsigned int value; st= fw_getvalue_desfire (icdev,0x02,&value,sesskey); / *sesskey means the session key obtained by verifying key */ int fw_credit_desfire(int icdev,unsigned char fileNo,unsigned int value,char*sessionKey);...
  • Page 48 st= fw_debit_desfire (icdev,0x02,value,sesskey);/ *sesskey means the session key obtained by verifying key */ Remark After this function called successfully, you should also call the function fw_commitTransfer_desfire to make the operation into effect. int fw_writeRecord_desfire(int icdev,unsigned char fileNo,unsigned int offset,unsigned int length,unsigned char* data,char* sessionKey); Description Wite one record to record file Parameters...
  • Page 49 Example int st; unsigned char data[1000]; unsigned int sglen; unsigned int revlen; st= fw_readRecord_desfire (icdev,0x03,0,1,data,&sglen,&revlen,sesskey); / *sesskey means the session key obtained by verifying key */ Remark: If the length and offset are set to 0, all the records will be read out. int fw_clearRecord_desfire(int icdev,unsigned char fileNo);...
  • Page 50: Mifare Plus Card Specific Function

    st= fw_abortTransfer_desfire (icdev); int fw_formatPICC_desfire(int icdev); Description Format card Parameters icdev: Value of Device Handle. Return Value 0 if successful; otherwise, Nonzero. Reference Table 1.11 Example int st; st= fw_formatPICC_desfire (icdev); Remark After Calling this function successfully, all data in the card will be cleared. 2.11 Mifare Plus card specific function fw_MFPlusL0_WritePerso(int ihic, unsigned char* key, unsigned short keyAddr);...
  • Page 51 st= fw_MFPlusL0_CommitPerso(icdev,maskKey,0x9000); Remark: After submitting successfully,the card automatically upgrade to level 1 from level 0. int fw_MFPlusL1_AuthenKeyL1(int ihic,unsigned char* key); Description: Verify one-level secret key for one-level card Parameters: ihic: value of device handle key: one-level secret key Return: 0 if successful; otherwise, Nonzero. Example:...
  • Page 52 keyL3[16]={0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xd d,0x90,0x03}; st= fw_MFPlusL1_SwitchToL3(icdev,keyL3); int fw_MFPlusL2_SwitchToL3(int ihic,unsigned char* key); Description: Verify three-level secret key for two-level card and upgrade to three-level Parameters: ihic: value of device handle key: three-level secret key for upgrading Return: 0 if successful; otherwise, Nonzero. Example: int st;...
  • Page 53 Return: 0 if successful; otherwise, Nonzero. Example: int st; unsigned char key[16]={0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd, 0x40,0x02}; st= fw_MFPlusL3_AuthenSectorKey(icdev,1,1,key);//Verify KeyA password of 1 sector int fw_MFPlusL3_UpdateKey(int ihic, unsigned int keyAddr,unsigned char* newKey); Description: Update secret key of the three-level card Parameters: ihic: value of device handle keyAddr: the corresponding clock number of secret key or data,reference to appendix I newKey: new secret key...
  • Page 54 Description: Write the block data of the three-level card in the clear Parameters: ihic: handle of device blkAddr: the starting block NO blkNum: the number of clock to write(Usually 1~3) wdata: the data to write Return: 0 if successful; otherwise, Nonzero. Example:...
  • Page 55 flag: sign,0—data can be writed after encryption 1—data has been encrypted. Return: 0 if successful; otherwise, Nonzero. Example: int st; unsigned char writeData[256]= {0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x4 4,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x 55,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0 x66}; st= fw_MFPlusL3_WriteWithEncrypt(icdev,4, 3,writeData,0); int fw_MFPlusL3_InitVal(int ihic, unsigned int blkAddr,unsigned long value); Description: Initialize the block to value block for the three-level card Parameters:...
  • Page 56: Cpu(Sam)Functions

    int fw_MFPlusL3_Decrement(int ihic, unsigned int blkAddr,unsigned long value); Description: Reduce the value of the value block for the three-level card(consume) Parameters: ihic: handle of device blkAddr: the block NO. value: the reduced value Example: int st; st= fw_MFPlusL3_Decrement(icdev,4, 5); 2.12 CPU(SAM)Functions __int16 fw_cpureset (HANDLE ICDev, unsigned char *rlen, unsigned char *rbuff) Description Power-on reset function of CPU Card, it will automatically judge card protocol...
  • Page 57 Description Information transfer between CPU Card and APDU(Application Protocol Data Unit) , This function encapsulates the T = 0 and T = 1 operation Parameters ICDev: Handle of Reader Device slen: Length of information for send sbuff: Information buffer for send rlen: Length of information received rbuff: [out] buff for returned Information Return Value...
  • Page 58 Rlen: [out] Length of returned reset information Rbuff: store returned reset information Return Value <0 error, its absolute value is error number successful Example unsigned char rlen; unsigned char DataBuffer [100]; St=fw_cpureset (ICDev, &rlen, DataBuffer); __int16 fw_setcpu (HANDLE ICDev, unsigned char SAMID) Description Set SAM Card deck for operation Parameters...
  • Page 59: Sle4442 Special Functions

    2.13 SLE4442 special Functions int fw_read_4442(int icdev,unsigned char _Adr,unsigned char *_Data,int length); Description Read data from 4442 card. Parameters icdev:Value of Device Handle. _Adr: Start address for reading(0~255) _Data: Data returned. length: Length of Data to read(0~255) Return Value 0 if successful; otherwise, Nonzero. Example // Read 20 chars start from address:0 int st;...
  • Page 60 icdev:Value of Device Handle. _Adr: Starting address for Reading(must set 0) _Data: returned Protect bits. length: Length of data to read(must set 4) Return Value 0 if successful; otherwise, Nonzero. Example int st; unsigned char rbuf[4]={0}; st=fw_getProtectData_4442(icdev,0, rbuf,4); Remark 4442 card has 32 bytes of protection data, the address is x00-0x20, 4-byte read out correspond to each of a corresponding bit, 0 for write protection, 1 for not write-protection;...
  • Page 61: Sle4428 Special Functions

    Example unsigned char keybuffer[3]={0xff,0xff,0xff}; if(fw_authentikey_4442(icdev,0,3,keybuffer)!=0) printf(“Authentication error”); Remark Card will be locked if this function returns failure for three times continuously. int fw_changkey_4442(int icdev,unsigned char _Adr,int rlen,unsigned char *key); Description Update Key of card. Parameters icdev: Value of Device Handle. _Adr: Starting address of key-data (must set 0).
  • Page 62 icdev: Value of Device Handle. _Adr: The starting address to read _Data: Returned data length: length of returned data Return Value 0 if successful; otherwise, Nonzero. Example //to read 20 bytes starting from address 0 int st; unsigned char rbuf[300]={0}; st= fw_read_4428(icdev,0,rbuf,20);...
  • Page 63 Example int st; unsigned char rbuf[4]={0}; st=fw_getProtectData_4428(icdev,0, rbuf,4); int fw_setProtectData_4428(int icdev,unsigned int _Adr,unsigned char *_Data,int length); Description write protected bits Parameters icdev: Value of Device Handle. _Adr: The starting address of written data _Data: data to be written length: the length of written data Return Value 0 if successful;...
  • Page 64: 3.Mifare One Card Structure

    Parameters icdev: Value of Device Handle. Key : key to be changed(2 bytes) Return Value 0 if successful; otherwise, Nonzero. Example unsigned char keybuffer[2]={0x00,0x00}; if(fw_changkey_4428(icdev,keybuffer)!=0) printf(“Change key error”); int fw_cntReadError_4428(int icdev,unsigned char *cntReadError); Description Get the count of read-error Parameters icdev: Value of Device Handle.
  • Page 65 Communication Rate: 106KBPS Operating distance: 10mm or less (depending on the reader) Data retention period is 10 years, can be rewritten 100,000 times, unlimited read times Storage structure: M1 card is divided into 16 sectors, each sector has 4 blocks (block 0~3), a total of 64 blocks, addressable by block number from 0 to 63.
  • Page 66 Manufacturer Block(IC card manufacturer code block): the first block of t he first sector is used by the manufacturers, stored the IC card manufacturer code, the data of this block can not be changed after written Philips’ Manufacturer code serial number Manufacturer data Checksum byte Data Block : the first three blocks of all sectors are used to...
  • Page 67 Three control bits exists in the access control byte by positive or negative form, determines access rights to the block (such as impairment operation must verify KEY A, for value-added operations must verify KEY B, etc). the position of three control bits in the access control byte as follows (byte 9 is spare byte, default is 0x69): A0 A1 A2 A3 A4 A5 FF 07 80 69...
  • Page 68 2.The data block (block 0, block 1, block 2) the access control are as follows: (KeyA|B means key A or key B, Never means that can not be realized under any conditions) Control Control condition(block 0,1,2) (X=0..2) Read Write Increment Decrement, transfer, Restore...
  • Page 69 Example:the corresponding address of the second sector KeyA is 4004 AES sector key 4040h ~ 404Fh AESsector key 0~31sector, The second byte defines the sector NO.and KeyA/KeyB KeyA = 2* Sector KeyB = 2* Sector + 1 A special secret key 8000 It is determined by the manufacturer and can not be change...

Table of Contents