Class IsoCardSelector
- java.lang.Object
-
- de.cardcontact.opencard.service.isocard.IsoCardSelector
-
public class IsoCardSelector extends java.lang.ObjectClass 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 intALREADY_SELECTEDstatic intNEWLY_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 ResponseAPDUdoSelect(CardChannel channel, CardFilePathComponent comp, boolean isDF, byte p1, SecureChannelCredential secureChannelCredential)Select a single path componentbooleanelementaryFileSelected()Check if the last selected file is an EFCardFileInfogetFCI()Returns the CardFileInfo of the last selected fileCardFilePathgetPath()Returns the currently selected pathbytegetSelectCommandResponseQualifier()Gets value used for P2booleanisLeInSelectEnabled()Query if Le is included in command APDUintselectFile(CardChannel channel, SecureChannelCredential secureChannelCredential, CardFilePath path)Select directory or file according to path.intselectFile(CardChannel channel, SecureChannelCredential secureChannelCredential, CardFilePath path, boolean explicit)Select directory or file according to path.voidsetImplicitlySelectedBySFI(CardFilePath file)Callback from CardService to record selected EF when short file identifier are usedvoidsetLeInSelectFlag(boolean flag)Enable or disable flag to include Le in command APDUvoidsetSelectCommandResponseQualifier(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:
InvalidCardChannelExceptionCardTerminalException
-
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:
InvalidCardChannelExceptionCardTerminalExceptionCardServiceObjectNotAvailableExceptionCardServiceUnexpectedStatusWordException
-
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:
InvalidCardChannelExceptionCardTerminalExceptionCardServiceObjectNotAvailableExceptionCardServiceUnexpectedStatusWordException
-
-