OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.service
Interface CardAccessor

All Known Implementing Classes:
MFCCardAccessor

public abstract interface CardAccessor

An interface for an access condition handler. A card accessor is intended to execute smartcard commands while satisfying access conditions transparently. For example, it can get a challenge from the smartcard and encrypt the command before sending it.

Version:
$Id: CardAccessor.java,v 1.1 1999/12/02 16:06:06 damke Exp $

Method Summary
 ResponseAPDU executeCommand(CommandAPDU command, AccessConditions access)
          Sends a command to the smartcard and satisfies required access conditions.
 void setChannel(MFCCardChannel channel)
          Connects or disconnects this accessor to a channel.
 

Method Detail

setChannel

public void setChannel(MFCCardChannel channel)
Connects or disconnects this accessor to a channel. The channel is required to send commands to the smartcard. To connect, pass a CardChannel as the argument. To disconnect, pass null.
Parameters:
channel - the channel for contacting the smartcard, or null to disconnect

executeCommand

public ResponseAPDU executeCommand(CommandAPDU command,
                                   AccessConditions access)
                            throws CardServiceInabilityException,
                                   CardServiceUnexpectedResponseException,
                                   CardServiceMissingCredentialsException,
                                   CardServiceInvalidCredentialException,
                                   CardTerminalException
Sends a command to the smartcard and satisfies required access conditions. It is implementation dependent which access conditions are supported. If this accessor is incapable to satisfy a required access condition, an exception is thrown. The same happens if the data supplied to the accessor is incomplete or wrong. For example, a cryptographic credential could be missing, or a wrong password may have been entered.
Parameters:
command - the command to send to the smartcard
access - the conditions that have to be satisfied in order to execute the command. The type of these conditions is implementation dependent. Typically, an instance of this interface will only be able to deal with one particular type of access conditions.
Returns:
the response obtained from the smartcard on executing the command
Throws:
CardServiceInabilityException - if a required access condition is not supported. For example, exportable accessors may be unable to deal with cryptographic access conditions like secure messaging.
CardServiceUnexpectedResponseException - if a transparent smartcard access failed. For example, the accessor may have to get a random challenge from the smartcard. If the smartcard returns an error code, this exception would be thrown.
CardServiceMissingCredentialsException - if a credential that is required cannot be found. For example, the accessor may have to perform an external authentication with the smartcard, but there is no matching key for that purpose.
CardServiceInvalidCredentialException - if a credential is rejected by the smartcard. This may happen if wrong keys are stored in the accessor, or if a wrong password is entered by the user.
CardTerminalException - if the underlying card terminal encountered an error when communicating with the smartcard