Sun Oracle Logo


Development Kit User’s Guide

Java Card 3 Platform, Version 3.0.3

Classic Edition

October-2010



Contents

Figures

Tables

Code Examples

Using This Documentation

Who Should Use This Document

Before You Read This Document

Related Documentation

Third-Party Web Sites

Documentation Feedback

Part I Setup, Samples and Tools

1. Introduction

Java Card 3 Platform Architecture

Java Card TCK

2. Developing Classic Edition Applications

Classic Applet Development Process

Classic Development Kit Tools

Using the Classic Tools

3. Installation

Prerequisites to Installing the Development Kit

Install and Setup the Development Kit

procedure iconsmall spaceDownloading the Development Kit

procedure iconsmall spaceSetting Up the System Variables

Installed Files and Directories

Contents of All Releases

Contents of the Source Release

Uninstalling the Development Kit

4. Running the Samples

General Procedures for Building and Running the Samples

Building and Running the Samples

Running the classic_applets Samples

HelloWorld Sample

procedure iconsmall spaceRun the HelloWorld Sample

Channels Sample

procedure iconsmall spaceRun the Channels Sample

Service Sample

procedure iconsmall spaceRun the Service Sample

Utility Sample

PIN Protection

Storage of Portfolio

Stock Trading

Get Information On a Stock

procedure iconsmall spaceRun the Utility Sample

Wallet Sample

procedure iconsmall spaceRun the Wallet Sample

ObjectDeletion Sample

PhotoCard Sample

RMIPurse Sample

procedure iconsmall spaceRun RMIPurse

SecureRMIPurse Sample

SignatureMessageRecovery Sample

Message Recovery Order of Operations

Sample Application

procedure iconsmall spaceRun SignatureMessageRecovery

Running the reference_apps Samples

Biometry Sample Application

How the Biometric API Works

Implementation Notes

procedure iconsmall spaceRun the Biometry Sample

JavaPurse Sample Application

procedure iconsmall spaceRun the JavaPurse Sample

JavaPurseCrypto Sample

procedure iconsmall spaceRun the JavaPurseCrypto Sample

Transit Sample

procedure iconsmall spaceRun the Transit Sample

5. Converting and Exporting Java Class Files

Setting Java Compiler Options

Running the Converter

Using Delimiters with Command Line Options

Using a Command Configuration File

File Naming for the Converter

Input File Naming Conventions

Output File Naming Conventions

Verification of Input and Output Files

Creating a debug.msk Output File

Using Export Files

Specifying an Export Map

Viewing an Export File as Text

6. Compatibility for Classic Applets

Generating Application Modules From Classic Applets

Running the Normalizer

normalize Subcommands

copyright Subcommand

help Subcommand

7. Working With CAP Files

CAP File Manifest File Syntax

Sample Manifest File

Generating a CAP File From a Java Card Assembly File

Running capgen

Producing a Text Representation of a CAP File

Running capdump

8. Packaging and Deploying Your Application

Installer Components and Data Flow

Running scriptgen

Sending and Receiving APDUs

Running apdutool

apdutool Examples

Directing Output to the Console

Directing Output to a File

Using APDU Script Files

APDUScript Preprocessor Commands

Setting Default Applets

On-Card Installer Applet AID

Downloading CAP Files and Creating Applets

Downloading the CAP File

Creating an Applet Instance

On-card Installer APDU Protocol

APDU Types

APDU Responses to Installation Requests

A Sample APDU Script

Using the On-card Installer for Deletion

How to Send a Deletion Request

APDU Requests to Delete Packages and Applets

APDU Responses to Deletion Requests

On-Card Installer Limits

9. Using the Reference Implementation

Running the RI

Installer Mask

Obtaining Resource Consumption Statistics

Getting Resource Statistics With the PhotoCard Sample

RI Limits

Input and Output

Working With EEPROM Image Files

Input EEPROM Image File

Output EEPROM Image File

Same Input and Output EEPROM Image File

Different Input and Output EEPROM Image Files

The Default ROM Mask

10. Producing a Mask File from Java Card Assembly Files

Running maskgen

Order of Packages on the Command Line

Version Numbers for Processed Packages

maskgen Example

11. Building a Custom RI From Sources

Steps for Building a Custom RI

procedure iconsmall spaceBuilding the 32-Bit Custom RI

procedure iconsmall spaceTesting the 32-Bit Custom RI

procedure iconsmall spaceBuilding the 16-Bit Custom RI

12. Verifying CAP and Export Files

Verifying CAP Files

Running verifycap

Verifying Export Files

Running verifyexp

Verifying Binary Compatibility

Running verifyrev

Command Line Options for Off-Card Verifier Tools

Part II Programming With the Development Kit

13. Using Cryptography Extensions

Supported Cryptography Classes

Instantiating the Classes

14. Localizing With The Development Kit

Localization Support for Java Utilities

Localizing a Java Program to a New Locale

Localization Support for cref

15. Programming to the Java Card RMI Client-Side API

Remote Stub Object

Java Card RMI Client-Side API

Package rmiclientlib

Package clientlib

16. Working with APDU I/O

The APDU I/O API

APDU I/O Classes and Interfaces

Exceptions

Two-interface Card Simulation

Examples of Use

To Connect To a Simulator

To Establish a T=0 Connection To a Card

To Power Up And Power Down the Card

To Exchange APDUs

To Print the APDU

17. Programming for the Large Address Space

Programming Large Applications and Libraries

Handling a Package as a Separate Code Space

Storing Large Amounts of Data

Example: The photocard Demo Applet

A. Java Card Assembly Syntax Example

B. Additional Optional Ant Tasks

Location and Installation

procedure iconsmall spaceInstalling the Ant Tasks

procedure iconsmall spaceSetting Up the Optional Ant Tasks

Library Dependencies

Ant Task Descriptions

APDUTool

Errors

Examples

CapDump

Errors

Examples

Capgen

Errors

Examples

Converter

Parameters Specified As Nested Elements

Examples

DeployCap

Errors and Return Codes

Examples

Exp2Text

Errors

Examples

Maskgen

Parameters Specified As Nested Elements

Examples

Scriptgen

Errors

Examples

VerifyCap

Parameters Specified As Nested Elements

VerifyExp

Parameters Specified As Nested Elements

Errors

Examples

VerifyRev

Parameters Specified As Nested Elements

Errors

Examples

Custom Types

AppletNameAID

Example

JCAInputFile

Examples

ExportFiles

Examples

NetBeans Software Integration

Glossary

Index