javasmartcardjavacardglobalplatformopensc

Smart Card Simulation on Ubuntu (Java Card - ISO7816) - specifying target JCRE


I'm trying to simulate the OpenPGP and IsoApplet before building and installing on a real javacard. I'd like my simulation environment to match the actual card as closely as possible.

Here are my card specs from the ATR database. It follows the Java Card 2.2.2 and Global Platform 2.1.1 specifications.

I'm following the instructions on the OpenSC GitHub to simulate a card with vpcsd support. These instructions end with a built jcardsim-3.0.4-SNAPSHOT.jar.

  1. How can I build the jcardsim with support for virtualcard/vpcsd for version 2.2.2?

  2. How do I specify the Java Card version to target when building IsoApplet with ant-javacard? Does my JDK impact what I can choose?

My environment is

Linux 5.3.0-40-generic #32-Ubuntu x86_64 GNU/Linux
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)
javac 1.8.0_242

I'm a little confused by the versioning page of the ant-javacard wiki: https://github.com/martinpaljak/ant-javacard/wiki/Version-compatibility

  1. In what instances would I compile .java files using a JDK and target a different JRE version when getting class files, in order to convert to a specific JCDK version using the converter? I understand using a high JDK for better source code features, and then compiling for a specific JRE, but not when there is the additional step of targeting a JCRE.

Solution

  • Use targetsdk to indicate the SDK of your target platform (or anything lower than your target platform). ant-javacard sets the target class file version automatically based on the used SDK (the jckit parameter), which should be 3.0.5 at this point.