Previous Table of Contents Next


The FlexCash Card Browser and Editor

The FlexCash card browser/editor program lets you toggle the Cyberflex card between being an off-the-shelf Version 1.0 Java Card and being a FlexCash card and, in turn, one of the three imaginary e-purse cards. When the card is set to be a Java Card, you can send the card any of the commands supported by the Java Card 1.0 bootstrap loader, including sending it a new Java program to run. The Java Card 1.0 bootstrap loader command set is implemented by code that is stored in and run from the ROM of the Cyberflex card. Since the point of the Cyberflex card is for you to provide the code that turns it into whatever card you like, there are just enough commands in the command set to let you get your code onto the card securely and kick it off. Here is the list of Java Card 1.0 boot loader commands:

  Select File
  Verify Key
  Create File
  Read Binary
  Write Binary
  Set Default ATR
  Execute Application

The only two of these commands that you haven’t seen before in reading about ISO 7816 smart cards and that are in fact atypical for off-the-shelf smart cards are Set Default ATR and Execute Application.

The Set Default ATR command lets you set the ATR returned by the card when it is reset. The ATR from a smart card identifies what applications or application suites the smart card contains. It is used by smart card terminals and host application programs to determine if they are able to deal with the card. If you are going to make a Java Card behave like one or more existing smart cards, or if you are going to make it behave like a brand new smart card, you have to be able to set the ATR to meet the requirements of the terminals and host programs with which it will communicate. If you don’t reset the ATR, the card simply identifies itself as an unprogrammed Java Card.

The Execute Application command instructs the card to execute your program when it is reset rather than the Java Card bootstrap loader. This is how your program takes over the Java Card and turns the card into the card defined by your program rather than a generic Java Card.

Rather than sporting a rich set of ISO 7816 commands, the Cyberflex card offers a rich set of function calls to your on-card program. It is your program that defines the commands to which the card responds. The commands supported by an off-the-shelf Java Card are only those needed to get your program onto the card and to let your program take charge of the card.

When the card is set to be a FlexCash card, you can send the card any of the commands supported by the FlexCash program in Listing 11.1. An executable version of this program is stored in and run from the transparent file 222216, which is in the master file of the Cyberflex card. After the program was loaded into this file, an Execute Application command was sent to the card telling it to “become” the program in file 222216; that is, to run the program in this file when it was reset. Once this is done, the card responds only to the commands implemented by the program and only the program can turn the card back into a Java Card.

Once we have turned the Java Card into a FlexCash card, we are ready to build the host application—a FlexCash card browser and editor that communicates with this card.

Figure 11.3 shows the human interface to the FlexCash card browser and editor and Listing 11.2 shows the MFC C++, which implements this human interface and the program behind it.


Figure 11.3.  The Human Interface of the FlexCash card browser and editor.


Previous Table of Contents Next