Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This repository contains exemplary applet providing standard functionality of crypto token (RSA signature and AES encryption/decryption). Applet code is placed in CardTask subfolder. In CardInstallerAndRunner subfolder there is a console Java-wriiten tool for applet installation/deleting and testing.

Prerequisites

  • Install Java Development Kit (JDK) 8. Don't forget to set JAVA_HOME enviromet variable.
  • Download Java Card Development Kit (JCDK). You can use JCDK 3.0.4 placed in tools subfolder. Set JC_HOME enviroment variable pointing to your JCDK folder.
  • Install Maven (or use Intellij Idea).
  • You need smart card supporting JavaCard 3.0.4+ and Global Platform 2.1.1, SCP02.

Applet building

  • Run command mvn install in the root of CardTask project. It compiles sources and generates .cap file. The cap file is copied into the root of CardInstallerAndRunner for further usage. So be sure that both subprojects CardTask and CardInstallerAndRunner are at the same level.

Note: CardTask project is configured exactly for Java Card 3.0.4. So if you want use more fresh JCDK, you must fix pom.xml and rebuild.

Applet installation onto simulator

You can try install applet onto simulator.

  • In separate cmd instance run simulator by running $JC_HOME$/bin/cref.bat.
  • Use $JC_HOME$/bin/scriptgen.bat to generate script for applet installation onto simulator (based on cap file).
  • Run the script in separate cmd instance using $JC_HOME$/bin/apdutool.bat.

Applet installation onto real card

If you have card supporting Java Card 3.0.4 (like we do) or older, you can install applet onto it.

Note: For Java Card 3.0.4 you may need exactly JDK 8. This is because more fresh JDK may cause troubles during applet compilation/installation. To install applet onto card we need to compile with target = 1.5, that is not supported for latest JDK. At the meantime target 1.6+ may cause applet istallation fail for card supporting only Java Card 3.0.4.

  • In CardInstallerAndRunner there is an implementation of secure applets installation flow based on Global Platform 2.1.1 specification. You need card supporting SCP02. Other SCP versions are not supported yet.

  • Connect your card to PC (it could be contact or contactless card) using reader. Run com.mycard.AppletInstaller main function. It reads the card, detects if applet is installed or not. If it installed already, you are proposed an option to delete it (together with related package).

  • After applet istallation you may try unit tests demonstarting basic scenarious to work with the applet.

Note: CardInstallerAndRunner folder already contains mycard.cap. It was built using JDK 8 and JCDK 3.0.4.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages