in 未分类

Overview of Java SIM GSM03.19

Sun gave out the specification of the JCDK(2.2.1 or 2.2.2), ETSI gave out the specification Java SIM GSM03.19. GSM03.19 included the java package sim.access and sim.toolkit, with the sim.access, we can access the GSM data and file system, compliant to the GSM11.11. with the sim.toolkit, we can handle the TLV input and output from the SIM card, which is compliant to the GSM11.14, in one word, by using GSM03.19, we can do all the things Native STK program previously can do. let’s have a brief overview about this.

First we have to import the package.

import sim.toolkit.*;
import sim.access.*;
import javacard.framework.*;

Easy example about the sim.access

Declare the SIMview instance, sim.access.SIMView, the instance name is gsmFile.

private SIMView gsmFile;

if we want to read the SMSP(The SMS center, 6F42) in the SIM card, we can do as below,

gsmFile.select(SIMView.FID_DF_TELECOM );
gsmFile.select(SIMView.FID_EF_SMSP);
gsmFile.readRecord((short)0x01,(byte)0x04,(short)0x18,Alphalength, (short)0x00, (short)0x01);                                           
gsmFile.readRecord((short)0x01,(byte)0x04,(short)0x19,byteArrayBuffer, (short)0x00, (short)(Alphalength[0]));

the SMSP will be stored in the byte Array ‘byteArrayBuffer’ which was declared in advance.

 

Easy example about the sim.toolkit

Declare the Handler instance, 

ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();

We can construct SMS APDU by below methods,

proHdlr.init((byte) PRO_CMD_SEND_SHORT_MESSAGE, (byte)0x00, (byte)DEV_ID_NETWORK);
proHdlr.appendArray(AlphaBuffer, (short)0x0, (short)0x2);              
proHdlr.appendTLV((byte)(ToolkitConstants.TAG_ADDRESS), byteArrayBuffer,
                  (short)0, (short)(Alphalength[0]));
proHdlr.appendTLV((byte)(ToolkitConstants.TAG_SMS_TPDU), TPDU,
                  (short)0, (short)(byteBuffer));                                         
proHdlr.send();

There are 6 Handler we can use in GSM03.19, we can find more detail in the specs, here give the inheritance structure of the 6 Handler.

java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.EditHandler
              |
              +--sim.toolkit.EnvelopeResponseHandler
 
java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.EditHandler
              |
              +--sim.toolkit.ProactiveHandler
 
java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.EnvelopeHandler
 
java.lang.Object
  |
  +--sim.toolkit.ViewHandler
        |
        +--sim.toolkit.ProactiveResponseHandler

Write a Comment

Comment