BizTalk Utilities CV ,   Jobs ,   Code library  
 
 
Page 5 of 9

 

Previous Page Table Of Contents Next Page

Subscriber Identity Modules, and Why They Matter

Creating SIM Applications

There are three steps to creating a SIM application:

 

Ø       First, you write your code in an appropriate emulator (for example JVM)

Ø       Next, you cross compile the code to suit the SIM you are using

Ø       Lastly, you transfer the code to the card

 

Obviously, as an intermediate step, you should test the code. The exact coding style and software used will depend on the type of SIM being used. Both Multos and JavaCard can be deployed on GSM-compatible smart cards, so we will look at an example of each to demonstrate how the code is structured.

JavaCard Example

This first example shows an empty framework for a JavaCard application, showing the methods that are necessary to use the application:

 

public class Loyalty extends javacard.framework.Applet {

   public void static install(APDU _apdu) {}

 

   public boolean select() {}

 

   public void process(APDU _apdu) {}

 

   public void deselect() {}

}

 

The first method is run when the application is installed, while select() and deselect() are triggered by the 'select' ADPU. However, it is process() that we are really interested in (with thanks to Dr Dobb's [http://www.ddj.com]):

 

public void process(APDU _apdu) {

   byte[] baBuffer = _apdu.getBuffer();

   if(baBuffer[ISO.OFFSET_CLA] != CLA_LOYALTY)

      ISOException.throwIt(ISO.SW_CLA_NOT_SUPPORTED);

   switch(baBuffer[ISO.OFFSET_INS]) {

      case INS_VALIDATE_PIN:

         this.validatePIN(_apdu);

         break;

      case INS_DEBIT:

         this.debit(_apdu);

         break;

      case INS_CREDIT:

         this.credit(_apdu);

         break;

      case INS_GETBALANCE:

         this.getBalance(_apdu);

         break;

   }

}

 

Here you can see that an ADPU has been passed into the application, and is evaluated to make a decision as to what to do. (In this case, it takes the form of a loyalty application that increases the points accumulated.)

Multos Example

This example shows a very basic Multos application, which again (as the above example) simply takes an ADPU in and evaluates its contents. This example does not take advantage of any of the Multos APIs that make it such a powerful system, such as those allowing access to strong cryptography and the Mondex stored cash system:

 

#include "multos.h"

#pragma melpublic

unsigned char pData[10];     /* Data received from terminal */

#pragma melstatic

unsigned char sData[10];     /* Data stored on card for application. */

 

void main(void)

{

   if(CLA != 0x90) ExitSW(0x6402);

   switch(INS)

   {

   case 0x10:                /* Command_Get Memory */

      CheckCase(2);

      prmMemoryCopyFixedLength(0x0a, pData, sData);

      ExitLa(0x0a);

      break;

   case 0x20:                /* Command_Set Memory */

      CheckCase(3);

      prmMemoryCopyFixedLength(0x0a, sData, pData);

      break;

   default:

      Exit(0x6404);

   }

}

SIM Programming Example Notes

Both of these examples are very simple, but they show that programming a SIM application is neither complex, nor very different from any other application. It is important to understand that the only communication with the outside world is via APDUs (with all the limitations that involves), and that memory is very tight (it's measured in bytes, and most applications will run out of memory in their first draft).

 

Also note that the output from your SIM application will need to be formatted into a data block followed by 2 bytes containing hex 90,00 for successful operation.

 

Page 5 of 9

 

Previous Page Table Of Contents Next Page
 

Recent Jobs

Integration Specialist Needed - Wor
Virtualization Server Infrastructur
A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En

View all Jobs (Add yours)
View all CV (Add yours)




swimming pool builder
chicago web site design
affordable conference calls
Domain Names
conference call services
Emporio armani sunglasses
answering service


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP