Skip to content

Smart Card Simulation

Frank Morgner edited this page Jun 6, 2018 · 10 revisions

Smart Card Simulation

This guide uses jCardSim to simulate the following Open Source Java Card Applets:

The description can easily be adapted for other applets as well. We focus on Windows since this is the only platform with a virtual smart card reader supported by jCardSim.

Prepare the Virtual Smart Card Reader

  1. Install virtual smart card reader: Either use the original source code and follow its manual or use the pre-built installer, BixVReaderInstaller.msi, from the Virtual Smart Card project.

  2. Enable the Pipe Reader: Change C:\Windows\BixVReader.ini to something like this

[Driver]
NumReaders=1

[Reader0]
RPC_TYPE=0
VENDOR_NAME=Fabio Ottavi
VENDOR_IFD_TYPE=Pipe Reader
DECIVE_UNIT=0
  1. Reload the configuration: In the Device Manager, deactivate and activate the Bix Virtual Smart Card Reader to load the modification of BixVReader.ini. Alternatively, you can use devcon.exe from the Windows Driver Kit:
devcon.exe disable root\BixVirtualReader
devcon.exe enable  root\BixVirtualReader
  1. Download and Install Java
  2. Download jCardSim

Now, configure jCardSim to load and run the applet to make it available via PC/SC (see sections below).

Simulating IsoApplet

  1. Download and build IsoApplet:
git clone https://github.com/philipWendland/IsoApplet
javac -classpath jcardsim-3.0.4-SNAPSHOT.jar IsoApplet\src\net\pwendland\javacard\pki\isoapplet\*.java
  1. Create jcardsim_isoapplet.cfg for IsoApplet:
com.licel.jcardsim.card.applet.0.AID=F276A288BCFBA69D34F31001
com.licel.jcardsim.card.applet.0.Class=net.pwendland.javacard.pki.isoapplet.IsoApplet
com.licel.jcardsim.card.ATR=3B80800101
  1. Run jCardSim with IsoApplet package:
javac -classpath jcardsim-3.0.4-SNAPSHOT.jar;IsoApplet\src com.licel.jcardsim.remote.BixVReaderCard jcardsim_isoapplet.cfg
  1. Create IsoApplet from the install package:
opensc-tool --card-driver default --send-apdu 80b800001a0cf276a288bcfba69d34f310010cf276a288bcfba69d34f3100100
  1. Initialize the IsoApplet as usual

Simulating OpenPGP

  1. Download and build OpenPGP applet:
git clone https://github.com/Yubico/ykneo-openpgp
javac -classpath jcardsim-3.0.4-SNAPSHOT.jar ykneo-openpgp\applet\src\openpgpcard\*.java
  1. Create jcardsim_openpgp.cfg for OpenPGP applet:
com.licel.jcardsim.card.applet.0.AID=D2760001240102000000000000010000
com.licel.jcardsim.card.applet.0.Class=openpgpcard.OpenPGPApplet
com.licel.jcardsim.card.ATR=3BFC1300008131FE15597562696B65794E454F7233E1
  1. Run jCardSim with OpenPGP:
javac -classpath jcardsim-3.0.4-SNAPSHOT.jar;ykneo-openpgp\applet\src com.licel.jcardsim.remote.BixVReaderCard jcardsim_openpgp.cfg
  1. Create OpenPGP applet from the install package:
opensc-tool --card-driver default --send-apdu 80b800002210D276000124010200000000000001000010D276000124010200000000000001000000
  1. Initialize the OpenPGP applet as usual

Simulating PIV

  1. Download and build PivApplet:
git clone https://github.com/arekinath/PivApplet
javac -classpath jcardsim-3.0.4-SNAPSHOT.jar PivApplet\src\net\cooperi\pivapplet\*.java
  1. Create jcardsim_pvi.cfg for OpenPGP applet:
com.licel.jcardsim.card.applet.0.AID=A000000308000010000100
com.licel.jcardsim.card.applet.0.Class=net.cooperi.pivapplet.PivApplet
com.licel.jcardsim.card.ATR=3B80800101
  1. Run jCardSim with PivApplet:
javac -classpath jcardsim-3.0.4-SNAPSHOT.jar;PivApplet\src com.licel.jcardsim.remote.BixVReaderCard jcardsim_pvi.cfg
  1. Create OpenPGP applet from the install package:
opensc-tool --card-driver default --send-apdu 80B80000180BA0000003080000100001000BA00000030800001000010000
  1. Initialize the PivApplet as usual
Clone this wiki locally