Java Card applet EEPROM vs RAM testing

944 views Asked by At

One of typical bugs in Java Card applets is using the persistent memory for temporary variables which are supposed to be in RAM.

These bugs can slow down the applet and cause some serious troubles (e.g. Symptoms of EEPROM damage).

Unit tests can hardly reveal these bugs. Unit tests access the applet as a blackbox and all they can do is to check outputs for given inputs. They can measure time and report suspiciously slow commands, of course, but overwriting a single byte in the persistent memory takes almost the same time as overwriting a single byte in RAM.

Is there any way to get rid of these bugs (other than being careful when coding)? Could I somehow detect EEPROM changes and how many of them were done when processing a particular APDU?

A good simulator could do the job, of course. However, both JCardSim (www.jcardsim.org) and NXP JCOP Tools seem to be far away from being able to report EEPROM usage statistics.

Do you know any other tool or a testing technique that could possibly help me?

1

There are 1 answers

0
Deepanshu On

A test command can be implemented and test scenario can be added which will return available memory. That can be achived by getAvailableMemory(byte memoryType);