1
votes

As far as we know, Java Cards doesn't support multi-threading. The question is that, how they can have more than one logical channel but don't support multi-threading? And why they need more than one logical channel?

In my case I have a java card that support three logical channel. I installed Applet-A and Applet-B on my card. then I sent a SELECT command for Applet-A via logical channel-1, and right after that I sent another SELECT command for Applet-B via channel-2.

In this moment, I can send and APDUs to both Applet-A and Applet-B in a row without any other Select command. Isn't this Multi-Threading? I mean the JCRE must keep both Applet-A and Applet-B selected, right?

1

1 Answers

2
votes

No, it isn't multi-threading. With multi-threading it is required that multiple processor threads run at the same time. This means that you have a requirements for multiple stacks as well.

On the other hand, for logical channels it is only required that the applet state is aware of the multiple logical channels. In Java Card, you do have support for logical channels, but you are still required to design and keep a state machine. How the state - such as authentication state - between logical channels is divided is not specified in ISO/IEC 7816-4 where logical channels are defined. The only thing that the runtime is required to do is to remember the selection state of the logical channels, as you already mused.

The Java Card API for classic is clearly not designed for multi-threading, and for most smart cards true multi-threading would be a very high burden, especially regarding RAM usage. Furthermore, the half-duplex APDU interface of ISO/IEC 7816-4 would severely limit the usefulness of multi-threading. Currently you cannot do much more than interleaving APDU command/response pairs sequentially.


Note that there are now dual-core smart card processors. But don't be fooled by appearances; those cores essentially run the same thread. They are mainly used to add security to a platform: if one processor state is found to be different from the other then a fault detection is triggered and the platform can launch defense measures.