de.cardcontact.opencard.service.isocard
Class IsoCardSelector

java.lang.Object
  extended by de.cardcontact.opencard.service.isocard.IsoCardSelector

public class IsoCardSelector
extends java.lang.Object

Class to support the selection of card objects and the maintenance of the current selection status

Author:
Andreas Schwier (info@cardcontact.de)

Constructor Summary
IsoCardSelector(CardFilePath root)
          CTOR for IsoCardState object
 
Method Summary
protected  ResponseAPDU doSelect(CardChannel channel, CardFilePathComponent comp, boolean isDF, byte p1, SecureChannelCredential secureChannelCredential)
          Select a single path component
 boolean elementaryFileSelected()
          Check if the last selected file is an EF
 CardFileInfo getFCI()
          Returns the CardFileInfo of the last selected file
 CardFilePath getPath()
          Returns the currently selected path
 byte getSelectCommandResponseQualifier()
           
 boolean isLeInSelectEnabled()
           
 int selectFile(CardChannel channel, SecureChannelCredential secureChannelCredential, CardFilePath path)
           
 int selectFile(CardChannel channel, SecureChannelCredential secureChannelCredential, CardFilePath path, boolean explicit)
          Select directory or file according to path.
 void setImplicitlySelectedBySFI(CardFilePath file)
           
 void setLeInSelectFlag(boolean flag)
           
 void setSelectCommandResponseQualifier(byte p2)
          Override Parameter P2 in SELECT APDU
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IsoCardSelector

public IsoCardSelector(CardFilePath root)
CTOR for IsoCardState object

Method Detail

getPath

public CardFilePath getPath()
Returns the currently selected path

Returns:
the currently selected path

getFCI

public CardFileInfo getFCI()
Returns the CardFileInfo of the last selected file

Returns:
the latest CardFileInfo or null if unknown

elementaryFileSelected

public boolean elementaryFileSelected()
Check if the last selected file is an EF

Returns:
true if the last selected object is an EF

setSelectCommandResponseQualifier

public void setSelectCommandResponseQualifier(byte p2)
Override Parameter P2 in SELECT APDU

Parameters:
p2 - the new P2 to use

getSelectCommandResponseQualifier

public byte getSelectCommandResponseQualifier()

setLeInSelectFlag

public void setLeInSelectFlag(boolean flag)

isLeInSelectEnabled

public boolean isLeInSelectEnabled()

setImplicitlySelectedBySFI

public void setImplicitlySelectedBySFI(CardFilePath file)

doSelect

protected ResponseAPDU doSelect(CardChannel channel,
                                CardFilePathComponent comp,
                                boolean isDF,
                                byte p1,
                                SecureChannelCredential secureChannelCredential)
                         throws InvalidCardChannelException,
                                CardTerminalException
Select a single path component

Parameters:
channel - Card channel to use for SELECT command
comp - Path component. null is parent file is to be selected
isDF - true if the path component is known to be a DF
Returns:
Response APDU from SELECT command
Throws:
InvalidCardChannelException
CardTerminalException

selectFile

public int selectFile(CardChannel channel,
                      SecureChannelCredential secureChannelCredential,
                      CardFilePath path,
                      boolean explicit)
               throws InvalidCardChannelException,
                      CardTerminalException,
                      CardServiceObjectNotAvailableException,
                      CardServiceUnexpectedStatusWordException
Select directory or file according to path. This function observes the currently selected EF or DF as stored in the CardState object of the CardChannel. This method has some rather complex algorithm to determine the way to select the new object. It will in general try to find the shortest way to the new object or otherwise reselect the full path starting at the MF

Parameters:
channel - Card channel used to communicate with the card
secureChannelCredential - Credential to be used when transforming APDUs
path - Path to file to be selected
explicit - Explicitly select object to obtain file control information
Returns:
File control information returned in SELECT command or null if file was not selected
Throws:
InvalidCardChannelException
CardTerminalException
CardServiceObjectNotAvailableException
CardServiceUnexpectedStatusWordException

selectFile

public int selectFile(CardChannel channel,
                      SecureChannelCredential secureChannelCredential,
                      CardFilePath path)
               throws InvalidCardChannelException,
                      CardTerminalException,
                      CardServiceObjectNotAvailableException,
                      CardServiceUnexpectedStatusWordException
Throws:
InvalidCardChannelException
CardTerminalException
CardServiceObjectNotAvailableException
CardServiceUnexpectedStatusWordException