Contents Previous Next Index

Chapter   3

Development Kit Samples and Demonstrations


This release includes several demonstration programs which illustrate the use of the Java Card API, and a scenario of post-manufacture installation.

The Demonstrations

Version 2.2.1 of the Development Kit includes the following demonstration programs:

Directories and Files in the demo Directory

The directories and files for the Development Kit demonstrations are described in TABLE 3 and TABLE 4.


Note – Many of the directories listed in TABLE 3 and TABLE 4 contain a _tmp subdirectory. This subdirectory contains intermediate temporary files needed to construct the final *.scr source files.

TABLE 3  –  Directories and Files in the demo Directory
Directories/Files
Description
demo1
Contains the files required to run and verify demo1:
  • demo1.scr—demonstration apdutool script file
  • demo1.scr.expected.out—for comparison with apdutool output when the demo is run
demo2
Contains the files required to run and verify demo2 and demo2crypto:
  • demo2.scr, demo2crypto.scr—demonstration apdutool script files
  • demo2.scr.expected.out, demo2crypto.scr.expected.out—for comparison with apdutool output when the demo is run
 
This directory also contains the subdirectories for the demos that depend on the output of demo2. For more information on the contents of these subdirectories and the demos they represent, see TABLE 4.
demo3
Contains the files required to run and verify demo3:
  • demo3.scr—demonstration apdutool script file
  • demo3.scr.expected.out—for comparison with apdutool output when the demo is run
jcwde
Contains the files required to run Java Card WDE:
  • jcwde.app—lists all of the applets (and their AIDs) to be loaded into the simulated mask for Java Card WDE.
  • jcwde_rmi.app and jcwde_securermi.app—lists the contents of Java Card WDE for running the RMIDemo and SecureRMIDemo respectively.
logical_channels
Contains the files required to run and verify the logical channels demo:
  • channel.scr, channelDemo.scr, ChnDemo.scr—demonstration apdutool script files
  • channelDemo.scr.expected.out—for comparison with apdutool output when the demo is run
misc
Footer.scr, Header.scr—scripts to terminate and initialize the session, respectively.
object_deletion
Contains the files required to run and verify odDemo1 and odDemo2:
  • packageA.scr, packageB.scr, packageC.scr—intermediate script files for building the final odDemo1-*.scr files.
  • odDemo1-1.scr, odDemo1-2.scr, odDemo1-3.scr—demonstration apdutool script files
  • od1.scr, od2.scr, od2-2.scr, od3.scr, od3-2.scr— script files used for building the odDemo1-*.scr files
  • odDemo1-1.scr.expected.out, odDemo1-2.scr.expected.out, odDemo1-3.scr.expected.out, odDemo2.scr.expected.out—for comparison with apdutool output when the demos are run

Several of the Development Kit demonstrations use the output generated by the Demo 2 demonstration. These demonstrations are stored in subdirectories of demo2. The demo2 directory also contains the files that the demos need to run JavaPurse, JavaLoyalty, and Wallet. The demonstrations and subdirectories contained in demo2 are described in TABLE 4.

TABLE 4  –  Subdirectories and Demonstrations in the demo2 Directory
Subdirectories
Description
javapurse
Contains the files required to run the demos that use JavaPurse:
  • AppletTest.scr, AppletTestCrypto.scr—downloads and executes the demonstration applets
  • JavaLoyalty.scr—installation script for the JavaLoyalty Java Card applet
  • JavaPurse.scr, JavaPurseCrypto.scr—installation scripts for the JavaPurse Java Card applet
  • SampleLibrary.scr—installation script for the SampleLibrary library package
photocard
Contains the files required to run and verify the photo card demo:
  • photocard, photocard.bat—script/batch file to run the photo card demo
  • photocard.scr—installation script for the photocard applet package
  • photocard.scr.expected.out—for comparison with apdutool output when the demo is run
  • *.gif files—sample photo files
  • opencard.properties—contains OCF settings for the photo card demo
