Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does `Signature.init()` rewrite persistent memory?

A few quotes from Java Card API 2.2.1:

Signature class description:

A tear or card reset event resets an initialized Signature object to the state it was in when previously initialized via a call to init(). For algorithms which support keys with transient key data sets, such as DES, triple DES, AES, and Korean SEED the Signature object key becomes uninitialized on clear events associated with the Key object used to initialize the Signature object.

Signature.init(...) description:

For optimal performance, when the theKey parameter is a transient key, the implementation should, whenever possible, use transient space for internal storage.

Does it mean that there are algorithms which require rewriting persistent memory each time Signature.init(...) is called? If yes, is there any reason for this unpleasant behaviour?

I am asking this question, because I am facing a strange behaviour in my applet. It computes ECDSA signature. After approximately 100 000 signatures the card (J2E145 by NXP) seems broken (I cannot select the applet anymore). Persistent memory damage might be the reason, because I call Signature.init(...) each time I receive the input data. Could the Signature.init(...) be the reason of this behaviour?

like image 917
vojta Avatar asked Nov 08 '22 10:11

vojta


1 Answers

Yes, Signature.init() store the reference to the key object in a persistent memory. But, I believe that the API must be implemented with a feature of "wear leveling" which should maintain the endurance of EEPROM in such scenarios.

I suggest you to come to a conclusion after checking the behavior of Cipher.init(), if the card continues its similar behavior or not.

like image 76
hsg Avatar answered Dec 05 '22 00:12

hsg