Java Reference
In-Depth Information
Another difference is in the standard libraries supported. Given the peculiarity of the card envi-
ronment, standard libraries were completely rewritten. The system libraries available for a stan-
dard Java Card Runtime Environment (JCRE) are the following.
•
java.lang
package. A tiny subset of its counterpart for the Java 2 platform. Only a few
classes are present, and these have been heavily shortened. First of all, the
Object
class
provides only the default constructor and the
equals
method. Other classes in this pack-
age are
Throwable
and
Exception
; and nine subclasses, including
NullPointerException
.
•
javacard.framework
package. Provides core functionalities for Java Card applets, such
as the
JCSystem
class that substitutes the
System
class in other Java platforms. The most-
used classes of this package are the
Applet
class, from which all applets must subclass;
the
APDU
class, which we will see in a while; and
PIN
,that is an equivalent of the pass-
word used to authenticate cardholders (PIN is an acronym for personal identification
number).
•
javacard.security
and
javacardx.crypto
packages. These are intended to be used
together for providing cryptographic services to card applets. They don't provide con-
crete implementations; these are left to the JCRE manufacturer, with the help of the
underlying card vendor's implementations. Finally, a curiosity: Due to the United States
export regulatory requirements, the
javacardx.crypto
package has been defined as an
extension package.
Another remarkable difference is in the naming convention for packages and applets because
they need to be compliant with the mentioned ISO 7816 standard for smart cards. This naming
convention forces applets and packages to be identified by an application identifier (AID)
sequence of bytes. Intuitively, these byte strings look similar to IP addresses, in that groups of
these addresses are assigned by an external committee and then companies specify the exact
address within their assigned namespace. The first five bytes represent the company id, and are
assigned by the ISO external authority. Then, a variable number of bytes (from zero to 11) are
defined internally by the company to name its products.
Now that we have examined the platform, we are ready to examine the card runtime environ-
ment.
The Java Card Runtime Environment
Before getting into the details of the JCRE, it is important to describe the lifecycle of an applet
inside a smart card. Figure 5.7 describes it, highlighting the main stages that a Java-enabled
smart card passes through.