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

Status indicator
If the category indicator byte is set to ’00′, then the last three historical bytes shall be a status indicator, namely a card life cycle status byte denoted

LCS followed by two processing status bytes denoted SW1-SW2.
If the category indicator byte is set to ’80′, then an interindustry data element referenced by a compact header set to ’81′, ’82′ or ’83′ may be present as a status indicator on one, two or three bytes (any other length is reserved for ISO/IEC JTC 1/SC 17) at the end of the historical bytes.
–If the length is one, then the data element is a card life cycle status byte denoted LCS.
–If the length is two, then the data element is two processing status bytes denoted SW1-SW2.
–If the length is three, then the data element is LCS followed by SW1-SW2.

LCS shall be interpreted according to 5.3.3.2 and Table 13; the value ’00′ indicates that the status is not reported. SW1-SW2 shall be interpreted according to 5.1.3 and Tables 5 and 6; the value ’0000′ indicates that the status is not reported.

DIR data reference
If the category indicator byte is set to ’10′, then the subsequent byte is the DIR data reference. The coding and meaning of this byte are outside the scope of this document.

Initial data string recovery
Referenced by a compact header set to ’4Y’ in the historical bytes (see 8.1.1.2.4) or by tag ’44′ in EF.ATR (see 8.2.1.1), the interindustry data element called “initial access data” indicates a command APDU.
–If the length is one, then the command APDU is a READ BINARY command (see 7.2.3) as follows: CLA INS P1 P2 set to ’00B0 0000′ and a Le field set to the first and only byte of initial access data.
–If the length is two, then the first byte of initial access data indicates the structure (bit 8) and the short identifier (bits 5 to 1) of the EF to read, according to Table 89.
  -If bit 8 of the first byte is set to 1, then the command APDU is a READ BINARY command (see 7.2.3) as follows: CLA INS set to ’00B0′, P1 set to the first byte of initial access data, P2 set to ’00′ and a Le field set to the second byte of initial access data.
  -If bit 8 of the first byte is set to 0, then the command APDU is a READ RECORD (S) command (see 7.3.3) as follows: CLA INS P1 set to ’00B201′, P2 consisting of bits 8 to 4 set to bits 5 to 1 of the first byte of initial access data (a short EF identifier) and bits 3 to 1 set to 110, and a Le field set to the second byte of initial access data.

Table 89 —First byte of initial access data when the length is two
b8 b7 b6 b5 b4 b3 b2 b1 Meaning
x 0 1 EF structure Record structure Transparent structure
- - - x x x x x Short EF identifier
- x x - - - - - x00x xxxx (any other value is reserved for future use)

 If the length is five or more, then the command APDU consists of the Y bytes of initial access data.

The command APDU shall be submitted to the card. If the process is completed, then the response data field is a string of interindustry data objects every application might be interested in, called the “initial data string”.

Application identification and selection
This service allows the interface device to know what application is active in the card, if any, as well as how to identify and select any application supported by the card.

Application identification

EF.DIR and EF.ATR

Two specific EFs provide a generic support to application identification and selection, namely EF.DIR and EF.ATR. They contain a set of BER-TLV data objects. In these EFs, erased or modified BER-TLV data objects may induce padding before, between and after data objects (see 5.2.2.1).

EF.DIR — This EF indicates a list of applications supported by the card. It contains a set of application templates and / or application identifier data objects, in any order. It determines which commands shall be performed in order to select the indicated applications.

EF.DIR shall have the MF as parent file: the path ’3F002F00′ references EF.DIR. At MF level, the short EF identifier 30, i.e., 11110 in binary, references EF.DIR if present.

EF.ATR — This EF indicates operating characteristics of the card. It contains a set of interindustry data objects which cannot be nested in EF.DIR, either because not relevant to application selection, or because there is no EF.DIR.

EF.ATR shall have the MF as parent file: the path ’3F002F01′ references EF.ATR.