OpenCard Framework 1.2 Programmer's Guide - OpenSCDP
OpenCard Framework 1.2 Programmer's Guide - OpenSCDP
OpenCard Framework 1.2 Programmer's Guide - OpenSCDP
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 2. Getting started<br />
Preparing the system<br />
This chapter provides a guide for writing a first simple smart card application. It will<br />
become apparent how simple and efficient smart card application development can be using<br />
the OPENCARD FRAMEWORK.<br />
Before one can start developing one’s own smart card aware applications using the<br />
OPENCARD FRAMEWORK, there are a number of prerequisites to fulfill:<br />
1. Get and install JDK (Java Developer’s Kit) - preferably version 1.1.6 or later, if<br />
you have not already done so. You can find versions of the JDK for a number of<br />
operating systems at JAVA SOFT’s JDK WWW site4 . Alternatively, you can get the<br />
JDK with one of the commercially available Integrated Development Environments<br />
(IDE) for JAVA.<br />
2. Likewise, download and install the OPENCARD FRAMEWORK reference<br />
implementation available at the OCF WWW site5 and follow the installation<br />
instructions.<br />
3. Obtain an OCF-compliant smart card reader device. Check the list at<br />
http://www.opencard.org/ for devices that are presently supported via<br />
OCF-compliant CardTerminal components. Check this list frequently as new<br />
components supporting different devices will become available.<br />
4. Obtain OCF-compliant smart cards and the corresponding developers toolkit.<br />
Check the list at http://www.opencard.org/ for cards that are presently<br />
supported via OCF-compliant CardService components. Check this list<br />
frequently as new components supporting different devices become available.<br />
Writing your first sample application<br />
Now that you’ve setup your system with both hardware and software, you are<br />
ready to code your first sample application: A program that reads the cardholder<br />
data from an OPENCARD DEMOCARD 6 .<br />
If you do not own such a card, you can use any other smart card for which a<br />
FileAccessCardService is available. Use the tools provided with your smart card<br />
to create a transparent file in the master file (MF) of your smart card. The file must<br />
have the ID 0xc009 and should have access condition ALWAYS or CHV for read and<br />
write access. To initialize your card, you may prefer to start with the second<br />
sample application (see “Writing your second sample application” on page 8),<br />
which allows you to write data to that file.<br />
First, we create a skeleton of the new application. The skeleton consists of import<br />
statements, a class definition, and a main method where the actual application<br />
code will be filled in:<br />
import opencard.core.service.SmartCard;<br />
import opencard.core.service.CardRequest;<br />
import opencard.opt.iso.fs.FileAccessCardService;<br />
4. http://java.sun.com/products/jdk/<br />
5. http://www.opencard.org/<br />
6. the card used for the OCF demo called ″Internet Broker″<br />
5