Question

I am new Java card development and I want to know how to handle transactions when power is lost during a transaction. I want to know is there way to reset internally when power is lost or remove java card from card terminal. In my Java card applet I unsuccessfully tried:

  • JCSystem.beginTransaction();
  • JCSystem.commitTransaction();
  • Util.arrayCopyNonAtomic();

Is there any other way to do it?

Thanks Sajith

Was it helpful?

Solution

Within transactions writes to persistent memory such as EEPROM or flash are handled atomically. That is: as if all the writes to persistent memory are part of one big action.

To create an atomic copy you need to use Util.arrayCopy() instead of Util.arrayCopyNonAtomic(). There may also be other actions that can take part of atomicity. If actions that change persistent memory do not take part in an atomic transaction then the Java Card API will explicitly document those actions.

As indicated before, there is no method to reset a Java Card. Instead you can use JCSystem.abortTransaction().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top