MAD and MIFARE DESFire:
For detailed information on the functionality of the MIFARE DESFire IC please refer to the “MIFARE DESFire MF3 IC D40 Short From Specification” available at NXP Document Control.

The MIFARE DESFire card IC features a flexible file system which organizes user data in applications which hold files. Applications are identified with a 3 byte application identifier (AID). AIDs have to be unique per card and are defined at application creation time.

A dedicated list of currently installed application does NOT have to be maintained by the card issuer, as the MIFARE DESFire IC maintains this list automatically. To collect a list of applications on a card, the MIFARE DESFire command GetApplicationIDs is used. This command returns a list holding all MIFARE DESFire AIDs present on the card.

In order to transfer the advantages of the MIFARE classic AID structure to the MIFARE DESFire IC following definitions are made:
-The 3 bytes MIFARE DESFire AID can be used to store the 2 byte MIFARE classic AID
-The first nibble of the MIFARE DESFire AID is fixed to 0xF to indicate: MIFARE classic AID is used.
-The next 4 nibbles hold the MIFARE classic AID.
-The last nibble can be freely chosen to support multiple MIFARE DESFire AIDs within the context of one MIFARE classic AID. This allows to have 16 different MIFARE DESFire AIDs using one single MIFARE classic AID.
-The MIFARE DESFire Card Master Key settings have to allow the MIFARE DESFire command GetApplicationIDs without authentication.
-The MIFARE DESFire AID 0xFF FF FF is reserved.

Table 13. MIFARE DESFire AID      
0x MSB 2nd byte LSB
0x Nibble 0 Nibble 1 Nibble 2 Nibble 3 Nibble 4 Nibble 5
0x F Two-byte MIFARE Classic ID 0..F

The reserved MIFARE DESFire AID 0xFF FF FF is used to store general issuer information:
-File 0×0 has to be a value file with free access for GetValue, holding the value 0×00 00 03, indicating the MAD version 3.
-File 0×1 shall be configured as StandardDataFile with Free Read Access. This file holds the contact details of the Card Holder (user of the card) in CSV plain text.
-File 0×2 shall be configured as StandardDataFile with Free Read Access. This file holds the contact details of the Card Publisher (owner of PICC Master Key) in CSV plain text.
-Files 0×3 to 0xF are RFU and shall not be used within MIFARE DESFire AID 0xFF FF FF.
-Application Software in Terminals (PCDs) shall ignore files 0×3 to 0xF.

Example:
2-byte MIFARE Classic Application ID is mapped to 3-byte DESFire application ID.Let’s take MIFARE Classic Application ID according to MAD = 0×4857, where MSB (0×48) is the cluster code for access control and application code is LSB (0×57).
The mapping to DESFire AID is shown in the following table.

Table 14. Example – Mapping of 2-byte MIFARE Classic AID to 3-byte DESFire AID
0x MSB 2nd byte LSB    
0x Nibble 0 Nibble 1 Nibble 2 Nibble 3 Nibble 4 Nibble 5    
0x F Two-byte MIFARE Classic ID 0..F    
0x F 0×4857 X    
0x F 4 8 5 7 X    
0x F4857X (X can be any value from 0 to F)    

 

So, the corresponding 3-byte DESFire Application ID = 0xF4857X; where 0xF4 is the MSB and 0x7X is the LSB.
According to ISO/IEC 7816-4, the bit number 8 to 5 of first byte “F” means “Proprietary category, no registration of application providers”.
Please note according to ISO/IEC 14443 and DESFire, the lowest significant byte is exchanged first e.g. in this case “7X85F4”.

MAD and MIFARE DESFire EV1:
The  can be implemented for MIFARE DESFire EV1. For detailed information on the functionality of the MIFARE DESFire EV1 IC, please refer to the “MF3ICD81 MIFARE DESFire EV1 Functional Specification”,
available via NXP document control.

MAD and MIFARE Plus:
The MIFARE Plus AES keys A for reading the sector 0×00 and the sector 0×10 shall be: 0x a0a1a2a3a4a5a6a7a0a1a2a3a4a5a6a7
For the use of MAD in SL3 the communication must allow plain communication, i.e. in SL3 the byte 5 of the sector trailer must be configured accordingly.
Remark: The default setting for the byte 5 default value, as specified in the MIFARE Plus configuration block, automatically allows plain communication, if not changed during personalization.
Remark: For the 2K MIFARE Plus the AIDs of the sectors 0×21 (33dec) … 0×28 (40dec) must be set to 00 05 (hexsector not applicable, above memory size).
Refer to the datasheet of MIFARE Plus for more details (BU-ID Doc. no. 1637**).

Use of the application directories:

Directory scan procedure for MAD1 and MAD2:
The purpose of the MAD is to gain additional information and flexibility. These benefits ask for specific proceedings of application software:
Any transaction should start with a directory scan; that means authentication of sector 0 with key A and reading at least blocks 1 and 2. In most cases block 3 is necessary to get general information about the directory structure found in the GPB of block 3.

The next step is to look for the relevant AIDs in the directory blocks which point to the actual sector addresses in use. Several identical AIDs may point to different sectors belonging to the same application. The data structure within the application sectors must be organized with application software. If sectors are changed during life time of the card application, the software needs specific algorithms for locating single data records in
several sectors.

If the GPB (ADV) in block 3, sector 0 identifies the MAD2 (i.e. the use of the sectors 16…39 in the extended memory), the sector 10 hex has to be authenticated with key A. The block 0, 1 and 2 contain the AIDs of the extended directory for the sectors 0×11 … 0×27.

As extension of the MAD2 is organized in the same way as the basic directory in sector 0, the same structure of application software can be used.

Indirect addressing mode:
Data identification and manipulation algorithms should only use the indirect addressing mode by using the sector pointers which are extracted out of the MAD.

Directory scan procedure for MAD3:
To check whether an application is present on a MIFARE DESFire IC, the command “GetApplicationIDs” is used.
Please refer to chapter MAD and MIFARE DESFire respectively “MIFARE DESFire Functional Specification” for more details.

Registration of MIFARE classic application identifiers:
Each MIFARE classic application should be encoded in an unique AID. To achieve this goal a central registration authority is set up. Any organization may request for AIDs for new MIFARE classic application free of charge using the attached registration form (see ANNEX A). The contents of sector B of this form will be inserted in a common database.

MAD Sector 0×00 (MAD1 and MAD2):

ISO Mifare Smart Card,Mifare DESFire EV1 2K Proximity Contactless Cards,Mifare DESFire EV1 2K Contactless Smart Cards,

MAD Sector 0×10 (MAD2):

NXP Mifare DESFire EV1 2K,Mifare DESFire EV1 2K ISO Proximity Card,Mifare DESFire EV1 2K Printing Cards,