Skip to content

Examples from Eric Vétillard's tutorial re-arranged in a Gradle project

License

Notifications You must be signed in to change notification settings

bertrandmartel/javacard-tutorial

Repository files navigation

JavaCard Tutorial

Build Status Coverage Status

Examples from Eric Vétillard's tutorial re-arranged in a Gradle project using JavaCard gradle plugin with additional tests

Each example is referenced as a Gradle module with :

  • source under main sourceSet (sdk version can be selected from build.gradle)
  • simulation tests using JCardSim
  • unit test using JUnit
  • tests on smartcard device using jnasmartcardio with apdu4j logger
  • quick testing scripts defining some gradle task to send defined apdu sequence

It's also possible :

Setup

git clone git@github.com:bertrandmartel/javacard-tutorial.git
cd javacard-tutorial
git submodule update --init

Build all examples

./gradlew build

jc101-1c : basic applet

http://javacard.vetilles.com/2006/09/17/hello-world-smart-card/

install

The following will build, delete applet if existing, install the applet :

./gradlew :jc101-1c:build :jc101-1c:installJavaCard

run simulation tests

./gradlew :jc101-1c:test

run tests on smartcard

./gradlew :jc101-1c:test -DtestMode=smartcard

send apdu

From gradle script task :

./gradlew :jc101-1c:sendHello

jc101-2c : a simple counter

http://javacard.vetilles.com/2006/10/30/jc101-2c-a-simple-counter-for-smart-card-developers/

install

The following will build, delete applet if existing, install the applet :

./gradlew :jc101-2c:build :jc101-2c:installJavaCard

run simulation tests

./gradlew :jc101-2c:test

run tests on smartcard

./gradlew :jc101-2c:test -DtestMode=smartcard

send apdu

From gradle script task :

  • balance
./gradlew :jc101-2c:balance
  • credit 5
./gradlew :jc101-2c:credit
  • debit 5
./gradlew :jc101-2c:debit

jc101-password : password application

install

The following will build, delete applet if existing, install the applet :

./gradlew :jc101-password:build :jc101-password:installJavaCard

run simulation tests

./gradlew :jc101-password:test

run tests on smartcard

./gradlew :jc101-password:test -DtestMode=smartcard

send apdu

From gradle script task :

  • add password entry
./gradlew :jc101-password:addPassword
  • delete password entry
./gradlew :jc101-password:removePassword
  • list identifiers
./gradlew :jc101-password:listPassword

jc101-password-pin : password application with PIN security

install

The following will build, delete applet if existing, install the applet :

./gradlew :jc101-password-pin:build :jc101-password-pin:installJavaCard

run simulation tests

./gradlew :jc101-password-pin:test

run tests on smartcard

./gradlew :jc101-password-pin:test -DtestMode=smartcard

send pin code apdu

  • set pin code
./gradlew :jc101-password-pin:setPinCode

send apdu

From gradle script task :

  • add password entry
./gradlew :jc101-password-pin:addPassword
  • delete password entry
./gradlew :jc101-password-pin:removePassword
  • list identifiers
./gradlew :jc101-password-pin:listPassword

About

Examples from Eric Vétillard's tutorial re-arranged in a Gradle project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages