Home > SIMagine Developer Contest > Resources
E-learnings
Sim Basics, STK, NF & SCWS
|
|
4.2 M |
Contactless
|
|
169 K |
|
|
|
91 K |
|
|
|
275 K |
|
|
|
2.8 M |
|
|
|
3.5 K |
Contactless reader driver
|
|
550 K |
Contacless STK Example
| /* * Package name */ package contactless.example; /* * Imported packages */ // specific import for Javacard API access import javacard.framework.*; import javacard.security.*; import javacardx.crypto.*; import uicc.toolkit.*; public final class exampleSTK extends javacard.framework.Applet implements ToolkitInterface, ToolkitConstants { private ToolkitRegistry reg; //Constructor public exampleSTK(byte[] bArray, short bOffset, byte bLength) { // Any process // Register ToolKit in handset reg = ToolkitRegistrySystem.getEntry(); } public final void process(APDU apdu) throws ISOException { // get the APDU buffer byte[] apduBuffer = apdu.getBuffer(); // Mask Channel number apduBuffer[ISO7816.OFFSET_CLA] &= 0xFC; byte cla = apduBuffer[ISO7816.OFFSET_CLA]; byte ins = apduBuffer[ISO7816.OFFSET_INS]; // APDU instruction parser switch (ins) { case 0x01: // do any processing here // Register to EVENT_PROACTIVE_HANDLER_AVAILABLE reg.setEvent(EVENT_PROACTIVE_HANDLER_AVAILABLE); } } /** * Method called by the Toolkit Framework */ public void processToolkit(short event) { // get the handler references ProactiveResponseHandler rspHdlr ; ProactiveHandler proHdlr; // treat each event switch(event) { // Event launch during Mchip process case EVENT_PROACTIVE_HANDLER_AVAILABLE: // TOOLKIT Process here break; } } } |