rmi
Contains the files required to run and verify RMIDemo and SecureRMIDemo:
  • rmidemo or rmidemo.bat, securermidemo or securermidemo.bat—Shell scripts and batch files for running the Java Card RMI and secure Java Card RMI demos, respectively
  • rmidemo.scr.expected.out, securermidemo.scr.expected.out—for comparison with apdutool output when the demos are run
  • RMIDemo.scr, SecureRMIDemo.scr—installation scripts to install the RMIDemo and SecureRMIDemo applet packages, respectively
  • opencard.properties—contains OCF settings for the Java Card RMI demos
wallet
Contains the file required to run the demos that use the Wallet applet:
Wallet.scr—installation script for the Wallet applet package

Preliminaries

All demo programs are pre-built. If you make any changes to the demos, the following sections describe how you can rebuild them.

Building Samples

A script file is provided to build the samples. To understand what is going on behind the scenes, it is very instructive to look at the script.

The script file is $JC_HOME/samples/build_samples (for a Solaris or Linux platform installation) or %JC_HOME%\samples\build_samples.bat (for a Microsoft Windows 2000 platform installation).

Running the Script

The command line syntax for the script is:

build_samples [options] 

TABLE 5 describes the possible values for options.

TABLE 5  –  build_samples Command Line Options
Value of options
Description
-clean
Removes all files produced by the script.
-help
Prints out a help message and exits.
[no options]
Builds all sample applets, client samples, and demo scripts.

Setting Environment Variables

The build_samples script uses the environment variables JC_HOME and JAVA_HOME. To correctly set these environment variables, refer to "Setting Environment Variables for the Solaris or Linux Platform" or "Setting Environment Variables for Microsoft Windows 2000 Platform".

Building the Sample Applets

Run the script without parameters to build the samples:

build_samples  

triangle pointing down  Preparing to Compile the Sample Applets


Note – This section details the steps taken by the script, but you can run the commands yourself if you choose.
  1. A classes directory is created as a peer to src under the samples directory.
  2. The Java Card API export files are copied to the classes directory.

Compiling the Sample Applets

The next step is to compile the Java sources for the sample applets. For example, from the samples directory, issue the following command:

Solaris or Linux platform:

