Search code examples
javasmartcard

How to load and install an applet onto the smart card via Java Code


I want to write a Java Programm that downloads and installs an Applet onto a Java Smartcard. I am using ACOSJ-DI 95K Java Card, https://www.cardomatic.de/en/p/acosj-di-95k-java-card-pack-of-5. Can anybody tell me where I can find examples? Can anybody explain me how the mutual authentication works?

I did some research in the internet and have found a framework https://github.com/jnasmartcardio/jnasmartcardio. This framework has also some examples but I do not find any methods for downloading and installing an applet onto a smartcard.


Solution

  • You need to look to Global Platform support which defines the lifetime of Applet's and the security state of the card. This includes mutual authentication to the card manager as well as applet installation. The global platform specifications are available for free (generally after registration). You can download the GP 2.1.1 card specifications relatively easily from other locations.

    There are plenty of OS frameworks for this, no need to program this yourself. One of the most well known ones is Global Platform Pro library of Martin Paljak (no affiliation). Pro-tip: you can generally also execute or call upon scripts from your Java application - I've used that strategy successfully using another proprietary framework.

    Notes:

    • In principle other methods of authentication / installation can be used of course, but in practice the applets are always managed by GP.
    • Note that Global Platform was previously known as Open Platform or OP, in case you find old references to that.