-1

As I saw in GitHub, MuscleApplet is outdated. I would like to know what is the best way to store data persistently on java smart card?

Data are consist of Name, Family, Picture, and Description.

All fields have dynamic length, so I don't want to consider a static byte array to each one.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
Hana Bzh
  • 2,212
  • 3
  • 18
  • 38
  • You seem to compare different concepts in your question. An application (MuscleApplet) is not the same as a programming concept (byte arrays). And a Decryption simply does not exist, it's not something that is a property of a person. – Maarten Bodewes Mar 02 '14 at 10:50
  • I wanted to use option 3 of your below answer, and MuscleCard (as I know) has a MemoryManager class to dynamically assign memory to data which you want to store and manually handle the loss of garbage colection. but in ReadMe file of this open source project you'll see that it's outdated and better not to use. So my question is whether there is any other solution like muscle card in order to handle dynamic memory management. – Hana Bzh Mar 02 '14 at 11:46
  • And sorry for the word Decryption, that was an auto complete mistake and it was Description – Hana Bzh Mar 02 '14 at 11:47

1 Answers1

1

I'll answer the programming part of your question.

There is three ways to store dynamic data in an Applet:

  1. Create a byte array created at personalization time. This is only useful if the property is static once the card has been personalized (i.e. in the operational phase).

  2. Create a static byte array for each card, and save the length during personalization. This has the drawback that there is a maximum size for each property, but the size is now configurable, even during operational phase.

  3. Create a data structure out of multiple byte arrays and primitive types and dynamically allocate / free byte arrays for it.

Note that to deallocate memory (for option 3) you will have to rely on the - rather primitive, and possibly unavailable - garbage collection provided by the Java Card runtime.

Also note that if you have many card owners you need to calculate the maximum memory usage for each person. If you want each user to be able to store the same number of properties then allocating the maximum size for each field should not be an issue.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263