简体   繁体   中英

Java Card applet EEPROM vs RAM testing

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 (eg 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?

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM