TokenObject

public abstract class TokenObject

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

Methods

equals

public boolean equals(Object obj)

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

getCkId

public String getCkId()

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).

Returns:

the CKA_ID attribute of the object.

getCkLabel

public String getCkLabel()

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

Returns:

the CKA_LABEL attribute of the object.

getContainer

public String getContainer()

Gets container string, corresponding to the CXA_CARD_CONTAINER attribute of the object, as seen by the PKCS#11 interface.

Returns:

the CXA_CARD_CONTAINER attribute of the object.

getParent

public Token getParent()

Gets the Token object form which the object has been retrieved.

Returns:

the Token object.

getPinNumber

public int getPinNumber()

Gets index of the PIN which grants access to the object. This corresponds to the index within the 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 TokenObject.getCkId() attribute).

Returns:

the index of the pin.

getType

public String getType()

Gets the type of object.

Possible values are: "certificate", "publicKey", "privateKey" and "dataContainer".

Returns:

the type of object.

hashCode

public int hashCode()

Gets a hash code, unique for a given object in the card (consistently with the equals method, as per Java specifications).