Install and Setup the PCSC-Lite and IFD Handler

The Java Card Development Kit Simulator works with smart card terminals in Linux operating system by using the PCSC-Lite and the IFD Handler. The Java Card Development Kit Simulator bundle for Linux comes with the IFD Handler library.

These are the steps to setup and configure the IFD Handler library named libjcsdkifdh.so located in the /<absolute-path-to-jc-simulator>/drivers/IFDHandler/ directory, and how to use it with multiple simulator instances.

  1. Update apdt/dnf database.
    • Linux Ubuntu: sudo apt update
    • Linux Oracle: sudo dnf update
  2. Install middleware to access a smart card using PC/SC Daemon.
    • Linux Ubuntu: sudo apt install -y pcscd
    • Linux Oracle: sudo dnf install pcsc-lite
  3. Install pcs libraries/tools.
    • Linux Ubuntu: sudo apt install -y pcsc-tools
    • Linux Oracle: sudo dnf install pcsc-lite-libs pcsc-lite-ccid
  4. Create a new file named jcsdk_config in the PC/SC Daemon default configuration directory named /etc/reader.conf.d: sudo touch /etc/reader.conf.d/jcsdk_config
  5. Add a maximum of 6 reader configurations for the IFD-Handler implementation library named libjcsdkifdh.so, in the above-mentioned configuration file - jcsdk_config. An example for two reader configurations is described below:
    # Configuration example of two readers to interact with the
     # Oracle PCSC Reader for Linux 
    
    FRIENDLYNAME "Oracle JCSDK PCSC Reader Demo 1"
    DEVICENAME 127.0.0.1:9020
    LIBPATH /<absolute-path-to-jc-simulator>/drivers/IFDHandler/libjcsdkifdh.so 
    
    FRIENDLYNAME "Oracle JCSDK PCSC Reader Demo 2"
    DEVICENAME 127.0.0.1:9021
    LIBPATH /<absolute-path-to-jc-simulator>/drivers/IFDHandler/libjcsdkifdh.so

    Note:

    The PCSC-Lite daemon will act as socket client for the Java Card Simulator (jcsl) started on the ports configured in this file and connect to them so other socket clients can not connect to these runtimes on those ports.
  6. Make PC/SC Daemon aware of the new configuration for the IFD-Handler. To load the new configuration file created at the previous step, PC/SC Daemon must be restarted, use the following command:
    sudo systemctl restart pcscd
    • Use the following command to start the PC/SC Daemon in foreground mode for debug purposes:
       sudo pcscd -f -d -a

      Note:

      To verify that the pcscd configuration is reflected in the new daemon, run pcsc_scan to list the available readers. Both "Oracle JCSDK PCSC Reader Demo 1" and "Oracle JCSDK PCSC Reader Demo 2" should be present in the list if the previous configuration file example was used.
  7. Repeat the following steps as many times as the number of configured readers to start multiple simulator instances, each using a different port as configured in the jcsdk_config file.

    Note:

    For running the Java Card Simulator, please refer to the prerequisites found in Before Installing the Java Card Development Kit Simulator.
    cd ${JC_HOME_SIMULATOR}/runtime/bin
    ./jcsl -p=<port>

    Note:

    For command line parameters, see Running the Simulator and the Samples section in the Java Card Development Kit Simulator Command Line section.
  8. PC/SC Daemon setup is finished.