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

com.ibm.opencard.service
Class AccessInformation

java.lang.Object
  |
  +--com.ibm.opencard.service.AccessInformation
Direct Known Subclasses:
MFCAccessInformation

public abstract class AccessInformation
extends java.lang.Object

Represents access information to smartcard objects. Typically, smartcards define several command classes, for example READ and UPDATE. Objects on the smartcard, like files, have access conditions for each command class. These conditions must be satisfied before a command of that class can be executed on the object.
This class is meant to represent the access conditions for all command classes that are relevant for a smartcard object. It is abstract since the number of command classes and the representation of the access conditions are implementation dependent.

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

Field Summary
protected  AccessConditions[] access_conditions
          An array of decoded access conditions.
protected  byte[] encoded_conditions
          The access information in a card-specific encoding.
protected  int encoded_offset
          The offset of the access conditions in encoded_conditions.
 
Constructor Summary
protected AccessInformation(byte[] encoded, int offset, int cmdclasses)
          Initializes new access information.
 
Method Summary
 AccessConditions getAccessConditions(int cmdclass)
          Returns access conditions for a given command class.
protected abstract  AccessConditions parseAccessConditions(byte[] encoded, int offset, int cmdclass)
          Parses encoded access conditions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encoded_conditions

protected byte[] encoded_conditions
The access information in a card-specific encoding. Access conditions for a given command class are extracted on demand. The actual position of the first byte of the encoded access information in this array is indicated by encoded_offset.
See Also:
encoded_offset

encoded_offset

protected int encoded_offset
The offset of the access conditions in encoded_conditions. Typically, the encoded access conditions are returned by the smartcard as the result of a SELECT operation. Only a part of the select response will encode the relevant information. This index gives the first byte of the relevant information within the array stored in encoded_conditions. This allows to deal with the actual select response as well as with an extracted subarray, or data obtained by some other means.
See Also:
encoded_conditions

access_conditions

protected AccessConditions[] access_conditions
An array of decoded access conditions. Typically, the various command classes will be identified by a compact range of int. Each time the access conditions for a command class have been decoded, they can be stored here for further references to the same command class. The size of this array is specified as a constructor argument.
Constructor Detail

AccessInformation

protected AccessInformation(byte[] encoded,
                            int offset,
                            int cmdclasses)
Initializes new access information. The encoded access conditions are stored, and an array to hold the decoded ones will be allocated. Actual decoding is done on demand.
Parameters:
encoded - an array holding the encoded access conditions
offset - the first relevant byte in encoded
cmdclasses - the number of command classes that can be represented by a compact range of int
See Also:
encoded_conditions, encoded_offset, access_conditions
Method Detail

getAccessConditions

public AccessConditions getAccessConditions(int cmdclass)
Returns access conditions for a given command class. If the access conditions have been decoded before, they are taken from access_conditions. Otherwise, they are decoded now and stored there.
If storing the access conditions in an array is not appropriate, this method has to be redefined by the respective implementation.
Parameters:
cmdclass - the command class for which to return access conditions. The definition of command classes is implementation dependent.
Returns:
the access conditions for the given command class, or null if none are defined

parseAccessConditions

protected abstract AccessConditions parseAccessConditions(byte[] encoded,
                                                          int offset,
                                                          int cmdclass)
Parses encoded access conditions. This method has to be defined by derived classes to extract the access conditions for a given command class from the implementation dependent encoding.
Parameters:
encoded - an array holding the encoded access conditions
offset - the start of the relevant data in encoded
cmdclass - the command class for which to decode the access conditions