Intel

Developer Zone

MTC


com.intel.util
Class MTC

java.lang.Object
  extended by com.intel.util.MTC

public class MTC
extends java.lang.Object

This class provides an interface for applets to access the Monotonic Counters feature. This is an optional feature which can be used by applets to store an int32 value in flash, one counter per applet. This int32 value could be used to detect offline storage data replay (that is, offline stored data is resubmitted to the applet and is detected as data which is not hashed with the correct value that appears in the monotonic counter). The applet can use this class in order to get, increment, or reset its monotonic counter. Due to flash wear-out considerations, an applet is allowed to use up to 100 counter increments or counter reset operations per machine boot. In addition, the applet allowed operations counter will be reset 24 hours after the applet was installed, and every 24 hours since the last increment/reset operation.


Method Summary
static int getMTC()
Returns the current monotonic counter value of the caller applet.
static int incrementMTC()
Increments and returns the new monotonic counter value of the caller applet.
static int resetMTC()
Resets to 0 and returns the new monotonic counter value of the caller applet.
Methods inherited from class java.lang.Object
equals, hashCode, toString

Method Detail

getMTC

public static int getMTC()
                  throws UtilException
Returns the current monotonic counter value of the caller applet.

Returns:
Current monotonic counter value of the caller applet.
Throws:
UtilException - in case of internal error.

incrementMTC

public static int incrementMTC()
                        throws UtilException
Increments and returns the new monotonic counter value of the caller applet. Note that after reaching maximum integer value, the monotonic counter is reset to 0.

Returns:
The new monotonic counter value of the caller applet.
Throws:
FlashWearoutException - if the flash wearout mechanism blocked the write/erase or if the applet exhausted the number of operations allowed for the current period.
UtilException - in case of internal error.

resetMTC

public static int resetMTC()
                    throws UtilException
Resets to 0 and returns the new monotonic counter value of the caller applet.

Returns:
The monotonic counter value of the caller applet.
Throws:
FlashWearoutException - if the flash wearout mechanism blocked the write/erase or if the applet exhausted the number of operations allowed for the current period.
UtilException - in case of internal error.
UtilException