.. java:import:: org.json JSONObject

TokenObject
===========

.. java:package:: com.idopte.scmapi
   :noindex:

.. java:type:: public abstract class TokenObject

   Abstract class describes a cryptographic object located in a smart card.

Methods
-------
equals
^^^^^^

.. java:method:: @Override public boolean equals(Object obj)
   :outertype: TokenObject

   Compares two objects, checking if they refer to the same physical object in the card. This can be used to remove duplicates when calling \ :java:ref:`Token.getObjects`\  multiple times. The result is valid only if the two objects have been retrieved within the same connect session.

getCkId
^^^^^^^

.. java:method:: public String getCkId()
   :outertype: TokenObject

   Gets identifier string, corresponding to the hexadecimal representation of the ``CKA_ID`` attribute of the object, as seen by the PKCS#11 interface.

   This value can be used to match keys and certificates that are linked together (belong in the same container).

   :return: the ``CKA_ID`` attribute of the object.

getCkLabel
^^^^^^^^^^

.. java:method:: public String getCkLabel()
   :outertype: TokenObject

   Gets label string, corresponding to the ``CKA_LABEL`` attribute of the object, as seen by the PKCS#11 interface.

   :return: the ``CKA_LABEL`` attribute of the object.

getParent
^^^^^^^^^

.. java:method:: public Token getParent()
   :outertype: TokenObject

   Gets the \ :java:ref:`Token`\  object form which the object has been retrieved.

   :return: the \ :java:ref:`Token`\  object.

getPinNumber
^^^^^^^^^^^^

.. java:method:: public int getPinNumber()
   :outertype: TokenObject

   Gets index of the PIN which grants access to the object. This corresponds to the index within the \ :java:ref:`Token.getPins()`\  array.

   For public objects (certificates and public keys), it is the PIN which grants access to the corresponding private key (association is determined by the \ :java:ref:`TokenObject.getCkId()`\  attribute).

   :return: the index of the pin.

hashCode
^^^^^^^^

.. java:method:: @Override public int hashCode()
   :outertype: TokenObject

   Gets a hash code, unique for a given object in the card (consistently with the \ :java:ref:`equals(Object)`\  method, as per Java specifications).