Java Card Smart Cards

PC as Smart Card Terminal
Smart Card Links

[Home Page Entry: Smart Cards and Java Card

last modified: 1. April 2006
Copyright © 2003-2005 Wolfgang Rankl, Munich
Impressum und rechtliche Hinweise


Java and Java Card

Development Tools

Examples for Java Card Applications

Simple Applet

Read and Write Data

PUT DATA and GET DATA as PC-Prototyp

PUT DATA and GET DATA as Java Card Applet

TAN-Generator, One-time-passwort Generator

Smart Card ID

Java and Java Card

Smart cards according to the Java Card specifications open the possibility with clear financial expenditure to develop programs on a smart card. In following presented information, programs and examples are to be made meant first experiences with the programming of Java Card. The moreover examples are for the software-technical connection of smart card terminals and PC as well as the appropriate structure of communication from a programming language on the following paragraph. Afterwards are another number of typical samples for Java Card applications, which can be integrated well in own applications of smart cards.

To the understanding of the following examples and samples first or parallel the appropriate sections should be read in the Smart Card Handbook.

I would be pleased about ideas for Java Card of program examples or new samples, because I intend to extend this side to a collections about Java Card source codes and patterns.

Development Tools

The Sm@rtCafe Professional PE is the Freeware version of the Java Card simulator of Giesecke und Devrient. The predecessor of the Sm@rtCafe Professional received the Frost and Sullivan Card Product innovation Award price in 1998. It is in the full version a very powerful Java Card simulator, which is used also in the professional development surrounding field. In connection with a Java development environment (e.g. JBuilder from Borland) becomes thereby a complete tool chain for the development of Java Card programs.

Download of the Freeware edition of Sm@rtCafé Professional PE (approx. 6 MByte).

Examples for Java on Java Card

The following paragraphs contain a set of source text examples of Java on Java Card. It is despite various specifications and complex compatibility efforts so far not succeeded a complete compatibility between the individual Java Card implementations of the different map manufacturers too reach. I do not have with the source text examples in principle try compatibility-critical functions to use or characteristics of Java Card. If this was however necessary for certain reasons, then is my Reference the Java Card implementation of Giesecke & Devrient.

Some of the examples leave themselves likewise as samples, i.e. as collecting mains in principle for own applications use. In order to keep the complexity low and concomitantly the clarity to true, the examples are to substantial functionality limits.

Simple Java Card Applet

The following program is a very simple Java Card applet that I used only for the configuration of a new development environment. Strictly speaking it is a somewhat developed "Hello World" for Java Card.

Simple Applet for Java Card (10. March 2004 - V 10)
CAP-File for this applet

Java Card Applet for read and write data

The following program is a simple Java Card applet for random read and write data into a data area on the smart card. It is a typical example of the smart card application "portable data memory".

READ/WRITE Applet for Java Card (22. March 2004 - V 4)
CAP-File for this applet

PUT DATA and GET DATA as PC-Prototyp

The following program is the realization of a data memory with PUT DATA and GET DATA in line with ISO/IEC 7816-4 as a prototype in Java on a PC. For the execution of this program no smart card is necessary, since it concerns thereby a pure simulation on a PC. With the commands PUT DATA and GET DATA can be stored and read BER-TLV coded data objects.

GET/PUT DATA as PC-Prototyp (8. Jan. 2002 - V 5)

Examples for command- and response APDUs (8. April 2004 - V 1) for this applet

PUT DATA und GET DATA as Java Card Applet

The following program is the realization of a data memory on a Java Card. With the ISO 7816-4 commands SELECT, PUT DATA and GET DATA data objects can be stored and retrieved from the smart card.

Applet as data storage application (13. April 2004 - V2)
CAP-File for this applet

Examples for command- and response APDUs (8. April 2004 - V 1) for this applet

TAN-Generator, One-time-passwort Generator

This applet realize a DES based generator for transaction numbers or one-time-passworts using standard ISO/IEC 7816-4 commands for administrative and operational data exchangem on a Java Card.

Applet - TAN-Generator, One-time-passwort Generator (12. May 2004 - V2)
CAP-File for this applet

Examples for command- and response APDUs (16. Sept. 2004 - V 1) for this applet

Smart Card ID

This applet realizes a identification and authentication application which is typically used in online environment. The advantage of this solution is that nearly no adinistrative overhead on the smart card side is neccessary because the card is only used for identification of the user by PIN verification and authentication of the smart card by a challenge response algorithm.

Smart Card ID is a multi purpose applet. Nearly all applications can be realised with it (e.g. physical access for room, logical access computers or information, ....). The application functionality is in the background system. Offline Terminals can use precomputed triplets for secure authentication of the smart card. For a no security authentication only the smart card ID can be used.

In the administrative phase it is possible to write after a successful verification of the administrative PIN all data objects into the memory. In the operative phase it is possible to read the unique smart card ID, to authenticate the smart card with a callenge response algorithm based on DES and to identifiay the user with his user PIN. A successful PIN verification can be checked in a secured way.

Smart Card ID (10. May 2004 - V2)