Site Tools

Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcre:5.1_events_that_clear_transient_objects

5.1 Events That Clear Transient Objects

Persistent objects are used for maintaining states that shall be preserved across card resets. When a transient object is created, one of two events is specified that causes its fields to be cleared. CLEAR_ON_RESET transient objects are used for maintaining states that shall be preserved across applet selections, but not across card resets. CLEAR_ON_DESELECT transient objects are used for maintaining states that must be preserved while an applet is selected, but not across applet selections or card resets.

Details of the two clear events are as follows:

  • CLEAR_ON_RESET - The object's fields (except for the length field) are cleared when the card is reset. When a card is powered on, this also causes a card reset.

Note - It is not necessary to clear the fields of transient objects before power is removed from a card. However, it is necessary to guarantee that the previous contents of such fields cannot be recovered once power is lost.

  • CLEAR_ON_DESELECT - The object's fields (except for the length field) are cleared whenever the applet is deselected and no other applets from the same package are active on the card. Because a card reset implicitly deselects the currently selected applet, the fields of CLEAR_ON_DESELECT objects are also cleared by the same events specified for CLEAR_ON_RESET.

The currently selected applet is explicitly deselected (its deselect method is called) only when a SELECT FILE command or MANAGE CHANNEL CLOSE command is processed. The currently selected applet is deselected and then the fields of all CLEAR_ON_DESELECT transient objects owned by the applet are cleared if no other applets from the same package are active on the card, regardless of whether the SELECT FILE command:

  • Fails to select an applet
  • Selects a different applet
  • Reselects the same applet

Copyright © 2005, Sun Microsystems, Inc. All Rights Reserved.

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