Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javacard - power loss during garbage collection

I noticed some very strange behaviour on my smartcards (NXP J2E145, J3A081, J3C145 with an Omnikey 5121 reader): A power loss right after calling JavaCard method

JCSystem.requestObjectDeletion()

can damage the card: after about 10% of such power cuts the ATR command is very slow (1000ms) and I get no response to any other APDUs (applet selection, card manager authentication etc.).

I know that the behavior of requestObjectDeletion() depends on the vendor specific implementation, so my question is quite wide and open...

Is garbage collecting processed "usually" in a single transaction?

Is there any "official" recommendation NOT to call requestObjectDeletion() in case of a possible power loss?

Do you have any similar experience with cards by NXP?

EDIT:

  • JCSystem.isObjectDeletionSupported() == true on all my smartcards.
  • When trying to connect to the card manager applet of a damaged card, the JCOP shell in Eclipse IDE reports this:

    ATR: 3BFB9600008131FE454F4450204D41502053414D3E

    ATR: T = 1
    jcshell: Unknown problems with terminal. Last terminal error: The request could not be performed because of an I/O device error.

like image 536
vojta Avatar asked Jan 26 '15 09:01

vojta


1 Answers

I think this may be an implementation bug. In general, garbage collection is never needed nor used on smart cards.

You should avoid Garbage Collection under any circumstances by good applet design. That way you should never run into memory problems. Applets are commonly installed only once in their lifetime and should be usable for the rest of the life-cycle of the card.

Garbage Collection generally takes too long for normal use cases. Maybe that is why the programmer of the Java Card or underlying system libraries didn't expect it to happen outside a secure environment.

like image 177
Paul Bastian Avatar answered Sep 19 '22 08:09

Paul Bastian