Smart cards are taking off: more than 3 billion will be in use by the end of the Year 2000. Smart card technologies and skills are in enormous demand -- especially, familiarity with Sun's Java Card API. This specification brings Java technology to smart cards, enabling card issuers to build breakthrough platform-independent solutions, run multiple applications on the same card, and respond to changing customer needs by installing applications even after a card has been issued. This book is the first complete programmer's guide and reference to the new Java Card 2.1 API. Through extensive code examples, it shows readers exactly how smart cards work -- and how to fully leverage the Java Card APIs in smart card development. Expert smart card developer and Java Card API team member Zhiqun Chen covers the entire Java Card language subset and all key programming concepts. Next, she presents a complete, integrated tutorial walking step-by-step through the creation of Java Card applets. The book also contains a thorough API reference. For all Java developers, smart card application developers, developers working with credit-card related applications, and builders of e-commerce and enterprise applications.
I. INTRODUCTION.1. From the Beginning.
Challenges in the Development of Smart Card Applications.
Applying Java to Smart Cards.
Benefits of Java Card Technology.
Brief History of Java Card Technology.2. Smart Card Basics.
Overview of Smart Cards.
Basic Card Types.
Memory Cards versus Microprocessor Cards.
Contact Cards versus Contactless Cards.
Smart Card Hardware.
Smart Card Contact Points.
Smart Card Central Processing Unit.
Smart Card Coprocessors.
Smart Card Memory System.
Smart Card Communication.
Card Acceptance Device and Host Applications.
Smart Card Communication Model.
Smart Card Operating Systems.
Smart Card File Systems.
Smart Card Systems.
Smart Card Standards and Specifications.
ISO 7816 Standards.
II. JAVA CARD TECHNOLOGY.3. Java Card Technology Overview.
Java Card Language Subset.
Java Card Virtual Machine.
CAP File and Export File.
Java Card Converter.
Java Card Interpreter.
Java Card Installer and Off-Card Installation Program.
Java Card Runtime Environment.
How Does the JCRE Operate during a CAD Session?
Java Card Runtime Features.
Java Card APIs.
Java Card Applets.
Package and Applet Naming Convention.
Applet Development Process.
Preissuance or Postissuance Applets.
Postissuance Applet Installation.
Error Recovery during Applet Installation.
Installation Constraints.4. Java Card Objects.
Java Card Memory Model.
Properties of Transient Objects.
Transient Object Types.
Creating Transient Objects.
Querying Transient Objects.
A Few Words about Object Creation and Deletion.5. Atomicity and Transactions.
Block Data Updates in an Array.
Local Variables and Transient Objects during a Transaction.6. Java Card Exceptions and Exception Handling.
Exceptions in the java.lang Package.
Java Card Exceptions.
Java Card Exception Reason Code.
Throwing an Exception in the Java Card Platform.
UserException.7. Java Card Applets.
Applet Installation and Execution.
Creating Objects in the Applet's Constructor.
Registering the Applet Instance with the JCRE.
Processing the Installation Parameters.
Further Applet Initialization.
SELECT APDU Format and Processing.
Other Methods in the Class javacard.framework.Applet.8. Working with APDUs.
APDU Buffer Size.
Working with APDUs in Applets.
Retrieve the APDU Buffer.
Examine the Command APDU Header.
Receive APDU Command Data.
Process the APDU Command and Generate the Response Data.
Return APDU Response Data.
Return the Status Word.
Protocol-Specific APDU Processing.
Summary.9. Applet Firewall and Object Sharing.
Transient Array and Context.
Static Fields and Methods.
Object Sharing across Contexts.
JCRE Entry Point Objects.
Object Shareable Interface Mechanism.10. Programming Cryptography.
Quick Tour of Cryptography.
Encryption and Decryption.
Cryptographic Practice in Smart Card Applications.
Ensuring Application Security.
Functioning as a Secure Token.
Java Card Cryptography APIs.
Compute a Message Digest.
Build a Cryptographic Key.
Sign and Verify a Signature.
Encrypt and Decrypt Data.
Generate Random Data.11. Java Card Platform Security.
Java Card Platform Security Features.
Java Language Security.
Additional Security Features of the Java Card Platform.
Java Card Platform Security Mechanisms.
Class File Verification and Subset Checking.
CAP File and Export File Verification.
Cryptographically Enforced Chain Trust.
Runtime Security Enforcement.
Java Card Cryptographic Support.
III. PROGRAMMING GUIDE AND TIPS.12. Step-by-Step Applet Development Guide.
Design the Applet.
Specify the Functions of the Applet.
Specify AIDs for the Applet.
Define the Class Structure and Method Functions of the Applet.
Define the Interface between the Applet and Its Host Application.
Construct the Applet Code.
Wallet Applet Code.
Implement Error Checking.
What's the Next Step?13. Applet Optimization.
Optimizing an Applet's Overall Design.
On-Card Execution Time.
Creating Objects in Applets.
Eliminating Redundant Code.
The switch Statement versus the if-else Statement.
Optimizing Variables in Applets.14. Working with int Data Type.
32-Bit Arithmetic Operations.
Array Size and Array Index.
Storing and Computing int Values.
4 Appendices.A. Java Card Language Subset.
Audience for This Book
Java Card™ technology combines a subset of the Java programming language with a runtime environment optimized for smart cards and other memory-constrained devices. This book is intended for a wide technical audience with different needs of understanding Java Card technology.
First and foremost, it is written for Java Card applet developers. You will find a smart card tutorial, in-depth discussions on various Java Card features, helpful programming tips for applet development, and the reference to the Java Card APIs.
Second, this book is supplementary reading for Java Card platform implementors. It provides further discussion of many topics in the Java Card specifications and includes code examples to clarify those topics.
Third, this book is useful for technical managers or anyone who wants to gain an overall understanding of Java Card technology. In particular, the first three chapters are introductions to orient you within the technology from both a technical and marketing point of view.
Throughout this book, I assume that readers are familiar with the fundamentals of the Java language. For those who want to learn more about the Java language, the book by Arnold and Gosling is a good resource.Organization of This Book
This book is written in a bottom-up fashion. Each chapter was a step to the next one, so it is best if you read the chapters in order.
This book is based on Java Card version 2.1, the latest release when the book was written. At the meantime, the next version 2.1.1 is underway. Version 2.1.1 will include minor enhancement updates to version 2.1. The contents and techniques covered in the book will continue to be relevant to future Java Card releases, and new things will be incorporated in future editions of this book.Retrieving Additional Information On-line
You can get the latest on Java Card technology or the latest Java Card development kit from the Java Card web site at http://java.sun.com/products/javacard. For updated information about this book, visit http://java.sun.com/books/series/javacard.