.. java:import:: com.idopte.scmiddleware Log .. java:import:: org.json JSONArray .. java:import:: org.json JSONException .. java:import:: org.json JSONObject .. java:import:: java.io IOException .. java:import:: java.util ArrayList .. java:import:: java.util List Token ===== .. java:package:: com.idopte.scmapi :noindex: .. java:type:: public class Token Class represents connection to a smart card (or more generally, any cryptographic device). Token objects are obtained by calling the \ :java:ref:`Reader.connect()`\ method. Methods ------- disconnect ^^^^^^^^^^ .. java:method:: public void disconnect() throws SCMException :outertype: Token Disconnects from the token. generateAppLicense ^^^^^^^^^^^^^^^^^^ .. java:method:: public void generateAppLicense() throws SCMException :outertype: Token Generates an \ *App License*\ for the current token, if current API embeds this mechanism. This function is also called internally on certificates registration, through \ :java:ref:`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 ^^^^^^^^ .. java:method:: public String getLabel() :outertype: Token Gets the token label. :return: the token label. getLicenseEndDate ^^^^^^^^^^^^^^^^^ .. java:method:: public String getLicenseEndDate() throws SCMException :outertype: Token Returns the end date for the license validity. :return: 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 ^^^^^^^^^^^^^^^ .. java:method:: public String getManufacturer() :outertype: Token Gets the token manufacturer name. :return: the manufacturer name. getModel ^^^^^^^^ .. java:method:: public String getModel() :outertype: Token Gets the token model name. :return: the model name. getObjects ^^^^^^^^^^ .. java:method:: public List getObjects() throws SCMException :outertype: Token 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 \ :java:ref:`TokenObject`\ instances, even if the objects have been previously retrieved. To check whether two \ :java:ref:`TokenObject`\ instances refer to the same physical object in the card, the \ :java:ref:`TokenObject.equals`\ method can be used. :return: the list of \ :java:ref:`TokenObject`\ items. getPins ^^^^^^^ .. java:method:: public Pin[] getPins() :outertype: Token Returns array of \ :java:ref:`Pin`\ objects describing all the PINs available with this card. :return: \ :java:ref:`Pin`\ array. getReader ^^^^^^^^^ .. java:method:: public Reader getReader() :outertype: Token Gets the \ :java:ref:`Reader`\ object from which this token is issued. :return: the reader object. getSerialNumber ^^^^^^^^^^^^^^^ .. java:method:: public String getSerialNumber() :outertype: Token Gets the token serial number. :return: the serial number. hasProtectedAuthPath ^^^^^^^^^^^^^^^^^^^^ .. java:method:: public boolean hasProtectedAuthPath() :outertype: Token Returns \ ``true``\ if this token allows user authentication through a hardware protected path (like a PIN pad reader, or using biometric recognition). :return: \ ``true``\ if this token allows user authentication through a hardware protected path; \ ``false``\ otherwise isInitialized ^^^^^^^^^^^^^ .. java:method:: public boolean isInitialized() :outertype: Token Returns \ ``true``\ if this this token has been initialized. :return: \ ``true``\ if this token has been initialized; \ ``false``\ otherwise isLicenseValid ^^^^^^^^^^^^^^ .. java:method:: public boolean isLicenseValid() throws SCMException :outertype: Token Returns whether the license is valid for this card. :return: \ ``true``\ if the card has a valid license; \ ``false``\ otherwise isPresent ^^^^^^^^^ .. java:method:: public boolean isPresent() :outertype: Token Gets token presence state. :return: `true` if token is still connected and usable, `false` if it has been disconnected or removed from reader.