background image

 

ACR1281U-C8 – Application Programming Interface

 

[email protected] 

Version 1.00 

www.acs.com.hk 

Page 29 of 52

 

 

 

5.0. Card Commands for Mifare® 1K/4K Cards 

5.1.  ACR120_Login 

Performs an authentication to access one sector of the card. Only one sector can be accessed at a 

time. 

 
High Level API

DLLAPI INT16 AC_DECL 

ACR120_Login(  INT16   hReader, 

UINT8 Sector, 

UINT8 KeyType, 

          INT8    StoredNo, 

UINT8 pKey[6]); 

 

Parameters 

Description 

hReader 

Handle to the reader returned by AC_Open() 

Sector 

Sector number to login 

KeyType 

Type of key. It can be: 
AC_MIFARE_LOGIN_KEYTYPE_A, 
AC_MIFARE_LOGIN_KEYTYPE_B, 
AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_A, 
AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_B, 
AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_F, 
AC_MIFARE_LOGIN_KEYTYPE_STORED_A and 
AC_MIFARE_LOGIN_KEYTYPE_STORED_B 

StoredNo 

The stored number of key if keyType = 

AC_MIFARE_LOGIN_KEYTYPE_STORED_A or 

AC_MIFARE_LOGIN_KEYTYPE_STORED_B. 

pKey 

The login key if keyType = 

AC_MIFARE_LOGIN_KEYTYPE_A or 

AC_MIFARE_LOGIN_KEYTYPE_B. It’s 

AC_MIFARE_KEY_LEN(6) bytes long. 

Return Value 

INT16 

Result code. 0 means success. 

Table 20

: ACR120_Login Command Description 

 

Summary of Contents for ACR1281U-C8

Page 1: ...Subject to change without prior notice info acs com hk www acs com hk Application Programming Interface V1 00 ACR1281U C8 Contactless Reader Writer...

Page 2: ...eral Card Commands 21 4 1 ACR120_Select 21 4 2 ACR120_ListTags 23 4 3 ACR120_MultiTagSelect 25 4 4 ACR120_TxDataTelegram 27 5 0 Card Commands for Mifare 1K 4K Cards 29 5 1 ACR120_Login 29 5 2 ACR120_R...

Page 3: ...8 Table 14 ACR120_WriteUserPort Command Description 19 Table 15 ACR120_Power Command Description 20 Table 16 ACR120_Select Command Description 21 Table 17 ACR120_LIstTags Command Description 23 Table...

Page 4: ...the serial numbers of all cards in the field Data Storage Performing encrypted read and write operations Ticketing Performing read write increment and decrement operations in an encrypted environment...

Page 5: ...ed mode i e 12 Mbps The USB interface is used for firmware upgrade purpose Pin Signal Function 1 VCC 5V power supply for the reader 2 D Differential signal transmits data between reader and PC 3 D Dif...

Page 6: ...rt Port number Available choices are ACR120_USB1 to ACR120_USB8 Return Value INT16 Handle for further operations Error Code 0 Table 2 ACR120_Open Command Description Low Level Frame Structure Command...

Page 7: ...evel API DLLAPI INT16 AC_DECL ACR120_Close UINT16 hReader Parameters Description hReader Handle to the Reader returned by AC_Open Return Value INT16 0 success Error Code 0 Table 3 ACR120_Close Command...

Page 8: ...meters Description hReader Handle to the Reader returned by AC_Open Return Value INT16 0 success Error Code 0 Table 4 ACR120_Reset Command Description Low Level Frame Structure Command From PC to Read...

Page 9: ...te Command Data Length 1bytes Instruction Code 1 byte Data Length 1 byte E0h 02h 18h 00h Response From Reader to PC 35 Bytes Success or Fail Response Code 1 byte Response Status 2 bytes Response Data...

Page 10: ...1281U C8 Application Programming Interface info acs com hk Version 1 00 www acs com hk Page 10 of 52 Remark 1 For UINT32 CardSupported the LSB is transmitted first e g Byte 0 LSB Byte 1 Byte 2 Byte 3...

Page 11: ...by AC_Open RegNo Register number pValue Mifare register s value Return Value INT16 0 success Error Code 0 Table 6 ACR120_ReadRC531Reg Command Description Low Level Frame Structure Command From PC to...

Page 12: ...register s value to write Return Value INT16 Result code 0 means success Table 7 ACR120_WriteRC531Reg Command Description Low Level Frame Structure Command From PC to Reader 7 bytes Response From Rea...

Page 13: ...t pResponseDataLength K Response data length pResponseData Response Data TimedOut Time Out for waiting the response data ms Return Value INT16 0 success Error Code 0 Table 8 ACR120_DirectSend Command...

