Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcre:5._transient_objects

5. Transient Objects

Applets sometimes require objects that contain temporary (transient) data that need not be persistent across CAD sessions. The Java Card platform does not support the Java programming language keyword transient. However, Java Card technology provides methods to create transient arrays with primitive components or references to Object.

Note - In this section, the term field is used to refer to the component of an array object also.

The term “transient object” is a misnomer. It can be incorrectly interpreted to mean that the object itself is transient. However, only the contents of the fields of the object (except for the length field) have a transient nature. As with any other object in the Java programming language, transient objects within the Java Card platform exist as long as they are referenced from:

  • The stack
  • Local variables
  • A class static field
  • A field in another existing object

A transient object within the Java Card platform has the following required behavior:

  • For security reasons, the fields of a transient object shall never be stored in a “persistent memory technology.” Using current smart card technology as an example, the contents of transient objects can be stored in RAM, but never in EEPROM. The purpose of this requirement is to allow transient objects to be used to store session keys.
  • Writes to the fields of a transient object shall not have a performance penalty. Using current smart card technology as an example, the contents of transient objects can be stored in RAM, while the contents of persistent objects can be stored in EEPROM. Typically, RAM technology has a much faster write cycle time than EEPROM.
  • Writes to the fields of a transient object shall not be affected by “transactions.” That is, an abortTransaction never causes a field in a transient object to be restored to a previous value.

This behavior makes transient objects ideal for small amounts of temporary applet data that is frequently modified, but that need not be preserved across CAD or select sessions.

javacard/jcre/5._transient_objects.txt · Last modified: 2017/05/13 04:07 (external edit)