Previous Table of Contents Next


then 00001016 will be added to the value found in the rightmost 3 bytes in the current record. The resulting 3 bytes will be written into the rightmost 3 bytes of the record previous to this record, and finally this previous record will be made the current record. The Decrease command works the same way except that the value is subtracted from rather than added to the value found in the current record.

The Increase command will not attempt to increment the value in the electronic purse above FFFFFF16 and the Decrease command will not attempt to decrement the value below 00000016. If the command with the value it contains would cause either of these situations, it is not executed and an error condition is returned. The arithmetic of the 3K Multiflex electronic purse is obviously integer arithmetic, so the units of the purse have to be defined appropriately for the application at hand—dollars, cents, pounds, pence, francs, centimes, yen, lira, and so on.

The utility of those upper 2 bits in the high nibble of byte 8 of the data associated with the Create File command is now apparent. By appropriately setting these bits, the program designer can ensure that the electronic purse can only be decremented or can only be incremented.

Now suppose the terminal is a vending machine that is going to decrement the purse and, in return for removed value, release a product to the cardholder. If all the vending machine gets to see is the 9016 0016 return from its Decrease command, it has no way of knowing if there really is an authentic purse out there that actually has been decremented or if there is just a laptop computer that is sending back the satisfactory completion status. A 9016 0016 status code is weak evidence on which to release a product.

There are a number of techniques used to counter this threat. The big brother of your 3K Multiflex smart card, the 8K Multiflex card, has stamped variants of the Increase and Decrease commands to counter this threat by letting the terminal know it is dealing with an authentic smart card. Stamped variants of the commands work just like the unstamped versions, but in addition they return information via Get Response that lets the terminal check if the operation was performed by an authentic card. The information returned by a Stamped Increase or Stamped Decrease command is

  The new value of the purse
  The amount added or subtracted from the old value
  A cryptogram

The new value of the purse information is of use primarily in online situations. It can be combined with a reading of the serial number of the card to keep a central record of cards and current values that could be checked and updated over the network.

The cryptogram is of use primarily in offline situations, such as our hypothetical vending machine. Before the Stamped Increase or Stamped Decrease command is sent to the card, the vending machine sends a sequence of 8 random bytes to the card. The card is expected to return an encryption of these 8 bytes upon successful completion of the increment or decrement. If the cryptogram returned by the card does not decrypt using a key possessed by all authentic cards, then the vending machine knows that a valid electronic purse has not been decremented and thus will not release a product.

The reason the random string of bytes is used in the protocol is to prevent replay attacks. If a fixed string were used, then an attacker could record the byte stream returned by an authentic card and simply feed that string back to the terminal with the amount adjusted to convince the terminal that an authenticated card had been decremented.

Multiflex Commands

Earlier sections describe some of the commands to which the Multiflex card responds (for example, Select File, Get Response, and Read Binary). The Multiflex smart card recognizes and responds to a total of 21 commands. These are the basic building blocks you would use to construct a Multiflex smart card application. Table 5.13 lists all 21 3K Multiflex commands.

Table 5.13. The 21 3K Multiflex commands.
Command Name Command Description Access Conditions Protected Mode

Change PIN Change the PIN in the selected PIN file. None
Create File Create a new file or subdirectory in the current directory. Yes
Create Record Create a new record in the selected record file. Yes
Decrease Make the next record in the selected cyclic file the current record minus the given value. Yes
Delete File Delete a file from the selected directory. Yes
External Authentication Retrieve encrypted challenge from terminal and check. None
Get Challenge Retrieve a challenge from the card None
Get Response Retrieve information about a selected directory or file. None
Increase Make the next record in the selected cyclic file the current record plus the given value. Yes
Internal Authentication Retrieve the encryption of the challenge from the card. Yes
Invalidate Completely block access to the selected file. Yes
Read Binary Read data from a section of the selected transparent file. Yes
Read Record Read a record from the selected linear elementary file. Yes
Rehabilitate Remove the block on the selected file. Yes
Seek Search the selected record file for records containing a given byte string.
Select Make the file with the given file identifier the selected file. None
Unblock PIN Unblock a blocked PIN. None
Update Binary Overwrite data in a section of the selected transparent file. Yes
Update Record Overwrite a record in the selected linear elementary file. Yes
Verify PIN Present a PIN to the smart card. None
Verify Key Present a cryptographic key to the smart card. None


Previous Table of Contents Next