Page 14: ...maximum 64 bytes pReceivedDataLength K Data length of the received data pReceivedData Received data TimedOut Time Out for waiting the response data ms Return Value INT16 0 success Error Code 0 Table 9...

Page 15: ...equestDLLVersion UINT8 pVersionInfoLength UINT8 pVersionInfo Parameters Description pVersionInfoLength Returns the length of the DLL version string pVersionInfo Returns the DLL version string Return V...

Page 16: ...RegNo Register number pEEPROMData Contains the EEPROM register s value Return Value INT16 Result code 0 means success Table 11 ACR120_ReadEEPROM Command Description Low Level Frame Structure Command F...

Page 17: ...uccess Table 12 ACR120_WriteEEPROM Command Description Low Level Frame Structure Command From PC to Reader 7 bytes Command Code 1 byte Command Data Length 2 byte Instruction Code 1 byte Data Length 1...

Page 18: ...and bit 6 are used Return Value INT16 Result code 0 means success Table 13 ACR120_ReadUserPort Command Description Low Level Frame Structure Command From PC to Reader 5 bytes Command Code 1 byte Comm...

Page 19: ...code 0 means success Table 14 ACR120_WriteUserPort Command Description Low Level Frame Structure Command From PC to Reader 6 bytes Command Code 1 byte Command Data Length 1 bytes Instruction Code 1 b...

Page 20: ...N 1 Return Value INT16 Result code 0 means success Table 15 ACR120_Power Command Description Low Level Frame Structure Command From PC to Reader 5 bytes Command Code 1 byte Command Data Length 1 bytes...

Page 21: ...Type Contains the selected TAG type pResultTagLength Contains the length of the selected TAG pResultSN If the pResultTagLength 4 or 7 or 10 the pSN contains the selected card ID Serial Number The ID m...

Page 22: ...tion Programming Interface info acs com hk Version 1 00 www acs com hk Page 22 of 52 Or Response From Reader to PC 5 bytes Fail Response Code 1 byte Response Status 2 bytes Response Data Length 2 byes...

Page 23: ...he length of the serial number pSN 4 10 The flat array of serial numbers All serial numbers are concatenated with fixed length 10 bytes Return Value INT16 Result code 0 means success Table 17 ACR120_L...

Page 24: ...hk Page 24 of 52 Response Data Blocks 1 N 1 Mifare Response Data Block N 1 1 byte 1 byte 10 bytes pTagType N 1 pTagLength N 1 pResultSN N 1 Serial Number Or Response From Reader to PC 5 bytes Fail Res...

Page 25: ...agType Contains the selected TAG type pResultTagLength K Contains the length of the serial number of the selected TAG The pResultTagLength may be 4 7 or 10 bytes long pResultSN Serial number of the se...

Page 26: ...tion Programming Interface info acs com hk Version 1 00 www acs com hk Page 26 of 52 Or Response From Reader to PC 5 bytes Fail Respons e Code 1 byte Response Status 2 bytes Response Data Length 2 bye...

Page 27: ...Length N Length of data to be sent pSendData Data to be sent pReceivedDataLength K Length of received data pReceivedData Received data Return Value INT16 Result code 0 means success Table 19 ACR120_Tx...

Page 28: ...tion Programming Interface info acs com hk Version 1 00 www acs com hk Page 28 of 52 Or Response From Reader to PC 5 bytes Fail Response Code 1 byte Response Status 2 bytes Response Data Length 2 byes...

Page 29: ...er returned by AC_Open Sector Sector number to login KeyType Type of key It can be AC_MIFARE_LOGIN_KEYTYPE_A AC_MIFARE_LOGIN_KEYTYPE_B AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_A AC_MIFARE_LOGIN_KEYTYPE_DEFAULT...

Page 30: ...ion Code 1 byte Data Length 1 byte Data 1 byte 1 byte E0h 0004h 02h 02h Sector KeyType2 or StoredNo 10h Used as Key A or StoredNo 30h Used as Key B Response From Reader to PC 5 bytes Success or Fail R...

Page 31: ...ACR1281U C8 Application Programming Interface info acs com hk Version 1 00 www acs com hk Page 31 of 52 AC_MIFARE_LOGIN_KEYTYPE_STORED_B 0xBF KeyType2 0xBB AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_F 0xFF...

Page 32: ...es long Return Value INT16 Result code 0 means success Table 21 ACR120_Read Command Description Low Level Frame Structure Command From PC to Reader 6 bytes Command Code 1 byte Command Data Length 1 by...

