Class IsoCardSelector
- java.lang.Object
-
- 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)
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALREADY_SELECTED
static int
NEWLY_SELECTED
-
Constructor Summary
Constructors Constructor Description IsoCardSelector(CardFilePath root)
CTOR for IsoCardState object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ResponseAPDU
doSelect(CardChannel channel, CardFilePathComponent comp, boolean isDF, byte p1, SecureChannelCredential secureChannelCredential)
Select a single path componentboolean
elementaryFileSelected()
Check if the last selected file is an EFCardFileInfo
getFCI()
Returns the CardFileInfo of the last selected fileCardFilePath
getPath()
Returns the currently selected pathbyte
getSelectCommandResponseQualifier()
Gets value used for P2boolean
isLeInSelectEnabled()
Query if Le is included in command APDUint
selectFile(CardChannel channel, SecureChannelCredential secureChannelCredential, CardFilePath path)
Select directory or file according to path.int
selectFile(CardChannel channel, SecureChannelCredential secureChannelCredential, CardFilePath path, boolean explicit)
Select directory or file according to path.void
setImplicitlySelectedBySFI(CardFilePath file)
Callback from CardService to record selected EF when short file identifier are usedvoid
setLeInSelectFlag(boolean flag)
Enable or disable flag to include Le in command APDUvoid
setSelectCommandResponseQualifier(byte p2)
Override Parameter P2 in SELECT APDU
-
-
-
Field Detail
-
ALREADY_SELECTED
public static final int ALREADY_SELECTED
- See Also:
- Constant Field Values
-
NEWLY_SELECTED
public static final int NEWLY_SELECTED
- See Also:
- Constant Field Values
-
-
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()
Gets value used for P2- Returns:
- the value for P2
-
setLeInSelectFlag
public void setLeInSelectFlag(boolean flag)
Enable or disable flag to include Le in command APDU- Parameters:
flag
- true to include Le in command APDU
-
isLeInSelectEnabled
public boolean isLeInSelectEnabled()
Query if Le is included in command APDU- Returns:
- true if Le is included
-
setImplicitlySelectedBySFI
public void setImplicitlySelectedBySFI(CardFilePath file)
Callback from CardService to record selected EF when short file identifier are used- Parameters:
file
- the file path
-
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 commandcomp
- Path component. null is parent file is to be selectedisDF
- 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 cardsecureChannelCredential
- Credential to be used when transforming APDUspath
- Path to file to be selectedexplicit
- Explicitly select object to obtain file control information- Returns:
- NEWLY_SELECTED or ALREADY_SELECTED
- Throws:
InvalidCardChannelException
CardTerminalException
CardServiceObjectNotAvailableException
CardServiceUnexpectedStatusWordException
-
selectFile
public int selectFile(CardChannel channel, SecureChannelCredential secureChannelCredential, CardFilePath path) 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 cardsecureChannelCredential
- Credential to be used when transforming APDUspath
- Path to file to be selected- Returns:
- NEWLY_SELECTED or ALREADY_SELECTED
- Throws:
InvalidCardChannelException
CardTerminalException
CardServiceObjectNotAvailableException
CardServiceUnexpectedStatusWordException
-
-