Java Card RMI Client-Side API

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.

Package rmiclientlib

This package includes several classes.

  • class JCRMIConnectThe main class of the RMI framework that provides methods to select a card applet and to get an initial reference.

  • class JCCardObjectFactoryAn 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 JCCardProxyFactoryThe 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 JCRemoteRefImplAn 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.

Package clientlib

This package includes an interface and a class.

  • interface CardAccessorAn interface defining methods to exchange APDUs with a card and to close connection to a card.

  • class ApduIOCardAccessorA 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, which must be included in CLASSPATH.