The two packages in the Java Card RMI client-side reference implementation demonstrate remote stub customization using the RMIC compiler generated stubs and card access for Java Card applets.
The package com.sun.javacard.rmiclientlib
implements Java Card RMI-specific functionality.
The package com.sun.javacard.clientlib
implements basic functionality to exchange APDUs with a smart card or a smart card simulator. This implementation of clientlib
requires that the ApduIO library is included in the CLASSPATH.
This package includes several classes.
class JCRMIConnect—
The main class of the RMI framework that provides methods to select a card applet and to get an initial reference.
class JCCardObjectFactory—
An implementation of the CardObjectFactory
that processes the data returned from the card in the format defined in the Runtime Environment Specification, Java Card Platform, Version 3.0.5, Classic Edition. Any object references must contain class names.
class JCCardProxyFactory—
The JCCardProxyFactory
class is similar to JCCardObjectFactory
, but processes references containing lists of names. JCCardProxyFactory
uses the JDK 1.4.+ proxy mechanism to generate proxies dynamically.
class JCRemoteRefImpl—
An implementation of interface java.rmi.server.RemoteRef
. These remote references can work with stubs generated by the RMIC compiler with the -v1.2
option.
The main method is: public Object
invoke(Remote remote, Method method,
Object[] params, long unused) throws IOException, RemoteException, Exception
This method prepares the outgoing APDU, passes it to CardAccessor
, and then uses CardObjectFactory
to parse the returned APDU and instantiate the returned object or throw an exception.
This package includes an interface and a class.
interface CardAccessor—
An interface defining methods to exchange APDUs with a card and to close connection to a card.
class ApduIOCardAccessor—
A simple implementation of the CardAccessor interface that passes the APDUs to a card or a card simulator using the ApduIO library. This class takes parameters to start the ApduIO from the file jcclient.properties
, which must be included in CLASSPATH.