ISO/IEC 7816-4
Identification cards — Integrated circuit cards — Part 4: Organization, security and commands for interchange
Cartes d’identification — Cartes à circuit intégré — Partie 4: Organisation, sécurité et commandes pour les échanges

 Structures for applications and data
This clause specifies structures for applications and data, as seen at the interface when processing commands in the interindustry class. The actual storage location of data and structural information beyond what is described in this clause is outside the scope of ISO/IEC 7816.
Two categories of structures are supported: dedicated file (DF) and elementary file (EF).
–The DFs host applications and / or group files and / or store data objects. An application DF is a DF hosting an application. A DF may be the parent of other files. These other files are said to be immediately under the DF.
–The EFs store data. An EF cannot be the parent of another file. Two categories of EFs are specified.
  -An internal EF stores data interpreted by the card, i.e., data used by the card for management and control purposes.
  -A working EF stores data not interpreted by the card, i.e., data used by the outside world exclusively.

Two types of logical organization are provided.
–Figure 2 illustrates a hierarchy of DFs with its corresponding security architecture (see 5.4). In such a card organization, the DF at the root is called the master file (MF); any DF may be an application DF, with or without its own hierarchy of DFs.

Mifare DESFire EV1 4K Plain White Cards,Mifare DESFire EV1 4K Proximity Cards,Mifare DESFire 4K Pre-printed Card,Mifare DESFire EV1 4K Contactless Smart Cards,

   Figure 2 — Example of hierarchy of DFs

    –Figure 3 illustrates application DFs in parallel, with no MF seen at the interface, i.e., without any apparent hierarchy of DFs. Such an organization supports independent applications in the card where any application DF may have its own hierarchy of DFs with its corresponding security architecture.

     Mifare DESFire EV1 4K Proximity Smart Cards,Mifare DESFire EV1 4K Card,ISO 14443 A Mifare DESFire EV1 4K Cards,

Structure selection
Structure selection methods

Selecting a structure allows access to its data and, if the structure is a DF, its sub-structure. Structures may be selected implicitly, i.e., automatically after reset and possible protocol and parameter selection (see ISO/IEC 7816-3). When a structure cannot be implicitly selected, it shall be selected explicitly, i.e., by at least one of the following four methods.

Selection by DF name — A DF name may reference any DF. It is a string of up to sixteen bytes. Any application identifier (AID, see 8.2.1.2) may be used as DF name. In order to select unambiguously by DF name, e.g., when selecting by means of application identifiers, each DF name shall be unique within a given card.

Selection by file identifier — A file identifier may reference any file. It consists of two bytes. The value ’3F00′ is reserved for referencing the MF. The value ‘FFFF’ is reserved for future use. The value ’3FFF’ is reserved (see below and 7.4.1). The value ’0000′ is reserved (see 7.2.2 and 7.4.1). In order to unambiguously select any file by its identifier, all EFs and DFs immediately under a given DF shall have different file identifiers.

Selection by path — A path may reference any file. It is a concatenation of file identifiers. The path begins with the identifier of a DF (the MF for an absolute path or the current DF for a relative path) and ends with the identifier of the file itself. Between those two identifiers, the path consists of the identifiers of the successive parent DFs, if any. The order of the file identifiers is always in the direction parent to child. If the identifier of
the current DF is not known, then the value ’3FFF’ (reserved value) can be used at the beginning of the path. The values ’3F002F00′ and ’3F002F01′ are reserved (see 8.2.1.1). The path allows an unambiguous selection of any file from the MF or from the current DF (see 8.3).

Selection by short EF identifier — A short EF identifier may reference any EF. It consists of five bits not all equal, i.e., any number from one to thirty. When used as short EF identifier, the number zero, i.e., 00000 in binary, references the current EF. At MF level, the number thirty, i.e., 11110 in binary, is reserved (see 8.2.1.1). Short EF identifiers cannot be used in a path or as an EF identifier (e.g., in a SELECT command).
If supported, selection by short EF identifier shall be indicated.
–If the first software function table (see Table 86) is present in the historical bytes (see 8.1.1) or in EF.ATR (see 8.2.1.1), then the indication is valid at card level.
–If a short EF identifier (tag ’88′, see Table 12) is present in the control parameters (see 5.3.3) of an EF, then the indication is valid at EF level.

File reference data element
Referenced by tag ’51′, this interindustry data element references a file. It may have any length.
–An empty data object references the MF.
–If the length is one and if bits 8 to 4 of the data element are not all equal and if bits 3 to 1 are set to 000, then bits 8 to 4 encode a number from one to thirty that is a short EF identifier.
–If the length is two, then the data element is a file identifier.
–If the length is more than two, then the data element is a path.
  -If the length is even and if the first two bytes are set to ’3F00′, then the path is absolute. The data element is a concatenation of at least two file identifiers starting with the MF identifier.
  -If the length is even and if the first two bytes are not set to ’3F00′, then the path is relative. The data element is a concatenation of at least two file identifiers starting with the identifier of the current DF.
  -If the length is odd, then the path is qualified. The data element is either an absolute path without ’3F00′, or a relative path without the identifier of the current DF, followed by a byte to use as P1 in one or more SELECT commands (see 7.1.1 and 8.3).
Table 10 shows the file reference data object.  

Table 10 — File reference data object
Tag Length Value
’51′ 0 The empty data object references the MF
1 Short EF identifier (bits 8 to 4 encode a number from one to thirty; bits 3 to 1 are set to 000)
2 File identifier
Even, > 2 Absolute path (the two first bytes are set to ’3F00′)
Relative path (the first two bytes are not set to ’3F00′)
Odd, > 2 Qualified path (the last byte shall be used as P1 in one or more SELECTcommands)

Data referencing methods
In DFs, data may be referenced as data objects (see 5.2). The DF is seen at the interface as a set of data objects accessible by commands for handling data objects (see 7.4).
In EFs, data may be referenced as data units (see 7.2.1), as records (see 7.3.1) or as data objects (see 5.2). Data referencing method is an EF-dependent feature. Three structures of EFs are defined.
–Transparent structure — The EF is seen at the interface as a single continuous sequence of data units accessible by commands for handling data units (see 7.2). Data unit size is an EF-dependent feature.
–Record structure — The EF is seen at the interface as a single continuous sequence of individually identifiable records accessible by commands for handling records (see 7.3). Record numbering method is an EF-dependent feature. Two attributes are defined.
  -The size of the records is either fixed, or variable.
  -The organization of the records is either a sequence (linear structure), or a ring (cyclic structure).
–TLV structure — The EF is seen at the interface as a set of data objects accessible by commands for handling data objects (see 7.4). The type of data objects in the EF, namely, either SIMPLE-TLV, or BER-TLV, is an EF-dependent feature.

For referencing data in EFs, the card shall support at least one of the five structures shown in Figure 4.

     Mifare DESFire EV1 4K Plain White Cards,Mifare DESFire EV1 4K Proximity Cards,Mifare DESFire 4K Pre-printed Card,Mifare DESFire EV1 4K Contactless Smart Cards,

Figure 4 — EF structures
1) Transparent structure
2) Linear structure with records of fixed size
3) Linear structure with records of variable size
4) Cyclic structure with records of fixed size (the arrow references the most recently written record)
5) TLV structure