Home

Awesome

Building JavaCard applet CAP files with Ant

Easy to use Apache Ant task for building JavaCard CAP files in a declarative way.

Have a consistent and concise build declaration for JavaCard applets, no matter which JavaCard SDK version you use or target.

Latest release  Maven version  MIT licensed  Build Status  Made in Estonia

Features

[!TIP] Loading JavaCard applets is equally pleasing with GlobalPlatformPro

Download & Use

<get src="https://github.com/martinpaljak/ant-javacard/releases/latest/download/ant-javacard.jar" dest="." skipexisting="true"/>
<taskdef name="javacard" classname="pro.javacard.ant.JavaCard" classpath="ant-javacard.jar"/>
<javacard>
  <cap jckit="/path/to/jckit_dir" aid="0102030405">
    <applet class="myapplet.MyApplet" aid="0102030405060708"/>
  </cap>
</javacard>

(which results in output similar to this)

target:
      [cap] INFO: using JavaCard 3.0.5 SDK in sdks/jc305u4_kit
      [cap] INFO: targeting JavaCard 2.2.2 SDK in sdks/jc222_kit
      [cap] Setting package name to testapplets.empty
      [cap] INFO: generated applet AID: A000000617008E5CDAAE01 for testapplets.empty.Empty
      [cap] Building CAP with 1 applet from package testapplets.empty (AID: A000000617008E5CDAAE)
      [cap] testapplets.empty.Empty A000000617008E5CDAAE01
  [compile] Compiling files from /Users/martin/projects/ant-javacard/src/testapplets/empty
  [compile] Compiling 1 source file to /var/folders/gf/_m9mq9td3lz32qv1hd4r12yw0000gn/T/jccpro841338375581620546
      [cap] CAP saved to /Users/martin/projects/ant-javacard/Empty_A000000617008E5CDAAE_50da91a4_2.2.2.cap

Recommended setup

Based on the JavaCard SDK and JDK version compatibility matrix.

[!NOTE] ant-javacard will continue to support using legacy JavaCard 2.X SDK-s (and thus JDK-8) for as long as this is achievable with sane effort

Syntax

Sample:

<javacard jckit="/path/to/jckit_dir1">
  <cap targetsdk="/path/to/jckit_dir2" aid="0102030405" package="package.name" version="0.1" output="MyApplet.cap" sources="src/myapplet" classes="path/to/classes" export="mylib">
    <applet class="myapplet.MyApplet" aid="0102030405060708"/>
    <import exps="path/to/exps" jar="/path/to/lib.jar"/>
  </cap>
</javacard>

Details:

Notes:

Output file name variables

The default file name template is %n_%a_%h_%j_%J.cap which results in a file name similar to SomeApplet_010203040506_9a037e30_2.2.2_jdk11.cap.

Following substitutions are available:

Command line utility

ant-javacard.jar can be used to dump built .cap file metadata and to re-run off-card verifier.

Environment variables

Maven dependency

Releases are published to https://mvn.javacard.pro/maven/. To use it, add this to your pom.xml:

<repositories>
    <repository>
        <id>javacard-pro</id>
        <url>https://mvn.javacard.pro/maven/</url>
    </repository>
</repositories>

Pushes to Maven Central happen manually and only for selected final versions.

License

Happy users

A random list of users, with a public link:

Contact

Similar projects