Java Card Technology Overview and Java Applet
Java Card Technology Overview and Java Applet
Ch03: Overview
Instructors:
Fu-Chiung Cheng
( 鄭福炯 )
Associate Professor
Computer Science & Engineering
Tatung University
Content
Architecture Overview
Java Card Language Subset
Java Card Virtual Machine
Java Card Installer and off Card
Installation Program
Java Card Runtime Environment
Architecture Overview
Java card technology enables programs
written in Java to run on smart cards and other
resource-constrained devices.
Smart cards represent one of the smallest
computing platforms in use.
How to fit Java system into a smart card?
(Smart cards have 1K of RAM,16K of EEPROM, 24K
of ROM)
Support only a subset of features
apply a split model to implement JVM
Architecture Overview
JCVM (Java Card Virtual Machine) is split into
:
Part that runs off-card
Off-card process:
Processing tasks that are not constrained
to execute at runtime
Class loading, bytecode verification,
card applications
Preserving the object-oriented capabilities
Converter interpreter
Class
files
CAP
file
CAP File and Export File
The converter loads and preprocess the class files and
outputs a CAP file
A CAP file contains an executable binary representation
of the class in Java package
A CAP file is a JAR file that contains a set of components.
Each component describes an aspect of CAP file content,
such as class information, executable bytecode, linking
information, verification information and so forth
The CAP file format is optimized for small small footprint
by compact data structure and limited indirection.
CAP File and Export File
Export file are not loaded onto smart card and
thus are not directly used by interpreter
Export file can be thought of as the header files
in C programming language
It contains public API information for an entire
package of classes
It defines access scoop, class name,
execute applets
Controls memory allocation and object creation
Network communication
Applet execution
Native methods:
Provide support to the JCVM and system
classes
Handle low-level communication protocols,
System classes
are analogues to an OS core
manage transactions
deseletion
On-Card System Architecture
Java Card Application framework classes
define the four core and extension API packages
This framework makes it relatively easy to create an
applet.
Applets access JCRE services through framework
classes.
Industry-specific extension
Add-on libraries to provide additional services or to
refine the security and system model
Example: Open Platform extends the JCRE services
to meet financial industries’ specific security needs.
On-Card System Architecture
Installer
Enables the secure downloading of software
program
Is an optional JCRE component
Manage applets
Applets installation
JCRE creates applet instance
Response APDUs)
CAD Session
After a JCRE is reset, the JCRE enters into a
loop, waiting for APDU commands from the host
The host sends APDU commands to the Java
Card, using the serial communication interface
via the card input/output contact point
When a command arrives, the JCRE either
selects an applet to run as instructed in the
command or forwards the command to the
currently selected applet
CAD Session
mechanisms
Java Card Runtime Features
Persistent and transient objects
By default, Java Card objects are persistent and
are created in persistent memory
The space and data of such objects span CAD
sessions
For security and performance reasons, applet can
create objects in RAM
Such objects are called transient objects
Transient objects contain temporary data that are
not persistent across CAD sessions
Java Card Runtime Features
Atomic operations and transaction
JCVM ensures that each write operation to a
in a transaction
Either all updates in a transaction are complete
as it executes bytecodes
JCVM permits shared data access through
java.lang
javacard.framework
javacard.security
javacardx.crypto
Java Card APIs
Classes are not supported
GUI interfaces
Network I/O
The reasons:
No display
number
provide the common form of
functions
Does not provide any implementation
Package PIX
Applet AID =
Company’s RID (Applet provider’s RID)
Applet PIX
Package and Applet Naming
Convention (cont.)
The package AID and the default applet
AID for each applet defined in the
package
Specified in the CAP file
Java Card
Step 2:
simulator
CAP
file(s)
Java Card
Step 4:
emulator
Applet Development Process
Step 1:
A developer writes one or more Java Classes
and
compiles the source code with a Java compiler
Step 2:
Applet is run, tested and debugged in a
simulation environment
The overall functional aspects of applet are
tested
Applet Development Process
Step 3:
Class files are converted to a CAP file
each package
Step 4:
CAP files are loaded and tested in an emulation
environment
Runtime behaviors of applet are tested
Applet firewall
and
creating an applet instance to bring the applet into
memory and
links the classes in the CAP file with other
byte length)
bArray: installation parameters for applet
initialization
Postissuance Applets
Installation(cont.)
The install method is an applet entry point
method, similar to the main method in Java
applications
An applet must implement the install method
The install method calls applet’s constructor to
create and initialize an applet instance
After the applet is initialized and registered with
JCRE, it can be selected and run
The install method can be called more than
once to create multiple applet instances
Error Recovery during Applet
Installation
The installation process is transactional
The installer will discard the CAP file
and any applets it had created during
installation when
Programmatic failure
Card tear
Other errors
Installation Constraints
Java Card Applet installation has two points
Applets executing on the card may refer