No description, website, or topics provided.
Clone or download
Latest commit 4bd75fb Feb 1, 2017

README.md

Fidesmo gradle plugin

Build Status

A plugin for building java card applications suitable for usage on the Fidesmo card. The package also supports local testing in the JCardSim simulator and installation to the Fidesmo card using a local card reader (requires internet connection and fidesmo developer account). The gradle plugin relies on the vanilla gradle java plugin as well as on the java card plugin.

Features

  • compile/convert java package to executable load file (in C onverted AP plet format)
  • upload executable load file to the Fidesmo server [^1]
  • install applet to Fidesmo card [^1]
  • delete applet from Fidesmo card [^1]
  • send and receives APDUs with CLI
  • experimental: use phone as card reader Discontinued

[^1]: These features interact with the fidesmo server, hence a working internet connection and a fidesmo developer account(free of charge) is required.

Usage

Include at least the following into the build.gradle of your project

apply plugin: 'fidesmo'

buildscript {
    repositories {
        maven { url 'http://releases.marmeladburk.fidesmo.com/' }
    }

    dependencies {
        classpath  'com.fidesmo:gradle-fidesmo:0.1.10'
    }
}

javacard {
    cap {
        aid = "${fidesmoPrefix}:0x01"
        packageName = 'org.example.javacard.package'
        applet {
            aid = "${fidesmoPrefix}:0x01:0x01"
            className = 'Applet'
        }
        version = '1.0'
    }
}

Before you can interact with the fidesmo servers, you need to add your appId and appKey to you gradle.properties. If you don't have created an application yet, you can do so on the developer portal.

echo 'fidesmoAppId: yourAppID' >> $HOME/.gradle/gradle.properties
echo 'fidesmoAppKey: yourAppKey' >> $HOME/.gradle/gradle.properties

In order to translate Java Classes to Java Card Applets you need to have the Java card development kit. Please follow the instructions for the gradle-javacard plugin and don't forget the JC_HOME environment variable to your shell.

export JC_HOME='../path/to/sdk/java_card_kit-2_2_2/java_card_kit-2_2_2'

To build and upload your executable load file run:

./gradlew uploadExecutableLoadFile

In order to (re)-install you application to a Fidesmo card using you card reader, run the following command:

./gradlew installToLocalCard

This will take the first defined applet and create an instance of on the card with the same aid as the applet.

Android phone as card reader

This has been discontinued due to reliability issues.

Console

To start up the APDU console one must make sure to disabled the gradle daemon and silence all other output from gradle. This can be done using:

./gradlew --no-daemon -q console

Commands are sent using the send command, e.g.

send 00A404000BA00000061702000200000100

To show the a list of all commands use the help command. To exit the console use the exit command

Assign a specific AID to the applet instance

When installing an applet to a Fidesmo card, the default behavior of the plugin is to assign an instance AID derived from the applet AID specified as above. If by any reason you want to assign a different AID (for example, because you want to use your own RID), add the following lines to build.gradle:

fidesmo {
    instanceAid = 'yourInstanceAid'
}

Additional features

Since the fidesmo plugin is based on the javacard plugin, all its features can be used as well. Here is a short non-complete list:

  • Adding additional exp files
  • Support testing with JCardsim
  • Building without Javacard SDK

To use those features please refer to the documentation of the javacard plugin.