APDU commands follow the ISO/IEC 7816-4:2013 specifications to encode logical channel information in the CLA byte. The CLA byte encoding is divided into two spaces:
Interindustry —Used by all ISO/IEC 7816-4:2013- defined commands
Proprietary — Used by Java Card technology to encode application- specific commands
The CLA byte encoding is divided into two classes:
Type 4 commands — Encode legacy ISO/IEC 7816-4 logical channel information
Type 16 commands — Defined by the ISO/IEC 7816-4:2013 specification to encode information for additional 16 logical channels in the card.
Type 4 logical channels occupy the range of [0
...3
], while Type 16 logical channels go in the range of [4
...19
], that is, the value encoded in the CLA byte plus four, as it is used in SELECT
, MANAGE CHANNEL
and other proprietary or ISO commands.
However, a note of caution: while the MANAGE CHANNEL
command CLA byte follows the encoding as described below, its P2 parameter does not. The logical channel numbers in its P2 parameter are correctly encoded in the range of [0
...19
].
The CLA byte encoding follows the following rules: