Token

public class Token

Class represents connection to a smart card (or more generally, any cryptographic device). Token objects are obtained by calling the Reader.connect() method.

Methods

disconnect

public void disconnect()

Disconnects from the token.

generateAppLicense

public void generateAppLicense()

Generates an App License for the current token, if current API embeds this mechanism.

This function is also called internally on certificates registration, through SCMEnvironment.registerCertificates(Token) for instance.

Note that the resulting license will be stored in app data; thus, for a same smart card, calling this function on each app instance (on a different device, after a re-installation or if app data is cleared) using this smart card is needed.

Throws:
  • SCMException – if an error occurred, typically if this API does not embed App License Generation.

getLabel

public String getLabel()

Gets the token label.

Returns:the token label.

getLicenseEndDate

public String getLicenseEndDate()

Returns the end date for the license validity.

Returns:The end date, as a string with the “YYYYMMDD” format. The return value may be “000000” for licenses with permanent validity. The return value may be an empty string for cards that do not have a license loaded, or for cards that benefit from a global licensing scheme. These cases can be identified depending on the isLicenseValid result.

getManufacturer

public String getManufacturer()

Gets the token manufacturer name.

Returns:the manufacturer name.

getModel

public String getModel()

Gets the token model name.

Returns:the model name.

getObjects

public List<TokenObject> getObjects()

Retrieves all objects found in the token (certificates and keys).

Note that private objects may not be returned if the associated PIN has not been verified previously. Also take in consideration that the API does not internally keep references to the retrieved objects, and calling this method will always return newly created TokenObject instances, even if the objects have been previously retrieved. To check whether two TokenObject instances refer to the same physical object in the card, the TokenObject.equals method can be used.

Returns:the list of TokenObject items.

getPins

public Pin[] getPins()

Returns array of Pin objects describing all the PINs available with this card.

Returns:Pinarray.

getReader

public Reader getReader()

Gets the Reader object from which this token is issued.

Returns:the reader object.

getSerialNumber

public String getSerialNumber()

Gets the token serial number.

Returns:the serial number.

hasProtectedAuthPath

public boolean hasProtectedAuthPath()

Returns true if this token allows user authentication through a hardware protected path (like a PIN pad reader, or using biometric recognition).

Returns:true if this token allows user authentication through a hardware protected path; false otherwise

isInitialized

public boolean isInitialized()

Returns true if this this token has been initialized.

Returns:true if this token has been initialized; false otherwise

isLicenseValid

public boolean isLicenseValid()

Returns whether the license is valid for this card.

Returns:true if the card has a valid license; false otherwise

isPresent

public boolean isPresent()

Gets token presence state.

Returns:true if token is still connected and usable, false if it has been disconnected or removed from reader.