Previous | Table of Contents | Next |
This chapter discusses in depth the 3K Multiflex smart card that comes with this book. In Chapter 10, The Smart Shopper Smart Card Program, and Chapter 11, The FlexCash Card: An E-commerce Smart Card Application, we build illustrative smart card applications using this smart card.
The 3K Multiflex smart card contains a 5 MHz Motorola SC21 single-chip 8-bit microcontroller with 6,114 bytes of ROM, 3,008 bytes of EEPROM, and 128 bytes of RAM. The chip writes EEPROM 4 bytes at a time. It takes the SC21 7 milliseconds for a 4-byte write operation. The card uses the T=0 communication protocol and can communicate with the outside world at 9600 bps. This is the same card that is used in many smart card programs around the world.
Your Multiflex 3K card conforms to the ISO 7816-4 standard, which is covered in Chapter 4, Smart Card Commands. Communication between the card and the host uses APDUs, and the EEPROM is organized and accessed as an ISO 7816-4 file system. The card supports 21 commands, including a couple that extend the ISO 7816-4 standard (for example, a create file command that is noticeably missing from the standard).
In this chapter, we will take a detailed tour of your Multiflex 3K card. Starting with how the card responds when it is activated, we describe communication with the card at the bit and byte levels so that you know exactly what is going on. Typically, of course, you will be working on a higher-level API, but it is useful to know what is under the hood, particularly when you have to figure out why something isnt behaving as you think it should.
The microcontroller on the Multiflex card is reset by lifting the voltage on the cards reset contact for more than 50 microseconds and then lowering it. After conducting some internal consistency checks, the Multiflex operating system on the card selects the master file then transmits its 4-byte answer to reset (ATR) to the terminal on the communication line.
The ATR for the 3K Multiflex card is
3B16 0216 1416 5016
and the meaning of each of these bytes is given in Table 5.1.
ISO 7816 Name | Description | Value | Interpretation |
---|---|---|---|
TS | Bit synchronization | 3B16 | 1 is voltage high. |
T0high-order byte | Other T fields present | 00002 | No other T fields present. |
T0low-order byte | Number of historical bytes present in the ATR | 216 | Two historical bytes are present in the ATR. |
T1 | First historical byte | 1416 | Component code. |
T2 | Second historical byte | 5016 | Mask code. |
The first part of the ATR up to the historical byte tail-end is governed by ISO 7816-3. The historical byte section, however, varies widely from card manufacturer to card manufacturer. Schlumberger uses the 2-byte historical tail to identify the microcontroller on the cardthe microcontroller itself (component code) and the operating system in the ROM (mask code). A component code of 1416 means that the chip is a Motorola SC21. The mask code of 5016 means the ROM contains the Multiflex M24E-G2 operating system. Since the SC21 is a 3K part, if you put these two codes together, you get Multiflex 3K.
It would be handy if you could universally identify a smart card by its ATR. Unfortunately, many card manufacturers are secretive about the coding of their ATRs, so it is difficult to write multicard applications whose behavior depends on the ATR without doing so on an ATR-by-ATR basis. After transmitting the ATR, the card goes into a polling loop, running the same instructions over and over, listening for a command from your application program.
Mostly what you will be doing with a smart card is writing data to it and reading data from it after properly establishing your authorization to do so. First and foremost, a smart card is an active guardian of data. In this section, we cover the organization of data on the Multiflex 3K card. It is an organization you are doubtless already familiar withdirectories and filesbut there are a couple differences between directories and files on your hard disk and directories and files on a smart card.
Previous | Table of Contents | Next |