I have J2ME application that im trying to add NFC functionality to, basically I want to be able to store a balance on the Secure Element, so that my J2ME application can read, and increase (top-up). And I also want to be able to read the balance from and topup an external card, by holding the card up to the phone.

My plan is to have a class layed out like this:

public class SecureElement {

private ISO14443Connection conn;

public SecureElement() {

connect();

}

public void connect() {
try {
conn = (ISO14443Connection)Connector.open(System.getProperty("internal.se.url");
catch (Exception e) {

}
}

public int readBalance() {
/*return balance on card*/
}

public void topupBalance(int amount) {
int balance = readBalance();
balance = balance + amount;

/*write balance to card*/
}

}

So my J2ME application can create a new SecureElement, read the balance, top it up, etc. And I would have a similar class to managing the connection (a mifare connection of some kind) between the external card and the J2ME application, so I could transfer money from my phones secure element to the card by reducing the balance on the internal secure card, and increasing the balance on the external card, but ill worry about the external stuff once ive got the internal stuff sorted.

My questions are:

  • If i use the ISO14443Connection I plan to use do I have to write an applet for the secure element?
  • Is there a default applet on the Nokia 6131 secure element?
  • When I read a write to/from the card, how do I know what APDU to exchange? Ive looked at the createCommandApdu method in one of the NFC examples, but I dont know what the various arguements to this method mean, and this example requires an applet to be loaded onto the secure element which I need to avoid doing.


Can anybody help me on these questions? I basically need to know what APDUs to send (for reading and writing), and what the select apdu would be for the default (built-in) applet on the secure element, if there is one.

Thanks in advance, and apologies for not knowing very little about all this.

Dan