javac -g -classpath ./classes:../lib/api.jar:../lib/installer.jar src/com/sun/javacard/samples/HelloWorld/*.java  

Microsoft Windows 2000 platform:

javac -g -classpath .\classes;..\lib\api.jar;..\lib\installer.jar src\com\sun\javacard\samples\HelloWorld\*.java  

where:

Converting the Class Files

The next step is to convert the Java class files.

Conversion parameters for each package are specified in a configuration file.

For example, a configuration file contains items such as:

-out EXP JCA CAP 
-exportpath . 
-applet  0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1 
com.sun.javacard.samples.HelloWorld.HelloWorld 
com.sun.javacard.samples.HelloWorld 
0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0 

In this example, the converter will output three kinds of files: export (*.exp), CAP (*.cap) and Java Card Assembly (*.jca) files.

Refer to the “Convert samples” section of the script file to see the detailed converter tool steps.

For more information about the converter tool, refer to Chapter 5, "Converting Java Class Files.”

Running scriptgen to Generate Script Files

Generate script files for apdutool using the scriptgen tool. This step must be done for each package to be downloaded. For example:

scriptgen -o JavaLoyalty.scr ./classes/com/sun/javacard/samples/JavaLoyalty/javacard/JavaLoyalty.cap  

The new scripts are included into the demonstration scripts. For example, demo2.scr file is composed of these scripts:


Note – The script files for the demonstrations use the output off; apdutool directive to suppress the logging of CAP file download APDU commands to the output log file, and the output on; directive to enable the logging of other commands. To enable logging of package download commands, comment out the output off; directive in the script file Header.scr and run the build_samples script.

Running the Demonstrations

The following sections describe the Development Kit demonstrations and how to run them.

A demonstration can use a card EEPROM image created by another demonstration. The cref command line option -o <filename> lets you save the EEPROM image into a file after a simulated card session. The option -i <filename> restores the image from the file for a new card session. For more information, see Chapter 11, "Using the Java Card Reference Implementation”.

Demo 1

The Demo 1 demonstration, demo1, exercises the JavaPurse, JavaLoyalty, and Wallet applets by simulating transactions where amounts are credited and debited from the card. The demonstration begins by powering up the Java Card technology-enabled smart card and creating the applets JavaPurse, JavaLoyalty, and Wallet.

The JavaPurse applet demonstrates a simple electronic cash application. The applet is selected and initialized with various parameters such as the Purse ID, the expiration date of the card, the Master and User PINs, maximum balance, and maximum transaction. Transaction operations perform the actual debits and credits to the electronic purse. If there is a configured loyalty applet assigned for the CAD performing the transaction JavaPurse communicates with it to grant loyalty points. In this case, JavaLoyalty is the provided loyalty applet.

A number of transaction sessions are simulated where amounts are credited and debited from the card. In an additional session, transactions with intentional errors are attempted to demonstrate the security features of the card.

The JavaLoyalty applet is designed to interact with the JavaPurse applet, and to demonstrate the use of shareable interfaces. The shareable JavaLoyaltyInterface is defined in a separate library package, com.sun.javacard.SampleLibrary.

JavaLoyalty is a minimalistic loyalty applet. It is registered with JavaPurse when a Parameter Update APDU command with an appropriate parameter tag is executed, and when the AID part of the parameter corresponds to the AID of the JavaLoyalty applet. The applet contains a grantPoints method. This method implements the main interaction with the client. When the first 2 bytes of the CAD ID in a request by a JavaPurse transaction correspond to the 2 bytes of CAD ID in the corresponding Parameter Update APDU command, the grantPoints method implementing the JavaLoyaltyInterface is requested.

JavaLoyalty maintains the balance of loyalty points. The applet contains methods to credit and debit the account of points and to get and set the balance.

The Wallet applet demonstrates a simplified cash card application. It keeps a balance, and exercises some of the Java Card API features such as the use of a PIN to control access to the applet.

triangle pointing down  Running demo1

demo1 runs in the Java Card WDE.

  1. Navigate to the jcwde directory (this will be $JC_HOME/samples/src/demo/jcwde on the Solaris or Linux platform or $JC_HOME\samples\src\demo\jcwde on the Microsoft Windows 2000 platform). Enter the command:
  2. jcwde jcwde.app 
    
  3. In a separate command window, navigate to the $JC_HOME/samples/src/demo/demo1 directory (or %JC_HOME%\samples\src\demo\demo1 on the Microsoft Windows 2000 platform) and run apdutool, using the following command:
  4. apdutool -nobanner -noatr demo1.scr > demo1.scr.jcwde.out 
    

    If the run is successful, the apdutool log, demo1.scr.jcwde.out, is identical to the file demo1.scr.expected.out.

Demo 2

The Demo 2 demonstration, demo2, illustrates downloading Java Card packages onto the card. This demonstration contains the installer applet in the mask image. After the card is powered up, the Photocard, SampleLibrary, JavaPurse, JavaLoyalty, Wallet, RMIDemo, and SecureRMIDemo packages are downloaded. The commands from demo1 are repeated. Finally, the card is powered down.

triangle pointing down  Running demo2

demo2 runs in the C-language Java Card RE because the Java Card WDE is not able to support the downloading of CAP files.

  1. Run cref using the following command:
  2. cref -o demoee 
    
  3. In a separate command window, navigate to the $JC_HOME/samples/src/demo/demo2 directory (or %JC_HOME%\samples\src\demo\demo2 on the Microsoft Windows 2000 platform) and run apdutool, using the following command:
  4. apdutool -nobanner -noatr demo2.scr > demo2.scr.cref.out 
    

    If the run is successful, the apdutool log, demo2.scr.cref.out, should be identical to the file demo2.scr.expected.out.

    After cref completes executing, an EEPROM image is stored in the file demoee. (For more information, refer to Chapter 11, "Using the Java Card Reference Implementation.”)

Demo 3

The Demo 3 demonstration, demo3, illustrates the capabilities of a Java Card technology-enabled smart card to save its state across sessions. After running demo2, the state of the card can be saved. This card state must be used as the initial state for running demo3.

triangle pointing down  Running demo3

demo3 should be run after demo2. demo3 runs in the C-language Java Card RE because the virtual machine state must be restored after the initial run.

  1. Run cref using the following command:
  2. cref -i demoee 
    

    cref will restore the EEPROM image from the file demoee. (For more information, refer to Chapter 11, "Using the Java Card Reference Implementation.”)

  3. In a separate command window, navigate to the $JC_HOME/samples/src/demo/demo3 directory (or %JC_HOME%\samples\src\demo\demo3 on the Microsoft Windows 2000 platform) and run apdutool, using the following command:
  4. apdutool -nobanner -noatr demo3.scr > demo3.scr.cref.out 
    

    If the run is successful, the apdutool log, demo3.scr.cref.out, should be identical to the file demo3.scr.expected.out.

Java Card RMI Demo

Every Java Card RMI application consists of two parts: a card applet and a client program communicating with it. In this case, the RMIDemo applet is installed in EEPROM image when you run demo2 on CREF. On Java Card WDE, the applets are included in the simulated mask.

The client framework uses the OCF framework, version 1.2 (files base-core.jar, and base-opt.jar), to communicate with C-language Java Card RE. The OCF settings are stored in file opencard.properties. The file opencard.properties is located in the demo\demo2\rmi directory.

Note that OCF searches for this file in the following locations:

where [java.home], [user.home], and [user.dir] correspond to the Java system properties.

The RMIDemo uses the card applet PurseApplet, the Purse interface and its implementation PurseImpl. These classes reside in the package com.sun.javacard.samples.RMIDemo. The client-side program PurseClient resides in the package com.sun.javacard.clientsamples.purseclient.

The Purse interface describes the supported functionality: methods for getting the account balance, debiting and crediting the account, and getting and setting an account number. The interface also defines the constants used for error reporting. The PurseImpl class implements Purse.

The card applet PurseApplet creates and registers instances of the dispatcher and the Java Card RMI service.

The client-side program, PurseClient, represents a simple Java Card RMI client and uses the Open Card Framework (OCF) as the client side framework. The program initializes the OCF, creates the Java Card RMI Connect instance, and selects the Java Card applet (in this case, the PurseApplet). The program then gets the initial reference from PurseApplet (the reference to an instance of PurseImpl) and casts it to the Purse interface type. This allows PurseImpl to be treated as a local object. The program can then exercise the card by debiting and crediting different amounts, and by setting and getting the account number. The program demonstrates error handling by intentionally attempting to set an account number of incorrect size. This will cause a UserException to be thrown with the appropriate error code.

The client part of the RMIDemo can be run without parameters or with the -i parameter:

For more information on these formats, see Chapter 8 of the Runtime Environment Specification for the Java Card™ Platform, Version 2.2.1 (Sun Microsystems, Inc., 2003).

triangle pointing down  Running the Java Card RMI Demo

The RMIDemo can be run on either C-language Java Card RE or Java Card WDE. On C-language Java Card RE, RMIDemo can be run only after demo2 has successfully completed.

The RMIDemo applet can be run in Java Card WDE by listing it on the first line of the applet configuration file jcwde_rmi.app.

If the run is successful, the output in the file will be the same as contained in file rmidemo.scr.expected.out.

To Run RMIDemo on the C-Language Java Card RE:
  1. Run cref using the command:
  2. cref -i demoee 
    
  3. Run the Java Card RMI client program with either of these commands:
  4. rmidemo > rmidemo.scr.cref.out 
    rmidemo -i > rmidemo.scr.cref.out 
    
To Run RMIDemo on Java Card WDE:
  1. Run Java Card WDE using the command:
  2. jcwde jcwde_rmi.app 
    
  3. In a separate command window, navigate to the $JC_HOME/samples/src/demo/demo2/rmi directory (on the Solaris or Linux platform) or %JC_HOME%\samples\src\demo\demo2\rmi directory (on the Microsoft Windows 2000 platform). Run the Java Card RMI client program with either of these commands:
  4. rmidemo > rmidemo.scr.jcwde.out 
    rmidemo -i > rmidemo.scr.jcwde.out 
    

Secure Java Card RMI Demo

The secure Java Card RMI demo, SecureRMIDemo, can be thought of as a version of the RMIDemo with an added security service. SecureRMIDemo uses the card applet SecurePurseApplet, the Purse interface and its implementation SecurePurseImpl, and a definition of the security service MySecurityService. These classes reside in the package com.sun.javacard.samples.SecureRMIDemo. The demo also uses the client-side program SecurePurseClient and the specialized card accessor SecureOCFCardAccessor. These classes reside in the package com.sun.javacard.clientsamples.securepurseclient.

The Purse interface is similar to the interface used in the non-secure case, however, there is an extra constant: REQUEST_DENIED. This constant is used to report situations where the client tries to invoke a method that it is not allowed to access.

The MySecurityService class is a security service that is responsible for ensuring data integrity by verifying checksums on incoming commands and attaching checksums to outgoing commands. The program also requires the client to authenticate itself as the principal application provider or principal cardholder by sending a two-byte PIN.

The implementation of Purse, SecurePurseImpl, is similar to the non-secure case, however, at the beginning of each method call, there is a call to the security service which ensures that the business rules are satisfied and that the data is not corrupted.

The applet SecurePurseApplet is similar to the non-secure case, but it also creates and registers an instance of MySecurityService.

The client-side program, SecurePurseClient, is similar to the non-secure case, but instead of a generic card accessor, it uses its own implementation: SecureOCFCardAccessor, which performs additional pre- and post-processing of data and supports the additional command authenticateUser.

SecurePurseClient also requires verification of the user. After the applet is inserted, a PIN must be given to the card-side applet by calling authenticateUser on SecureOCFCardAccessor.

When authenticateUser is called, SecureOCFCardAccessor prepares and sends the following command:

TABLE 6  –  Authenticate User Command
CLA_AUTH
INS_AUTH
P1 field
P2 field
LC field
PIN (two bytes)
0x80
0x39
0
0
2
xx
xx

On the card side, MySecurityService processes the command. If the PIN is correct, then the appropriate flags are set in the security service and a confirmation response is returned to the client. Once authentication is passed, the client program receives the balance, credits the account, and again receives the balance. The program demonstrates error handling when the client attempts to debit a number of units from the account. This will cause the program to throw a UserException with the code REQUEST_DENIED.

As with RMIDemo the client part of the SecureRMIDemo can be run without parameters or with the -i parameter:

For more information on these formats, see Chapter 8 of the Runtime Environment (JCRE) Specification for the Java Card™ Platform, Version 2.2.1.

triangle pointing down  Running the Secure Java Card RMI Demo

SecureRMIDemo can be run on either the C-language Java Card RE or Java Card WDE. The SecureRMI demo applet is installed in the EEPROM image when you run demo2.

The SecureRMIDemo can be run in Java Card WDE by listing it on the first line of the applet configuration file jcwde_securermi.app.

If the run is successful, the output in the file will be the same as contained in file securermidemo.scr.expected.out.

To Run SecureRMIDemo on the C-Language Java Card RE:
  1. Run cref using the command:
  2.  cref -i demoee 
    
  3. Run the Secure Java Card RMI client program with either of these commands:
  4. securermidemo > securermidemo.scr.cref.out 
    securermidemo -i > securermidemo.scr.cref.out 
    
To Run SecureRMIDemo on Java Card WDE:
  1. Navigate to the jcwde directory (this will be $JC_HOME/samples/src/demo/jcwde on the Solaris or Linux platform or $JC_HOME\samples\src\demo\jcwde on the Microsoft Windows 2000 platform). Run Java Card WDE using the command:
  2. jcwde jcwde_securermi.app 
    
  3. In a separate command window, navigate to the rmi directory. This will be $JC_HOME/samples/src/demo/demo2/rmi directory (on the Solaris or Linux platform) or %JC_HOME%\samples\src\demo\demo2\rmi directory (on the Microsoft Windows 2000 platform). Run the Secure Java Card RMI client program with either of these commands:
  4. securermidemo > securermidemo.jcwde.out 
    securermidemo -i > securermidemo.jcwde.out 
    

Object Deletion Demo 1

The Object Deletion Demo 1, odDemo1, demonstrates the object deletion mechanism, applet deletion, and package deletion. The odDemo1 demonstration has three parts:

triangle pointing down  Running odDemo1

odDemo1 runs only in the C-language Java Card RE. This is because the Java Card WDE does not support the object deletion mechanism, applet deletion, or package deletion.

  1. In a command window, run cref using this command:
  2. cref -o crefState  
    
  3. In a second command window, navigate to the $JC_HOME/samples/src/demo/object_deletion directory (or %JC_HOME%\samples\src\demo\object_deletion on the Microsoft Windows 2000 platform) and run APDUTool, using this command:
  4. apdutool -nobanner -noatr odDemo1-1.scr > odDemo1-1.scr.cref.out  
    

    If the run is successful, the APDUTool log, odDemo1-1.scr.cref.out should be identical to the file odDemo1-1.scr.expected.out.

  5. In the first command window run cref using this command:
  6. cref -i crefState -o crefState  
    
  7. In the second command window, execute APDUTool using this command:
  8. apdutool -nobanner -noatr odDemo1-2.scr > odDemo1-2.scr.cref.out  
    

    If the run is successful, the apdutool log, odDemo1-2.scr.cref.out should be identical to the file odDemo1-2.scr.expected.out.

  9. In the first command window run cref using this command:
  10. cref -i crefState  
    
  11. In the second command window, execute APDUTool using this command:
  12. apdutool -nobanner -noatr odDemo1-3.scr > odDemo1-3.scr.cref.out 
    

    If the run is successful, the apdutool log, odDemo1-3.scr.cref.out should be identical to the file odDemo1-3.scr.expected.out.

Object Deletion Demo2

The Object Deletion Demo 2, odDemo2, demonstrates package deletion and checks that persistent memory has been returned to the memory manager. This demo has one script: odDemo2.scr. You do not have to run odDemo1 to run odDemo2.

triangle pointing down  Running odDemo2

odDemo2 runs only in the C-language Java Card RE. This is because the Java Card WDE does not support the object deletion mechanism, applet deletion, or package deletion.

  1. In a command window, run cref using this command:
  2. cref 
    
  3. In a second window, navigate to the $JC_HOME/samples/src/demo/object_deletion directory (or %JC_HOME%\samples\src\demo\object_deletion on the Microsoft Windows 2000 platform) and run APDUTool with this command:
  4. apdutool -nobanner -noatr odDemo2.scr > odDemo2.scr.cref.out 
    

    If the run is successful, the apdutool log, odDemo2.scr.cref.out should be identical to the file odDemo2.scr.expected.out.

Logical Channels Demo

The Logical Channels Demo, lcdemo, demonstrates the behavior of Java Card technology-based logical channels by showing how two applets, which interact with each other, can each be selected for use at the same time.

The logical channels demo mimics the behavior of a wireless device connected to a network service. A connection manager tracks whether the device is connected to the service and whether the connection is local or remote. While it is connected, the user’s account is debited on a unit of time basis; the debit rate is based on whether the connection is local or remote. The demo employs two applets to simulate this situation: the ConnectionManager applet manages the connection while the AccountAccessor applet manages the account.

When the user turns on the device, the ConnectionManager applet is selected. Every unit of time, the terminal sends a message containing the area code to the card. When the user wants to use the service, the AccountAccessor applet is selected on another logical channel so that the terminal can query the balance. The AccountAccessor can return the balance only if the ConnectionManager is active. The ConnectionManager applet sets the connection and tracks the connection status. Based on the value of an area code variable, the ConnectionManager determines whether the connection is local or remote. AccountAccessor uses this information to debit the account at the appropriate rate. The connection is disabled when the user completes the call or when the account is depleted.

triangle pointing down  Running the Logical Channels Demo

The logical channels demo runs only in the C-language Java Card RE. No sample scripts or demos are provided to demonstrate this functionality on Java Card WDE.

  1. In a command window, run cref using this command:
  2. cref  
    
  3. In the second command window, navigate to the $JC_HOME/samples/src/demo/logical_channels directory (or %JC_HOME%\samples\src\demo\logical_channels on the Microsoft Windows 2000 platform) and execute APDUTool using this command:
  4. apdutool -nobanner -noatr channelDemo.scr > channelDemo.scr.cref.out  
    

    If the run is successful, the APDUTool log, channelDemo.scr.cref.out should be identical to the file channelDemo.scr.expected.out.

Demo 2 Cryptography Demo

The Demo 2 Cryptography Demo, demo2crypto, is similar to demo2, except that it employs a version of JavaPurse that uses a DES MAC algorithm. This version of JavaPurse is called JavaPurseCrypto. All other applets are exactly the same as were used in demo2.


Note – There are no cryptography versions of demo1 or demo3.

A DES MAC is a cryptographic signature that uses DES encryption on all or part of a message (APDU). JavaPurseCrypto uses the DES MAC to verify several of the APDUs; that is, instead of zeros in the signature currently in JavaPurse, there will be a real signature that can be programmatically signed and verified. Other programs that interact with JavaPurseCrypto (such as JavaLoyalty and Wallet) are not affected since all signing/verifying of the signature will occur only within JavaPurseCrypto.

triangle pointing down  Running the demo2crypto Demo

demo2crypto runs in the C-language Java Card RE because the Java Card WDE is not able to support the downloading of CAP files.

  1. Run cref using the following command:
  2. cref  
    
  3. In a second command window, navigate to the $JC_HOME/samples/src/demo/demo2 directory (or %JC_HOME%\samples\src\demo\demo2 on Windows) and execute APDUTool using this command:
  4. apdutool -nobanner -noatr demo2crypto.scr > demo2crypto.scr.cref.out 
    

    If the run is successful, the apdutool log, demo2crypto.scr.cref.out, should be identical to the file demo2crypto.scr.expected.out.

Photo Card Demo

The Photo Card Demo, photocard, illustrates how you can use the large address space available in the 32-bit version of the Java Card platform reference implementation, version 2.2.1. The demo uses the large address space of the smart card’s EEPROM memory to store up to four GIF images. The images are included with the demo.

Running the Photo Card Demo

The Photo Card demo can be run only after demo2 has successfully completed. This is because the Photo Card applet is downloaded with demo2.scr.

  1. Run cref with the -z option to display the memory statistics for the card:
  2.  cref -z -i demoee 
    
  3. In a separate window, navigate to the photocard directory. This will be $JC_HOME/samples/src/demo/demo2/photocard directory (on the Solaris or Linux platform) or %JC_HOME%\samples\src\demo\demo2\photocard directory (on the Microsoft Windows 2000 platform). Run the photocard client program and specify the four supplied GIF images:
  4. photocard duke_magnify.gif duke_pencil.gif duke_wave.gif duke_thumbsup.gif > photocard.scr.cref.out 
    

    If the run is successful, the output in the file photocard.scr.cref.out will be the same as contained in file photocard.scr.expected.out.

  5. Perform a diff on the individual images to ensure that their contents have not changed.

 


Contents Previous Next Index Development Kit User's Guide for the Binary Release with Cryptography Extensions
Java Card Platform, Version 2.2.1