Identify Java Card Technology.
Java Card Architecture.
Identify Elements of Java Card
Communicating with a Java Card Applet.
Java Card Language Limitations .
What is a Java Card?
Adoption of Java Platform for usage on
Dialect of Java for programming smartcards.
Subset of Java (due to hardware constraints)
No threads, doubles, strings, garbage collection,
and very restricted API.
With some extras (due to hardware peculiarities)
Communication via APDUs or RMI.
Persistent & transient data in EEPROM &RAM.
Smart Card ?
A smart card is a plastic
card that contains an
Our very Own UID-CardUID-Card!
Cell Phone SIM Cards
Smart Cards are good! How?
They store and process Information.
Smart Cards Can be used to add
authentication and secure access to
information systems that require a
high level of security.
Properties of Smart Cards
Highly secure-Tempering with one, results
in destruction of the information it
Don’t contain battery- Become active
when connected with a card reader.
Come in two forms Contact or Contact
Contact or Contact Less?
Contact smart cards work
by communicating via
physical contact between a
card reader and the smart
Contact less smart cards
communicate by means of
a radio frequency signal,
with a typical range of less
than 2 feet.
Elements of Java Card
A complete Java Card application consists of :
A back-end application
A host (off-card) application
An interface device (card reader )
The on-card applet
And supporting software
Back-End Application and
Provide connectivity to security systems
In an electronic payment system, the back-
end application could provide access to
credit card and other payment information
The Reader-SideThe Reader-Side
Consists of two parts:
Card Acceptance Device
Think of a bank machine:
Host Application as the Computer that provides
interaction with the system
Card Acceptance Device being where you put
your debit card in.
One or more Java Applets
Card’s operating System
Java Card Runtime
• Java Card Virtual
• Java Card Framework
Communicating with a Java
Two methods for communicating with Java
1. Fundamental message-passing model ,
communication via APDUs, as defined in
2. Java Card Remote Method Invocation
(JCRMI) which is a subset of J2SE RMI
• Standard describing the protocol for
communication between smartcard and
• Messages are called APDUs (Application Protocol
Data Units), which are sequences of bytes in a
• Terminal sends command APDU to card, card
sends a response APDU back .
Message passing model
All Java Card applets extend the Applet base class and
must implement the install() and process() methods.
JCRE calls install() when installing the applet, and
process() every time there is an incoming APDU for the
APDU: a logical data packet that's exchanged between
the CAD and the Java Card Framework (It is considered
as the center piece for the Message-Passing Model) .
CLA Class byte
INS Instruction byte
Lc Length of data block
Data Lc bytes of data
Le Length of expected response
Data : Le bytes of data
SW1, SW2 : Status word
APDU coding conventions
Some conventions for CLA, INS etc. given in
ISO 7816-4 & Values for SW1, SW2(set by ISO).
Every time there is an incoming APDU for a selected
The JCRE invokes the applet's process() method
The incoming APDU is passed as an argument
The applet must:
• parse the command APDU
• process the data
• generate a response APDU
• and return control to the JCRE
Java Card I/O with APDUs
Java Card platformJava Card platform
smartcard hardwaresmartcard hardware
incl. applet ID
OS selects applet
and invokes its
Java Card RMI (JCRMI)
The second communication model relies on a subset of
the J2SE RMI distributed-object model
a server application creates and makes accessible
a client application obtains remote references to
remote objects, and then invokes remote methods
In JCRMI, the Java Card applet is the server, and the
host application the client
Smart Card Hardware
Program code of VM, API, and pre-installed
Persistent storage of the data, incl. objects with
their fields, and program code of downloaded
Transient storage of data, eg stack.