Site Tools

Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcre:4.7_other_command_processing

4.7 Other Command Processing

When an APDU other than a SELECT FILE or MANAGE CHANNEL command is received, the logical channel to be used for dispatching the command is based on the CLA byte as described in Section 4.3, Forwarding APDU Commands To a Logical Channel.

When the Java Card RE receives an APDU other than a SELECT FILE or MANAGE CHANNEL command with either of the following:

  • An unsupported logical channel number in the CLA byte
  • An unopened logical channel number in the CLA byte

It shall respond to the APDU with status code 0x6881 (SW_LOGICAL_CHANNEL_NOT_SUPPORTED).

If there is no active applet instance on the logical channel to be used for dispatching the command, the Java Card RE shall respond to the APDU with status code 0x6999 (SW_APPLET_SELECT_FAILED).

When an APDU other than a Applet SELECT FILE or a MANAGE CHANNEL command is received, and there is an active applet instance on the logical channel to be used for dispatching the command, the Java Card RE sets the active applet instance on the origin channel as the currently selected applet instance and invokes the process method passing the APDU as a parameter. This causes a context switch from the Java Card RE context into the currently selected applet instance's context (For more information on contexts see Section 6.1.2, Contexts and Context Switching.) When the process method exits, the VM switches back to the Java Card RE context. The Java Card RE sends the response APDU and waits for the next command APDU.

Note that the Java Card RE dispatches the APDU command “as is” to the applet instance for processing via the process method. Therefore, the CLA byte in the command header contains in its least significant bits the origin channel number. An applet designed to run on any logical channel needs to mask out these two bits before checking for specific values.

Copyright © 2005, Sun Microsystems, Inc. All Rights Reserved.

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