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.
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.Appendix............................................................................................................... 68 4.1 Table 1(Mifare Plus card personalized structure)..............................................
E7 IC Card Reader Introduction 1.1 Overview E7 password keyboard is the smart IC Card Reader,meet ISO14443A and ISO 7816 standard, support contactless IC card,such as Mifare s50、s70、Utrlight and CPU card,and contact CPU card. E7 smart IC Reader contains LCD display(2 rows)and simple keyboard,,that meet the demand of entering the password or consumption data and displaying the results in the processing of user’s operation. And E7 smart IC Reader supports USB interface that meets HID protocol.
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.
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. (2)Call function fw_load_key() to load key from card to Reader, a section once.
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. 1.
fw_lcd_dispstr_ex LCD display string (extension function) fw_lcd_dispclear LCD 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 S50 card functions Function Name Description fw_ini
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 fw_write_S70 Write S70 card Ultralight card specific function Function Name Description fw_request_ultralt Request of Finding Ultralight card fw_anticall_ultralt Anti-collis
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 Upgrade to level 2 from level 1 fw_MFPlusL1_SwitchToL3
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 fw_getKeyver_desfire Get the ve
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
fw_getProtectData_4428 Get protected data fw_setProtectData_4428 Set protected fw_changkey_4428 Change fw_cntReadError_4428 Read key data of counts 4428 card of Error-Code 1.
0x1b(027) - Module communication timeout 0x3c(060) - Non-normal operation 0x64(100) - Wrong data 0x7c(124) - Parameter error 2. API Function 2.1 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).
__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).
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.
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; otherwise, errorCode.
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.
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; 1, show as wide char Return Value 0 if successful; otherwise, Nonzero.
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 = 0xa1,the length of the password overflow,the maximum is 25 digits type = 0xa2,cancel password inputting ,rlen =0,no data; type = 0xa3,not the status of password inputting,rlen =0,no data; type = 0xa4,not complete the operation of inputting passw
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); Remark 1. In IDLE mode, after read-write operations, we use function fw_halt to end the card operation, only when the card out and re-enter the operating area, the reader can operate it once again. 2.
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. Parameters icdev:Value of Device Handle. _Mode:find card.
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. _Snr:Card serial number. _Size:[out] The size of card capacity. Return Value 0 if successful; otherwise, Nonzero.
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.
(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 6 - KEYSET2 of KEYB Addr:The section number to verify. passbuff: The key to authentication(6 bytes) Return Value 0 if successful; otherwise, Nonzero.
"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; otherwise, Nonzero.
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 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. Parameters icdev:Value of Device Handle.
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.
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. _Adr: Block address (0-255); _Data: data to write Return Value 0 if successful; otherwise, Nonzero.
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); int fw_read_ultralt (int icdev, unsigned char iPage, unsigned char *redata); Description Read data from Ultralight card. Parameters icdev: Value of Device Handle.
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. 2.
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: 0 if successful; otherwise, Nonzero.
icdev: Value of Device Handle. rlen: Length of reset information rbuff: buff for returned reset Information Return Value 0 if successful; otherwise, Nonzero.
__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 icdev: Value of Device Handle.
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; otherwise, Nonzero.
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; otherwise, Nonzero. Reference Table 1.
int st; unsigned char aid[4]={0x01,0x00,0x00}; st= fw_selectApp_desfire(icdev,aid); int fw_getKeySetting_desfire(int icdev,unsigned char* rlen,unsigned 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; otherwise, Nonzero. Reference Table 1.
Bit3 Rights Bit2 Rights Bit1 Rights Bit0 y list access master key 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); Description Delete application Parameters icdev: Value of Device Handle.
changeable create/delete Withiout PICC master Key director y list access without PICC master key 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). 1: you can modify the configuration (the default) after authenticating the card’s master key.
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.
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.
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; otherwise, Nonzero. Reference Table 1.
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); int fw_ createCsyRecord_desfire(int icdev,unsigned char fileNo,unsigned charcomSet,unsignedchar*AccessRight,unsignedchar* RecordSize,unsigned char* MaxNum); Description Create cycle record file Parameters icdev: Valu
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; otherwise, Nonzero. Reference Table 1.
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); Description increment Parameters icdev: Value of Device Handle.
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 icdev: Value of Device Handle.
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); Description clear the data of record file Parameters icdev: Value of Device Handle. fileNo: File ID Return Value 0 if successful; otherwise, Nonzero.
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.
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.
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.
Return: 0 if successful; otherwise, Nonzero.
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.
flag: sign,0—data can be writed after encryption 1—data has been encrypted. Return: 0 if successful; otherwise, Nonzero.
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 after reset.
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 <0 error, its absolute value is error number =0 successful Example int st; unsigned char slen,rlen,senddata[100], recdata[100]; slen=5; senddata[0]=0x00;sen
Rlen: [out] Length of returned reset information Rbuff: store returned reset information Return Value <0 error, its absolute value is error number =0 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 ICDev: Handle of Reader Device SAMID: Sequence Number of Deck type, ox0c: Attached deck; 0x0d: SAM1; 0x0e:SAM2; 0x0f:SAM3; Return Value <0
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; unsigned char rbuf[300]={0}; st= fw_read_4442(icdev,0,rbuf,20); Remarks: 1.
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 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). rlen:Length of key-data for updating(must set 3).
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); remark 1: the value of length should be less than 1024, otherwise reading card will fail.
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; otherwise, Nonzero.
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. cntReadError : the count of read-error Return Value 0 if successful; otherwise, Nonzero.
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. Block 0 of sector 0 (the absolute address 0 block) is used to store Manufacturer code, which has been Solidified, and can not be changed.
15 Manufacturer Block(IC card manufacturer code block): the first block of t he first sector is used by the manufacturers, stored of this block can not be changed the IC card manufacturer code, the data after written MSB X LSB X X X 0 0 1 0 Philips’ Manufacturer code 0 1 2 3 4 5 6 serial number Checksum byte 7 8 9 1 0 Manufacturer 1 1 1 2 13 14 15 data Data Block : the first three blocks of all sectors are used to stor e data (block 0 of sector 0 can only be read, block 1,
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).
2.The data block (block 0, block 1, block 2) (KeyA|B means key A or key B, conditions) Control (X=0..
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.