Search code examples
nfcjavacardsim-cardglobalplatformhandset

Does NFC SIM Cards have an internal antenna? How to install applets on SIM cards?


I was searched about NFC SIM cards and found such explanations about them here and there:

For those who want to use near field communication technology but don’t currently have an NFC compatible smartphone, there are other ways to enable NFC on your phone without trading it in for an expensive new model. Both SIM and SD cards can be equipped with NFC chips, and some companies currently offer or are preparing to offer these options so more customers can start using NFC technology.

The questions that I have now are:

  1. Does NFC SIM cards have an internal antenna too, or the handset must provide the NFC antenna for the NFC SIM, itself?
  2. If the NFC SIM hasn't internal antenna and phone needs to provide antenna for SIM,(it means that the handset must be NFC Compatible, right?) why we need NFC SIMs? Can't we simply use the NFC Chip of our handset instead of the NFC Chip of the SIM.
  3. In the other words, is there any handset outside that has NFC Antenna, but doesn't have NFC Chip? or is there any way to add an antenna to an old handset in order to use NFC SIM in it?

Anyway, let assume that I want to install the following applet (its source) on my SIM:

import sim.toolkit.ToolkitInterface;
import sim.toolkit.ToolkitRegistry;
...
import javacard.framework.ISOException;

public class STKTest extends Applet implements ToolkitInterface {

public static void install(byte[] bArray, short bOffset, byte bLength) {
    // GP-compliant JavaCard applet registration
    new STKTest().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}
//this method handles standard APDU commands
public void process(APDU apdu) {
    // Good practice: Return 9000 on SELECT
    if (selectingApplet()) {
        return;
    }

    apdu.setIncomingAndReceive();
    final byte[] buf = apdu.getBuffer();
    switch (buf[ISO7816.OFFSET_INS]) {
    case (byte) 0x00:
        //do something
        break;
    }
}
//this method handles the SIM Toolkit commands
public void processToolkit(byte event) throws ToolkitException {
    switch (event) {

    case ToolkitConstants.EVENT_TIMER_EXPIRATION:
        //do something
        break;
    }
}

}

The question is: can I use GlobalPlatform commands to install my applet (Just like regular smart cards) or based on this presentation in DefCon, I must use Envelope Commands, SMS Packets and OTA technology for it?

And the final question is about contents of this article(An introduction to SIM card application development). In some pages (page 16 and 17 for example), the guy is mentioned that there are some GlobalPlatform 3 compatible SIM cards available now. But as far as I know, the last version of GlobalPlatform Specification for Smart Cards is GlobalPlatform 2.3 (Wasn't published in the time of the article). So what is the GlobalPlatform 3 specification that the writer mentioned in his article?


Solution

  • This is rather a problem of terminology.

    Usually, "an NFC SIM card" means a SIM card, that can communicate directly with NFC antenna of the handset and use it as a contactless interface. The obsolete V6 pin (originally used as the additional voltage supply) is used for communication between SIM and the antenna in this case, that is why it is often called SWP communication ("Single Wire Protocol", see this Wikipedia article). Most of modern SIM cards used these days are these NFC SIM cards.

    However, there are also "special" SIM cards and even microSD cards (with Java Card support!) out there on the market, which already contains the NFC antenna and which can communicate directly to the smart card reader without antenna in the phone. These SIM cards are rarely used, because they are quite expensive and they are rather functional prototypes than products ready for everyday usage. I tested a few of them several months ago and they were quite buggy, their performance was poor and their contactless field was not very reliable. This can change very soon, of course.


    Yes, you can use Global Platform to install your applet on the SIM card. SIM cards by big players on the market (e. g. Gemalto) follow Global Platform standard. There is no need of the OTA access.