This discussion is archived
1 Reply Latest reply: Apr 3, 2013 3:03 AM by Umer RSS

Store array of objects in Java Card 2.2.1 platform

999263 Newbie
Currently Being Moderated
Hi all,

I am new to smart card development and developing a demo e-wallet application using Java Card 2.2.1 SDK. I'd like to store last 10 transactions in card and create getter-setter methods. The structure of Transaction that i thought as follow:
public class Transaction {
     private byte type; // + or -
     private short amount;
     private byte[] date;
[Date format: "yyyy-MM-dd HH:mm:ss"]
And transactionList:
public class TransactionList {
     protected short currentIndex = (short) -1;
     protected Transaction [] list = new Transaction [10];
In my desktop application i have already called card's selectApplication(); / getBalance(); / setBalance(); / getWalletId(); / setWalletId(); methods. I need to create a method [getLastTransactions] in card project and call it from my desktop application.

<font size="2">How should I set up a structure for this issue?</font>
  • 1. Re: Store array of objects in Java Card 2.2.1 platform
    Umer Journeyer
    Currently Being Moderated
    First of all don't allocate memory other than the constructor.

    As you know you cannot return an object as a response from a java card so what you will get is just bytes of data. So create a byte[] of size equal to LAST_10_TRANSTION_SIZE and then by TLV store data into that array and upon receiving on host side decode it using the TLV.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points