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 :
- to use
GPTool
andGlobalPlatform
class undertest
which provide the same power as GlobalPlatformPro tool - to use
GPExec
gradle task to call GlobalPlatformPro from gradle to create custom tasks
git clone git@github.com:bertrandmartel/javacard-tutorial.git
cd javacard-tutorial
git submodule update --init
./gradlew build
http://javacard.vetilles.com/2006/09/17/hello-world-smart-card/
The following will build, delete applet if existing, install the applet :
./gradlew :jc101-1c:build :jc101-1c:installJavaCard
./gradlew :jc101-1c:test
./gradlew :jc101-1c:test -DtestMode=smartcard
From gradle script task :
./gradlew :jc101-1c:sendHello
http://javacard.vetilles.com/2006/10/30/jc101-2c-a-simple-counter-for-smart-card-developers/
The following will build, delete applet if existing, install the applet :
./gradlew :jc101-2c:build :jc101-2c:installJavaCard
./gradlew :jc101-2c:test
./gradlew :jc101-2c:test -DtestMode=smartcard
From gradle script task :
- balance
./gradlew :jc101-2c:balance
- credit 5
./gradlew :jc101-2c:credit
- debit 5
./gradlew :jc101-2c:debit
- http://javacard.vetilles.com/2006/11/07/jc101-3c-a-real-application/
- http://javacard.vetilles.com/2007/02/06/jc101-4c-a-basic-password-manager/
- http://javacard.vetilles.com/2008/01/07/jc101-5c-data-management-and-transactions/
- http://javacard.vetilles.com/2008/01/15/jc101-6c-specifying-the-apdus/
- http://javacard.vetilles.com/2008/04/05/jc101-7c-processing-apdus-12/
- http://javacard.vetilles.com/2008/04/09/jc101-8c-processing-apdu%E2%80%99s-22/
The following will build, delete applet if existing, install the applet :
./gradlew :jc101-password:build :jc101-password:installJavaCard
./gradlew :jc101-password:test
./gradlew :jc101-password:test -DtestMode=smartcard
From gradle script task :
- add password entry
./gradlew :jc101-password:addPassword
- delete password entry
./gradlew :jc101-password:removePassword
- list identifiers
./gradlew :jc101-password:listPassword
- http://javacard.vetilles.com/2008/04/16/jc101-9c-authentication-and-lifecycle/
- http://javacard.vetilles.com/2008/04/21/jc101-10c-adding-a-password-and-state-management/
The following will build, delete applet if existing, install the applet :
./gradlew :jc101-password-pin:build :jc101-password-pin:installJavaCard
./gradlew :jc101-password-pin:test
./gradlew :jc101-password-pin:test -DtestMode=smartcard
- set pin code
./gradlew :jc101-password-pin:setPinCode
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