Contents Previous Next Index

Chapter   15

Java Card RMI Client-Side Reference Implementation

A Java Card RMI client application runs on a Card Acceptance Device (CAD) terminal which supports a J2SE or J2ME platform. The client application requires a portable and platform independent mechanism to access the Java Card RMI server applet executing on the smart card.

The basic client-side framework is implemented in the package com.sun.javacard.javax.smartcard.rmiclient. Refer to Java Card™ RMI Client Application Programming Interface, Version 2.2.1 (Sun Microsystems, Inc., 2003) .

The reference implementation of Java Card Client-Side RMI API is implemented in the package com.sun.javacard.ocfrmiclientimpl, and is based on the Open Card Framework (OCF 1.2) for its card access mechanisms. The Open Card Framework classes provide a Java application platform independent access to a connected smart card.

For a detailed description of OCF 1.2, refer to

For the Java Card RMI Client API Reference Implementation documentation refer to Appendix D, "Reference Implementation of Java Card RMI Client-Side API.”

The Java Card Remote Stub Object

Java Card RMI supports two formats for passing remote references. The format for remote references containing the class name requires stubs for remote objects available to the client application.

The standard Java RMIC compiler tool can be used as the stub compilation tool to produce stub classes required for the client application. To produce these stub classes, the RMIC compiler tool must have access to all the non-abstract classes defined in the applet package which directly or indirectly implement remote interfaces. In addition, it needs to access the .class files of all the remote interfaces implemented by them.

If you want the stub class to be Java Card RMI-specific when it is instantiated on the client, it must be customized with a Java Card platform-specific implementation of the CardObjectFactory interface.

The standard Java RMIC compiler is used to generate the remote stub objects. JCRemoteRefImpl, a Java Card platform-specific implementation of the java.rmi.server.RemoteRef interface, allows these stub objects to work with Java Card RMI. The stub object delegates all method invocations to its configured RemoteRef instance.

The com.sun.javacard.ocfrmiclientimpl.JCRemoteRefImpl class is an example of a RemoteRef object customized for the Java Card platform.

For examples of how to use these interfaces and classes, see Chapter 3, “Developing Java Card RMI Applications” in the Application Programming Notes for the Java Card™ Platform, Version 2.2.1.

Note – Since the remote object is configured as a Java Card platform-specific object with a local connection to the smart card via the OCFCardAccessor object, the object is inherently not portable. A bridge class must be used if it is to be accessed from outside of this client application.

Note – Some versions of the RMIC do not treat Thowable as a superclass of RemoteException. The workaround is to declare remote methods to throw Exception instead.


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