public class Key extends Storage
| Modifier and Type | Class and Description |
|---|---|
static interface |
Key.KeyType
This interface defines the available key types as defined by PKCS#11
v2.11:
RSA, DSA, DH, ECDSA, KEA, GENERIC_SECRET, RC2, RC4, DES, DES2, DES3,
CAST, CAST3, CAST5, CAST128, RC5, IDEA, SKIPJACK, BATON, JUNIPER, CDMF,
AES, EC, X9_42_DH or VENDOR_DEFINED.
|
static interface |
Key.VendorDefinedKeyBuilder
If an application uses vendor defined keys, it must implement this
interface and install such an object handler using
setVendorDefinedKeyBuilder.
|
PKCS11Object.ObjectClass, PKCS11Object.VendorDefinedObjectBuilder| Modifier and Type | Field and Description |
|---|---|
protected MechanismArrayAttribute |
allowedMechanisms
The list of mechanism that can be used with this key.
|
protected BooleanAttribute |
derive
True, if other keys can be derived from this key.
|
protected DateAttribute |
endDate
The end date of this key's validity.
|
protected ByteArrayAttribute |
id
The identifier (ID) of this key.
|
protected MechanismAttribute |
keyGenMechanism
The mechanism used to generate the key material.
|
protected KeyTypeAttribute |
keyType
The type of this key.
|
protected static Hashtable<Long,String> |
keyTypeNames
A table holding string representations for all known key types.
|
protected BooleanAttribute |
local
True, if this key was created (generated or copied from a different key)
on the token.
|
protected DateAttribute |
startDate
The start date of this key's validity.
|
protected static Key.VendorDefinedKeyBuilder |
vendorKeyBuilder
The currently set vendor defined key builder, or null.
|
label, modifiable, private_, tokenattributeTable, objectClass, objectClassNames, objectHandle, vendorObjectBuilder| Modifier | Constructor and Description |
|---|---|
|
Key()
The default constructor.
|
protected |
Key(Session session,
long objectHandle)
Called by sub-classes to create an instance of a PKCS#11 key.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
allocateAttributes()
Allocates the attribute objects for this class and adds them to the
attribute table.
|
boolean |
equals(Object otherObject)
Compares all member variables of this object with the other object.
|
MechanismArrayAttribute |
getAllowedMechanisms()
Get the list of mechanisms that are allowed to use with this key.
|
BooleanAttribute |
getDerive()
Check, if other keys can be derived from this key.
|
DateAttribute |
getEndDate()
Gets the end date attribute of the validity of this key.
|
ByteArrayAttribute |
getId()
Gets the ID attribute of this key.
|
MechanismAttribute |
getKeyGenMechanism()
Get the mechanism used to generate the key material for this key.
|
LongAttribute |
getKeyType()
Gets the key type attribute of the PKCS#11 key.
|
static String |
getKeyTypeName(Long keyType)
Get the given key type as string.
|
BooleanAttribute |
getLocal()
Check, if this key is a local key; i.e.
|
DateAttribute |
getStartDate()
Gets the start date attribute of the validity of this key.
|
static Key.VendorDefinedKeyBuilder |
getVendorDefinedKeyBuilder()
Get the currently set vendor-defined key builder.
|
int |
hashCode()
The overriding of this method should ensure that the objects of this
class work correctly in a hashtable.
|
protected static void |
putAttributesInTable(Key object)
Put all attributes of the given object into the attributes table of this
object.
|
void |
readAttributes(Session session)
Read the values of the attributes of this object from the token.
|
static void |
setVendorDefinedKeyBuilder(Key.VendorDefinedKeyBuilder builder)
Set a vendor-defined key builder that should be called to create an
instance of an vendor-defined PKCS#11 key; i.e.
|
String |
toString()
Returns a string representation of the current object.
|
getLabel, getModifiable, getPrivate, getToken, putAttributesInTablegetAttribute, getAttributeTable, getAttributeValue, getAttributeValues, getInstance, getObjectClass, getObjectClassName, getObjectHandle, getSetAttributes, getSetAttributes, getUnknownObject, getVendorDefinedObjectBuilder, putAttribute, putAttributesInTable, removeAttribute, setObjectHandle, setVendorDefinedObjectBuilder, toStringprotected static Key.VendorDefinedKeyBuilder vendorKeyBuilder
protected static Hashtable<Long,String> keyTypeNames
protected KeyTypeAttribute keyType
protected ByteArrayAttribute id
protected DateAttribute startDate
protected DateAttribute endDate
protected BooleanAttribute derive
protected BooleanAttribute local
protected MechanismAttribute keyGenMechanism
protected MechanismArrayAttribute allowedMechanisms
public Key()
protected Key(Session session, long objectHandle) throws TokenException
session - The session to use for reading attributes. This session must
have the appropriate rights; i.e. it must be a user-session, if
it is a private object.objectHandle - The object handle as given from the PKCS#111 module.TokenException - If getting the attributes failed.public static void setVendorDefinedKeyBuilder(Key.VendorDefinedKeyBuilder builder)
builder - The vendor-defined key builder. Null to clear any previously
installed vendor-defined builder.public static Key.VendorDefinedKeyBuilder getVendorDefinedKeyBuilder()
public static String getKeyTypeName(Long keyType)
keyType - The key type to get as string.protected static void putAttributesInTable(Key object)
object - The object to handle.protected void allocateAttributes()
allocateAttributes in class Storagepublic boolean equals(Object otherObject)
public LongAttribute getKeyType()
public ByteArrayAttribute getId()
public DateAttribute getStartDate()
public DateAttribute getEndDate()
public BooleanAttribute getDerive()
public BooleanAttribute getLocal()
public MechanismAttribute getKeyGenMechanism()
public MechanismArrayAttribute getAllowedMechanisms()
public int hashCode()
public void readAttributes(Session session) throws TokenException
readAttributes in class Storagesession - The session to use for reading attributes. This session must
have the appropriate rights; i.e. it must be a user-session, if
it is a private object.TokenException - If getting the attributes failed.Copyright © 2018. All rights reserved.