HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

One of the coolest pieces of technology I'd ever used was a programming interface for HK Systems' mechanical cranes. However, my coolness factor just went through the roof when I got a chance to try out the Cyberflex Open 16k Development Kit from Schlumberger Smart Cards and Systems. Schlumberger is well known in high-tech oilfield and measurement systems, and the Cyberflex development team is part of their Testing and Transactions group. The Java Card technology offers some exciting opportunities for building security and "wallet" applications using the Java language, and Schlumberger is at the forefront of this effort.

Product Installation
The Cyberflex kit ships with a Litronic 210 card reader, two Cyberflex smart cards and the development software on a CD-ROM. The installation process itself is straightforward; it's built with DemoShield so it behaves like a typical product installation. There are four pieces of software to install: the Microsoft Smart Card Base Components, the Litronic 210 Reader Driver, the Cyberflex Toolkit and the Cyberflex Documentation and Samples. Each installation requires a reboot operation, which slows down the overall installation, but it still took only ten minutes to install everything. The biggest challenge is getting the Litronic card reader plugged in and operating, as it uses a 25-pin serial adapter to connect to your workstation. Since I was running on a laptop, I was forced to dig into my bag of tricks and find a 25-pin to 9-pin converter (which Schlumberger is now including in their kits). The reader is powered off the keyboard connector, and I was able to connect my external mouse and the reader power supply into the same port without difficulty.

Developing a Java Card Application
I'd advise you to read through the Programmer's Guide and the Java Card 2.0 specification document before you try working with the software. The Java Card 2.0 API is based on the ISO 7816 framework for smart cards, and not all smart card vendors implement all features for all parts of the ISO 7816 standard. Although I don't have a background in smart-card programming, I could follow the manual fairly easily. There are several key terms to understand before you get rolling. The first is Application Protocol Data Unit (APDU), the message you send between your application and the smart card. The Card Acceptance Device (CAD) is the physical device into which the smart card is inserted. The Java Card Runtime Environment (JCRE) is the Java Card Virtual Machine and core Java Card API classes. You should also remember that, by definition, objects on the Java Card are persistent, i.e., values persist from one CAD session to the next.

Schlumberger provides a number of sample applications as Java source files along with the development kit, and I suggest you start with the examples before striking out on your own. While the Java Card technology is powerful, you have to get used to working in a 16 K environment again, and the command language for ISO 7816 can be somewhat limiting if you aren't used to it. The Java applications you build use only Boolean, byte and short data types; your code must be derived from the applet class and compiled with the debugging option set, even for production code.

I ignored convention and started with the most complex of the four sample applications, the Wallet application. I used Oracle's JDeveloper 1.0 to open the Java source code for Wallet and followed the instructions in the tutorial for compiling and testing the application. You'll find the instructions at this point a trifle unclear since you need to use the simulator class libraries to test your program and the tutorial doesn't explicitly point you toward that. In general, I found the printed documentation a bit skimpy, but the Cyberflex Web site (www.cyberflex.slb.com) has a good newsgroup bulletin board. Thanks to the numerous postings from Schlumberger's Anthony Chen, I quickly figured out that I had the wrong libraries. Once I fixed that problem, I used the APDU simulator to test the Wallet program (see Figure 1).

Figure 1
Figure 1:

Deploying the Code
The APDU Manager, part of the Cyberflex toolkit, allows you to input commands and data to your program as if the code was running on the Java Card itself. On the left-hand side of the panel is the input window, which you can use to input a command string to your Java program. The right-hand panel of the form shows the output from the program after processing your command. The simulator offers some clever additions, such as the ability to save commands for later reuse. Once I successfully tested the program with the simulator, I used the MakeSolo utility to convert my Java class file into a stand-alone executable program and deployed the code to the Java Card without difficulty.

Building Your Own Program from Scratch
Once you're ready to begin developing programs from scratch, Schlumberger provides a simple, elegant skeleton Java program from which you can base your code. The skeleton code is derived from the Java applet class, and there is basically a five-step process to build your own program. First you create the applet name and class of instruction (CLA), then definitions for the primitive commands you'll be supporting. Next you define and allocate your instance variables for the application and create your class methods for the processing you plan to support in your program. The final step is to connect your methods to the APDU framework, which connects the messaging from the card to your application. Some restrictions are imposed on your code by the framework, and I'd suggest that you read the "Programming Requirements" section of the Developer's Guide before you start designing your own custom program.

Final Notes
Schlumberger is branding a complete line of smart technology under the Smart Village trademark, and they can print their Cyberflex cards with your company logo and information. The cards themselves have the same dimensions as a credit card with a small gold chip on the surface. Schlumberger's Cyberflex Open 16k Development Kit is worth looking into if you're considering using the technology for security or payment systems. Some other things you can get involved with are ID/personnel information, health care and telecommunications.

About the Author
Jim Milbery is an independent software consultant based in Easton, Pennsylvania. Jim can be reached at [email protected] or via his Web site at www.milbery.com


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.