Two-interface Card Simulation

To simulate dual-interface cards with the RI the following model is used:

  • The simulator (cref) listens for communication on two TCP sockets: (n) and (n+1), where n is the default (9025) or the socket number given in the command line.

  • The client creates two instances of the CadClientInterface, with protocols T=1 on both. One of these instances communicates on the port (n), while the other communicates on the port (n+1).

  • Each of these client interfaces needs to issue the powerUp command before being able to exchange APDUs.

  • Issuing the powerDown command on the contactless interface closes all contactless logical channels. After this, the contacted interface is still available to exchange APDUs. The client also may issue powerUp on a contactless interface again and continue exchanging APDUs on the contactless interface too.

  • Issuing the powerDown command on the contacted interface closes all channels and causes the simulator (cref) to exit. That is, any activity after powering down the contacted interface requires restarting the simulator and reestablishing connections between the client and the simulator.

  • At most, one socket can be processing an APDU at any time. The client may send the next APDU only after the response of the previous APDU is received. This means, behavior of the client+simulator still remains deterministic and reproducible.

  • If you have a source release of the Java Card development kit, you can see a sample implementation of such a dual-interface client in the file inside the apdutool source tree.