Page 1 of 1

How to handle java card transaction when power loss or removing the card from smartcard reader

Posted: Sun Nov 29, 2015 4:09 am
by Asineshjil
I am working on a project which uses java card for transactions. Now I am experiencing a problem.
How can we handle java card transaction when power loss or removing the card from smartcard reader?
Can I reset javacard applet internally? How can I do this?

Re: How to handle java card transaction when power loss or removing the card from smartcard reader

Posted: Wed Dec 02, 2015 8:22 am
by lightupdark
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(). 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.

There is no method to reset a Java Card. Instead you can use JCSystem.abortTransaction().