public abstract class TokenKey extends java.lang.Object implements KeyWithLength
Contains the common elements required by both symmetric and asymmetric implementations.
| Constructor and Description |
|---|
TokenKey(PKCS11LibraryConnection pkcs11LC,
long session,
long objectHandle,
long slotID)
The constructor; creates a new
TokenKey instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
assertMechanismSupported(long mechanism)
Asserts that the given PKCS#11 mechanism is supported on the PKCS#11
device on which this key resides on.
|
void |
destroyCriticalData()
Destroys any critical data contained in this object.
|
byte[] |
getEncoded()
Returns
null since this key implementation does not support
encoding. |
java.lang.String |
getFormat()
Returns
null since this key implementation does not support
encoding. |
long |
getObjectHandle()
The handle to the key on the PKCS#11 device
|
PKCS11LibraryConnection |
getPKCS11LibraryConnection()
Returns the connection to the PKCS#11 library.
|
long |
getSession()
The opened "read-only" session with the PKCS#11 device.
|
long |
getSlotID()
Returns the slot ID under which the session was opened.
|
void |
setOwner(java.lang.Object owner)
Sets the owner of this TokenKey.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetKeyLengthpublic TokenKey(PKCS11LibraryConnection pkcs11LC, long session, long objectHandle, long slotID)
TokenKey instance.pkcs11LC - the connection to the PKCS#11 librarysession - the "read only" sessionobjectHandle - the handle to the key on the PKCS#11 deviceslotID - the slot ID under which the session was openedpublic final PKCS11LibraryConnection getPKCS11LibraryConnection()
public final long getSession()
public final long getObjectHandle()
public final long getSlotID()
public final void destroyCriticalData()
This wipes any internal variables that can be used to access the key on the PKCS#11 device.
public final void assertMechanismSupported(long mechanism)
throws java.security.InvalidKeyException
mechanism - a PKCS#11 mechanismjava.security.InvalidKeyException - if the given PKCS#11 mechanism is supportedpublic final byte[] getEncoded()
null since this key implementation does not support
encoding.null (encoding is not supported)public final java.lang.String getFormat()
null since this key implementation does not support
encoding.null (encoding is not supported)public final void setOwner(java.lang.Object owner)
owner - An object whose finalize will render this TokenKey useless.