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

Class byte

CLA indicates the class of the command. Due to specifications in ISO/IEC 7816-3, the value ‘FF’ is invalid. Bit 8 of CLA distinguishes between the interindustry class and the proprietary class.

Bit 8 set to 0 indicates the interindustry class. The values 000x xxxx and 01xx xxxx are specified hereafter. The values 001x xxxx are reserved for future use by ISO/IEC JTC 1/SC 17.

 Table 2 specifies 000x xxxx as the first interindustry values.

  • Bits 8, 7 and 6 are set to 000.
  • Bit 5 controls command chaining (see 5.1.1.1).
  • Bits 4 and 3 indicate secure messaging (see 6).
  • Bits 2 and 1 encode a logical channel number from zero to three (see 5.1.1.2).

Table 2 — First interindustry values of CLA

b8 b7 b6 b5 b4 b3 b2 b1 Meaning
0 0 0 x - - - - Command chaining control (see 5.1.1.1)
0 0 0 0 - - - - —The command is the last or only command of a chain
0 0 0 1 - - - - —The command is not the last command of a chain
0 0 0 - x x - - Secure messaging indication
0 0 0 - 0 0 - - —No SM or no indication
0 0 0 - 0 1 - - —Proprietary SM format
0 0 0 - 1 0 - - —SM according to 6, command header not processed according to 6.2.3.1
0 0 0 - 1 1 - - —SM according to 6, command header authenticated according to 6.2.3.1
0 0 0 - - - x x Logical channel number from zero to three(see 5.1.1.2)

 Table 3 specifies 01xx xxxx as further interindustry values.

  • Bits 8 and 7 are set to 01.
  • Bit 6 indicates secure messaging (see 6).
  • Bit 5 controls command chaining (see 5.1.1.1).
  • Bits 4 to 1 encode a number from zero to fifteen; this number plus four is the logical channel number from four to nineteen (see 5.1.1.2).

Table 3 — Further interindustry values of CLA

b8 b7 b6 b5 b4 b3 b2 b1 Meaning
0 0 0 1 1 1 x 0 1 Secure messaging indication —No SM or no indication —SM according to 6, command header not processed according to 6.2.3.1
0 0 0 1 1 1 x 0 1 Command chaining control (see 5.1.1.1) —The command is the last or only command of a chain —The command is not the last command of a chain
0 1 - - x x x x Logical channel number from four to nineteen (see 5.1.1.2)

Bit 8 set to 1 indicates the proprietary class, except for the value ‘FF’ which is invalid. The application-context defines the other bits.

Command chaining
This clause specifies a mechanism whereby in the interindustry class, consecutive command-response pairs can be chained. The mechanism may be used when executing a multi-step process, e.g., transmitting a data string too long for a single command.
If the card supports the mechanism, then it shall indicate it (see Table 88, third software function table) in the historical bytes (see 8.1.1) or in EF.ATR (see 8.2.1.1).
This document specifies the card behaviour only in the case where, once initiated, a chain is terminated before initiating a command-response pair not part of the chain. Otherwise the card behaviour is not specified.
For chaining in the interindustry class, bit 5 of CLA shall be used while the other seven bits are constant.
–If bit 5 is set to 0, then the command is the last or only command of a chain.
–If bit 5 is set to 1, then the command is not the last command of a chain.
In response to a command that is not the last command of a chain, SW1-SW2 set to ’9000′ means that the process has been completed so far; warning indications are prohibited (see 5.1.3); moreover, the following specific error conditions may occur.
–If SW1-SW2 is set to ’6883′, then the last command of the chain is expected.
–If SW1-SW2 is set to ’6884′, then command chaining is not supported.

Logical channels
This clause specifies a mechanism whereby in the interindustry class, command-response pairs can refer to logical channels.
If the card supports the mechanism, then it shall indicate the maximum number of available channels (see
Table 88, third software function table) in the historical bytes (see 8.1.1) or in EF.ATR (see 8.2.1.1).
–If the indicated number is four or less, then only Table 2 applies.
–If the indicated number is five or more, then Table 3 also applies.
For referring to logical channels in the interindustry class, the following rules apply.
–CLA encodes the channel number of the command-response pair.
–The basic channel shall be permanently available, i.e., it cannot be closed. Its channel number is zero.
–Cards not supporting the mechanism (default value) shall use only the basic channel.
–Any other channel shall be opened by completion of either a SELECT command (see 7.1.1) where CLA encodes a channel number not yet in use, or a MANAGE CHANNEL command with open function (see 7.1.2). 
–Any other channel can be closed by the completion of a MANAGE CHANNEL command with close function. After closing, the channel shall be available for re-use. 
–Only one channel shall be active at a time. The use of logical channels does not remove the prohibition of interleaving command-response pairs across the interface, i.e., the response APDU shall be received before initiating another command-response pair (see 5.1). 
–If not explicitly excluded by the file descriptor byte (see Table 14), more than one channel may be opened to the same structure (see 5.3), i.e., to a DF, possibly an application DF, and also possibly to an EF.
Each logical channel has its own security status (see 5.4). The way to share a security status is outside the scope of this document.