Page 33: ...teger Return Value INT16 Result code 0 means success Table 22 ACR120_ReadValue Command Description Low Level Frame Structure Command From PC to Reader 6 bytes Command Code 1 byte Command Data Length 1...

Page 34: ...success Table 23 ACR120_Write Command Description Low Level Frame Structure Command From PC to Reader 22 bytes Command Code 1 byte Command Data Length 1 byte Instruction Code 1 byte Data Length 1 byt...

Page 35: ...success Table 24 ACR120_WriteValue Command Description Low Level Frame Structure Command From PC to Reader 10 bytes Command Code 1 byte Command Data Length 1 byte Instruction Code 1 byte Data Length...

Page 36: ...0 means success Table 25 ACR120_WriteMasterKey Command Description Low Level Frame Structure Command From PC to Reader 12 bytes Command Code 1 byte Command Data length 1 bytes Instruction Code 1 byte...

Page 37: ...e Updated value after increment Return Value INT16 Result code 0 means success Table 26 ACR120_Inc Command Description Low Level Frame Structure Command From PC to Reader 10 bytes Command Code 1 byte...

Page 38: ...alue after decrement Return Value INT16 Result code 0 means success Table 27 ACR120_Dec Command Description Low Level Frame Structure Command From PC to Reader 10 bytes Command Code 1 byte Command Dat...

Page 39: ...ted value of the desBlock after copy Return Value INT16 Result code 0 means success Table 28 ACR120_Copy Command Description Low Level Frame Structure Command From PC to Reader 7 bytes Command Code 1...

Page 40: ...th A pointer to the location storing the length of the data to transmit in bytes pxData A pointer to the transmit data storage pReceiveLength A pointer to the location storing the length of the data r...

Page 41: ...Type B card Selects a single card and returns the card ID Serial Number retcode ACR120_Select rHandle SID HaveTag tmpbyte tmpArray if retcode 0 If a card is selected proceed to issue an APDU of 94B20...

Page 42: ...yte Command Data Length 1 bytes Instruction Code 1 byte Data length 1 byte Data 1 byte K byte E0h 03h 2Fh K 1h 00h APDU Response From Reader to PC 10 bytes Success Response Code 1 byte Response Status...

Page 43: ...andle in a frame and also gets the operation parameters of the card when communicating in ISO14443 mode Parameters Description rHandle Handle to the reader returned by ACR120_Open FSDI Index to a maxi...

Page 44: ...turn value is zero if the function is successful Otherwise it returns a negative value containing the error code For the detailed meaning of the error code please refer to Appendix A For detailed mean...

Page 45: ...ader 5 bytes Command Code 1 Byte Command Data Length 1 bytes Instruction Code 1 byte Data Length 1 byte Data 1 byte E0h 03h 17h 01h bEnable bEnable 1 Byte 0x00h Disable RATS During Power On Command 0x...

Page 46: ...ware Upgrade Mode Low Level Frame Structure Command From PC to Reader 5 bytes Command Code 1 Byte Command Data length 1 bytes Instruction Code 1 byte Data Length 1 byte E0h 02h 20h 00h Response From R...

Page 47: ...rnal unexpected error Handled by the DLL ERR_PORT_INVALID 2000 The port is invalid Handled by the DLL ERR_PORT_OCCUPIED 2010 The port is occupied by another application Handled by the DLL ERR_HANDLE_I...

Page 48: ...ized Corresponding to the Response Status I ERR_READER_VALUE_DEC_EMPTY 4030 or 0xF042 Decrement failure empty Corresponding to the Response Status E ERR_READER_VALUE_INC_OVERFLOW 4031 or 0xF041 Increm...

Page 49: ...Appendix B Possible TAG Types TAG Type Value TAG Type Description TAG SN Length 0x01h Mifare Light 4 0x02h Mifare 1K 4 0x03h Mifare 4K 4 0x04h Mifare DESFire 7 0x05h Mifare Ultralight 7 0x06h JCOP30...

Page 50: ...Version 1 00 www acs com hk Page 50 of 52 Appendix C USB ID and Drivers for ACR1281U C8 VID_0x072F PID_0x8003 as the USB ID of ACR1281U C8 ACR120US SYS will be used as the driver name for ACR1281U C8...

Page 51: ...NT16 hReader UINT8 Length SN 10 Data 16 Type Open a communication channel USB Interface hReader ACR120_Open ACR120_USB1 if hReader 0 error happened Assume the Reader Handle is ready then Select a TAG...

Page 52: ...gical block of each sector is from 0 to 3 Physical blocks Sector 4 Logical block 2 Mifare 4K Case 1 If 0 Logical Sector 31 o Physical sector is equal to Logical o Logical block of each sector is from...

Reviews: