ACR1281U-C1 – Application Programming Interface
Version 1.08
www.acs.com.hk
Page 89 of 96
Appendix B. Accessing MIFARE DESFire tags (ISO
14443-4)
MIFARE® DESFire supports ISO 7816-4 APDU Wrapping and Native modes.
Once the DESFire tag
is activated, the first APDU sent to the DESFire tag will determine the “Command Mode.” If the first
APDU is “Native Mode,” the rest of the APDUs must be in “Native Mode” format. Similarly, if the first
APDU is “ISO 7816-4 APDU Wrapping Mode,” the rest of the APDUs must be in “ISO 7816-4 APDU
Wrapping Mode” format.
Example 1
: MIFARE DESFire ISO 7816-4 APDU Wrapping.
To read 8 bytes random number from an ISO 14443-4 Type A PICC (DESFire):
APDU = {90 0A 00 00 01 00 00h}
Class = 90h; INS = 0Ah (DESFire Instruction); P1 = 00h; P2 = 00h
Lc = 01h; Data In = 00h; Le = 00h (Le = 00h for maximum length)
Answer: 7B 18 92 9D 9A 25 05 21h [$91AFh]
Note: Status Code {91 AFh} is defined in MIFARE DESFire specification. Please refer to MIFARE
DESFire specification for more details.
Example 2
: MIFARE DESFire Frame Level Chaining (ISO 7816 wrapping mode)
In this example, the application has to do the “Frame Level Chaining”.
To get the version of the DESFire card:
Step 1: Send an APDU {90 60 00 00 00h} to get the first frame. INS=60h
Answer: 04 01 01 00 02 18 05 91 AFh [$91AFh]
Step 2: Send an APDU {90 AF 00 00 00h} to get the second frame. INS=AFh
Answer: 04 01 01 00 06 18 05 91 AFh [$91AFh]
Step 3: Send an APDU {90 AF 00 00 00h} to get the last frame. INS=AFh
Answer: 04 52 5A 19 B2 1B 80 8E 36 54 4D 40 26 04 91 00h [$9100h]
Example 3
: MIFARE DESFire Native Command.
You can send Native DESFire Commands to the reader without ISO 7816 wrapping if we find that the
Native DESFire Commands are easier to handle.
To read 8 bytes random number from an ISO 14443-4 Type A PICC (DESFire):
APDU = {0A 00h}
Answer: AF 25 9C 65 0C 87 65 1D D7h [$1DD7h]
In which, the first byte “AF” is the status code returned by the MIFARE DESFire card.
The Data inside the blanket [$1DD7h] can simply be ignored by the application.