Home > Dev Tools > Developer Suite > Examples > ePurse

ePurse   

pdf Mail Impression

Purpose and description of the example

This example illustrates:

  • How to develop Java Card Applets in Developer Suite
  • How to test this type of applet using JCardManager as a client application.

This applet is a simple electronic purse applet that supports the following APDU commands:

  • Get Balance
  • Debit
  • Credit

Here is the definition of these APDU Commands:

Get Balance
Description: This command allows you to read the purse balance.
CLA INS P1 P2 Lc Data In Le Data Out
90 10 00 00 00 - 02 Balance

  

Debit
Description: This command allows you to debit the purse balance.
CLA INS P1 P2 Lc Data In Le Data Out
90 12 00 00 02 Amount to be debited 02 Updated balance

  

Credit
Description: This command allows you to credit the purse balance.
CLA INS P1 P2 Lc Data In Le Data Out
90 14 00 00 02 Amount to be credited 02 Updated balance

  

How to download the applet?

In order to download and test the applet:

  • On a card simulator: After importing the ePurse Project in Developer Suite, run it in debug. This will automatically:
    • Launch the Card Simulator
    • Load the STK Commands Applet
    • Start the JCardManager
  • On a real card: After importing the ePurse Project in Developer Suite, you will have to manually:
    • Run the ePurse Applet load script: ePurse_load.gxsc
    • Start the JCardManager from the ‘Developer Suite’ menu

How to test the applet

We will use JCardManager as a client application for testing and debugging this applet.

Selecting the ePurse Applet

 
Before we issue any APDU to our Applet, let’s first select it.
Its AID is A000000018FF00000000000000000102

Issuing APDU Commands to the ePurse Applet

 
Now, we may issue the GetBalance, Credit and Debit APDU to the Applet.

You may either create the APDU Commands by yourself or run the APDU_Commands.atf script available in the Project, both using the JCardManager.

Files

Developer_Suite_-_Examples_-_ePurse.pdf