Search code examples
javabytesmartcardjavacardapdu

Store Date & Time in Java Card 2.2.1 platform


I am developing a smart card application and i have to store Date info. In brief i would like to store last (10) transactions which should contains Date and Time in smart card.

Platforms used in:

  • Java Card 2.2.1
  • Global Platform 2.1.1

I found Class Date but it requires Java Card 3.0.

Is it possible to store transaction's Date/Time info in smart card using Java Card 2.2.1?


Solution

  • Yes you can store such data, but the data is wrapped into byte array or custom class containing bytes of day, month, year, hour, minute, second.

    1. The Date/Info shall be send by terminal (in APDU bytes)
    2. Your applet shall parse the Date/Time information based on format
    3. Store the parsed data in byte array or in custom class object

    If you need to calculate time span, then you need to create method to do addition/subtraction to the byte arrays.