Previous | Table of Contents | Next |
In this chapter, we will build an illustrative e-commerce application using Schlumbergers Cyberflex smart card and the Microsoft Windows PC/SC smart card infrastructure. The application consists of two programs: one for a Cyberflex smart card thats written in Java and one for a Windows PC thats written in C++.
The Cyberflex smart card runs programs written in any programming language that can be compiled into Java bytecodes (Java, Eiffel, C, C++, Ada, BASIC, and so on). A program on the Cyberflex card can communicate with applications on a personal computer or any other smart card terminal. As a result, the Cyberflex card can be programmed to do any of the following:
In this chapter, we are going to program the Cyberflex smart card to do the jobs of three e-cash cards and a loyalty card.
The Microsoft PC/SC Windows smart card infrastructure, as discussed in Chapter 7, Reader-Side Application Programming Interfaces, integrates smart cards and smart card readers in a very general way into the Microsoft Windows family of operating systems. Associated with almost any off-the-shelf smart card is a Windows library and application programming interface called a PC/SC Smartcard Service Provider (SSP) that lets your Windows program access the smart card. In this chapter, we write a Windows application in C++ and use the Cyberflex SSP.
The application programming interface on the Cyberflex card that the Cyberflex Java program uses and the application program interface on the PC that the C++ program uses both include GetMessage and SendMessage calls to communicate with the other party. On the card side, GetMessage and SendMessage are part of the Java Card 1.0 API and are implemented as Java native methods which access the ISO 7816 APDU communication capabilities of the underlying card operating system. On the reader side, the GetMessage and SendMesage functions in the Cyberflex SSP use the APDU communication capabilities on Microsofts smart card API. Thus, our program on the Java Card and our program on the host PC are communicating with bona fide ISO 7816 APDUs.
The C++ program sends a message to the Java program using SendMessage and the Java program receives the message using GetMessage.The opposite happens, toothe Java program sends a message to the C++ program using SendMessage and the C++ program receives the message using GetMessage. As discussed in Chapter 4, Smart Card Commands, the communication channel between the two programs is half-duplex, so they have to be synchronized to keep track of who is talking and who is listening. Figure 11.1 is a diagram of the relationship between the two parts of our e-commerce application program.
Figure 11.1. FlexCash application program components.
Because working on a specific problem is usually more interesting and informative than working on a general problem, well begin our application development by describing a mythical situation that our application is intended to address. After setting the stage, well discuss the design of a program for the smart card side of the application. Next, well discuss a simple protocol for moving value from the smart card to the PC program. Finally, well describe the Windows program.
For the sake of this example, assume that there used to be three competing electronic cash cards: E-Coins, E-Money, and E-Bucks. Vending machines that accepted E-Coins cards wouldnt accept E-Money cards, and point-of-sale terminals that accepted E-Money cards wouldnt accept E-Bucks cards. Convincing people to switch from one kind of hard cash to three kinds of incompatible electronic cash was an uphill battle, and a losing battle at that. Not only can I not see it, but I have to carry around three kinds of it was the lament of the technology-weary man in the street. Why cant those guys get their acts together? Well, they finally did and all agreed to use ISO 7816-37 as the e-cash standard. But what to do about all those card-specific vending machines in the field while the world switched from the three proprietary systems to a unified and standardized e-cash system?
Smart Commerce Solutions, the imaginary folks that brought you the Smart Shopper card in Chapter 10, The Smart Shopper Smart Card Program, came up with the FlexCash card. The FlexCash card carried all three electronic pursesE-Coins, E-Money and E-Bucks. When you stepped up to a vending machine that accepted only E-Coins cards, you took out your handy carry-along smart card reader, perhaps the Smart Commerce Solutions Smart Dock, and put your Smart Commerce Solutions FlexCash card into it. You pushed the E-Coins button on the Smart Dock, and the Smart Dock told the FlexCash card to start acting like an E-Coins card. You then stuck your FlexCash card in the E-Coins-centric vending machine. From the machines point of view, the Smart Commerce Solutions Smart Card was just a plain old E-Coins card, so it debited the E-Coins purse and gave you your candy bar.
Besides the three electronic purses, the FlexCash card carried a frequent buyer points purse that accumulated Smart Commerce Solutions Smart Points based on your use of the card and independent of the three obsolete e-cash protocols you once used to spend your money.
Smart Commerce Solutions (hypothetically) used Schlumbergers Cyberflex card to conduct a field trial of the FlexCash card before committing its code to ROM.
Previous | Table of Contents | Next |