Site Tools

Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcre:4.3_forwarding_apdu_commands_to_a_logical_channel

4.3 Forwarding APDU Commands To a Logical Channel

According to Section 5.4 of the ISO 7816-4:2005 Specification specification, the interindustry values of the CLA byte equal to 0x0X and 0x1X in the APDU command encode channel numbers in the range 0-3, whereas interindustry values of the CLA byte equal to 0x4Y, 0x5Y, 0x6Y and 0x7Y in the APDU command encode channel numbers in the range 4-19.

In addition, cards compliant with Java Card platform specification v2.2.2 must also support proprietary class values of the CLA byte equal to 0x8X, 0x9X, 0xAx and 0xBX for channel numbers in the range 0-3 and proprietary class values of the CLA byte equal to 0xCY, 0xDY, 0xEY and 0xFY for channel numbers 4-19 (using 0 origin notation). The bit encoding of the proprietary class values of the CLA byte mirror that of the ISO 7816-4:2005 Specification defined interindustry values with the most significant bit b8 set to 1. TABLE 4-1 and TABLE 4-2 show the supported encodings of the CLA byte.

The two least significant bits (b2,b1*) of the X nibble encodes the logical channels numbers 0-3, whereas the Y nibble (b4-b1*) encodes logical channel numbers in the range 4-19 (using 0 origin notation). When an APDU command is received, the Java Card RE shall process it and determine whether or not the command has logical channel information. If logical channel information is encoded, the card dispatches the APDU command to the appropriate logical channel on that I/O interface. All other APDU commands are forwarded to the basic logical channel (logical channel 0) on that I/O interface.

CLA byte encoding

Semantic details

%b0000 00zz

(Type 4) last or only command in chain, no SM

%b0001 00zz

(Type 4) not last command in chain, no SM

%b0000 yyzz

(Type 4) last or only command in chain, with SM

%b0001 yyzz

(Type 4) not last command in chain, with SM

%b0010 uuuu

RFU

%b0011 uuuu

RFU

%b0100 zzzz

(Type 16) last or only command in chain, no SM

%b0101 zzzz

(Type 16) not last command in chain, no SM

%b01y0 zzzz

(Type 16) last or only command in chain, with SM

%b01y1 zzzz

(Type 16) not last command in chain, with SM

NOTATION

u

y

z

undefined

Secure Messaging (SM) indicator

See ISO 7816-4:2005 Specification Section 6 for further information.

Logical channel indicator

Type 4 supports logical channels [0..3]

Type 16 supports logical channels [4..19]

CLA byte encoding

Semantic details

%b1000 00zz

(Type 4) last or only command in chain, no SM

%b1001 00zz

(Type 4) not last command in chain, no SM

%b1000 yyzz

(Type 4) last or only command in chain, with SM

%b1001 yyzz

(Type 4) not last command in chain, with SM

%b1010 00zz

(Type 4) last or only command in chain, no SM

%b1011 00zz

(Type 4) not last command in chain, no SM

%b1010 yyzz

((Type 4) last or only command in chain, with SM

%b1011 yyzz

(Type 4) not last command in chain, with SM

%b1100 zzzz

(Type 16) last or only command in chain. no SM

%b1101 zzzz

(Type 16) not last command in chain, no SM

%b11y0 zzzz

(Type 16) last or only command in chain, with SM

%b11y1 zzzz

(Type 16) not last command in chain, with SM

NOTATION

u

y

z

undefined

Secure Messaging indicator

See ISO 7816-4:2005 Specification Section 6 for further information.

Logical channel indicator

Type 4 supports logical channels [0..3]

Type 16 supports logical channels [4..19]

Note - CLA byte 0xFX cannot encode logical channel 19 because CLA = 0xFF is a reserved value for Protocol Type Selection. In compliance with ISO 7816-4:2005 Specification, logical channel number 19 is not available when using this CLA byte.

The Java Card RE always forwards the command “as is” to the appropriate applet instance. In particular, the Java Card RE does not clear the logical channel encoding bits of the CLA byte.

To avoid the complexity of the transport information encoded in the CLA byte of the APDU command header, the application programmer is advised not to parse the CLA byte directly. The following methods in the javacard.framework.APDU class may be used to extract application specific information:

  • APDU.isISOInterindustryCLA
  • APDU.isSecureMessagingCLA
  • APDU.isCommandChainingCLA
  • APDU.getCLAChannel

Note - An asterisk indicates binary notation (%b) using bit numbering as in the ISO7816 specification. Most significant bit is b8. Least significant bit is b1.

javacard/jcre/4.3_forwarding_apdu_commands_to_a_logical_channel.txt · Last modified: 2017/05/13 04:07 (external edit)