OpenCard Framework 1.2 Programmer's Guide - OpenSCDP
OpenCard Framework 1.2 Programmer's Guide - OpenSCDP
OpenCard Framework 1.2 Programmer's Guide - OpenSCDP
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Contents<br />
Trademarks and service marks . . . . iii<br />
Figures . . . . . . . . . . . . . . vii<br />
Preface . . . . . . . . . . . . . . . ix<br />
About this manual . . . . . . . . . . . . ix<br />
How to use this manual . . . . . . . . . . ix<br />
Assumptions . . . . . . . . . . . . . . ix<br />
Where you can get <strong>OpenCard</strong> <strong>Framework</strong> . . . . x<br />
Font conventions used in this manual . . . . . . x<br />
Related documents . . . . . . . . . . . . x<br />
Feedback . . . . . . . . . . . . . . . x<br />
Chapter 1. Introduction . . . . . . . . 1<br />
Developing smart card applications. . . . . . . 1<br />
Developing applications using <strong>OpenCard</strong> <strong>Framework</strong> 2<br />
Chapter 2. Getting started . . . . . . . 5<br />
Preparing the system . . . . . . . . . . . 5<br />
Writing your first sample application . . . . . . 5<br />
Writing your second sample application . . . . . 8<br />
Chapter 3. OCF architectural concepts 11<br />
Architecture overview . . . . . . . . . . . 11<br />
The CardTerminal layer . . . . . . . . . . 12<br />
The CardService layer . . . . . . . . . . . 14<br />
FileAccessCardService . . . . . . . . . . 14<br />
SignatureCardService . . . . . . . . . . 15<br />
AppletAccessCardService and<br />
AppletManagerCardService . . . . . . . . 15<br />
Chapter 4. Programming with OCF. . . 17<br />
Configuring the <strong>OpenCard</strong> <strong>Framework</strong> . . . . . 17<br />
Configuring the registries. . . . . . . . . 17<br />
Configuring tracing output . . . . . . . . 17<br />
<strong>OpenCard</strong>PropertyFileLoader . . . . . . . 18<br />
Loading properties with your own mechanism 19<br />
Initializing the <strong>OpenCard</strong> <strong>Framework</strong> . . . . . 20<br />
Waiting for a smart card . . . . . . . . . . 20<br />
Obtaining a card service . . . . . . . . . . 21<br />
Handling exceptions . . . . . . . . . . . 21<br />
Listing applications. . . . . . . . . . . . 23<br />
Working with files . . . . . . . . . . . . 24<br />
FileAccessCardService . . . . . . . . . . 24<br />
The CardFilePath class. . . . . . . . . . 24<br />
The CardFileInput/OutputStream classes . . . 25<br />
The CardRandomRecordAccess class . . . . . 25<br />
Signature generation and verification . . . . . . 25<br />
Generating signatures . . . . . . . . . . 26<br />
Verifying signatures . . . . . . . . . . 26<br />
Importing keys . . . . . . . . . . . . 27<br />
Generating keys . . . . . . . . . . . . 27<br />
Chapter 5. Advanced programming<br />
with OCF . . . . . . . . . . . . . . 29<br />
Working with <strong>OpenCard</strong> events . . . . . . . 29<br />
CardTerminalEvent . . . . . . . . . . . 29<br />
Locking a CardTerminal . . . . . . . . . 29<br />
TracerEvents . . . . . . . . . . . . . 30<br />
Using optional CardTerminal functions . . . . . 30<br />
Getting a smart card via event-notification . . . . 32<br />
Obtaining a smart card from a particular card<br />
terminal . . . . . . . . . . . . . . . 34<br />
Gaining exclusive access to the smart card . . . . 35<br />
Referencing files . . . . . . . . . . . . . 35<br />
Working with credentials . . . . . . . . . . 37<br />
Performing cardholder verification . . . . . . 39<br />
Using the trace utility . . . . . . . . . . . 40<br />
Chapter 6. Using the <strong>OpenCard</strong><br />
<strong>Framework</strong> in applets . . . . . . . . 43<br />
Usage scenario . . . . . . . . . . . . . 43<br />
The security model of the Java Platform 1.1 . . . 43<br />
The security model of the Java Platform <strong>1.2</strong> . . . 43<br />
The Java Plug-In. . . . . . . . . . . . . 44<br />
Writing secure applets with OCF and the Java<br />
Plug-In . . . . . . . . . . . . . . . . 44<br />
Differences in the procedure between Java Platform<br />
1.1 and <strong>1.2</strong>. . . . . . . . . . . . . . . 45<br />
Writing secure applets with OCF for Java<br />
Platform 1.1 . . . . . . . . . . . . . 45<br />
Using secure applets with OCF for the Java<br />
Platform 1.1 . . . . . . . . . . . . . 46<br />
Writing secure applets with OCF for the Java<br />
Platform <strong>1.2</strong> . . . . . . . . . . . . . 46<br />
Using secure applets with OCF for the Java<br />
Platform <strong>1.2</strong> . . . . . . . . . . . . . 47<br />
Native Browser support . . . . . . . . . . 48<br />
The opencard.core.util.SystemAccess class . . . 48<br />
Writing secure applets with <strong>OpenCard</strong> and<br />
Netscape Communicator . . . . . . . . . 48<br />
Writing secure applets with <strong>OpenCard</strong> and<br />
Microsoft Explorer . . . . . . . . . . . 49<br />
Chapter 7. Writing a CardTerminal . . . 51<br />
Implementing a CardTerminal . . . . . . . . 51<br />
The interface layer . . . . . . . . . . . 51<br />
The function layer . . . . . . . . . . . 56<br />
The communication layer. . . . . . . . . 57<br />
Implementing the Lockable interface . . . . . 57<br />
Implementation of a CardTerminalFactory . . . . 58<br />
Chapter 8. Writing a card service . . . 61<br />
CardService environment — overview . . . . . 61<br />
Application interfaces . . . . . . . . . . . 61<br />
Using standard CardService interfaces . . . . 61<br />
Standard application interfaces . . . . . . . 62<br />
v