|
IAIK PKCS#11 Wrapper version 1.2.18 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--iaik.pkcs.pkcs11.objects.Object
An object of this class represents an object as defined by PKCS#11. An object is of a specific class: DATA, CERTIFICATE, PUBLIC_KEY, PRIVATE_KEY, SECRET_KEY, HW_FEATURE, DOMAIN_PARAMETERS or VENDOR_DEFINED. If an application needs to use vendor-defined objects, it must set a VendorDefinedObjectBuilder using the setVendorDefinedObjectBuilder method.
| Inner Class Summary | |
static interface |
Object.ObjectClass
This interface defines the available object classes as defined by PKCS#11: DATA, CERTIFICATE, PUBLIC_KEY, PRIVATE_KEY, SECRET_KEY, HW_FEATURE, DOMAIN_PARAMETERS or VENDOR_DEFINED. |
static interface |
Object.VendorDefinedObjectBuilder
If an application uses vendor defined objects, it must implement this interface and install such an object handler using setVendorDefinedObjectBuilder. |
| Field Summary | |
protected java.util.Hashtable |
attributeTable_
Contains all attribute objects an object posesses. |
protected ObjectClassAttribute |
objectClass_
The class type of this object. |
protected static java.util.Hashtable |
objectClassNames_
A table holding string representations for all known key types. |
protected long |
objectHandle_
The object handle as given from the PKCS#11 driver. |
protected static Object.VendorDefinedObjectBuilder |
vendorObjectBuilder_
The currently set vendor defined object builder, or null. |
| Constructor Summary | |
|
Object()
The default constructor. |
protected |
Object(Session session,
long objectHandle)
The subclasses that are used to create objects by reading the attributes from the token should call this super-constructor first. |
| Method Summary | |
protected void |
allocateAttributes()
Allocates the attribute objects for this class and adds them to the attribute table. |
java.lang.Object |
clone()
Create a (deep) clone of this object. |
boolean |
equals(java.lang.Object otherObject)
Compares all member variables of this object with the other object. |
java.util.Hashtable |
getAttributeTable()
Return the table that contains all attributes of this object. |
protected static void |
getAttributeValue(Session session,
long objectHandle,
Attribute attribute)
This method reads the attribute specified by attribute from
the token using the given session. |
protected static void |
getAttributeValues(Session session,
long objectHandle,
Attribute[] attributes)
This method reads the attributes in a similar way as getAttributeValue(iaik.pkcs.pkcs11.Session, long, iaik.pkcs.pkcs11.objects.Attribute), but
a complete array at once. |
static Object |
getInstance(Session session,
long objectHandle)
The object creation mechanism of ObjectAccess uses this method to create an instance of an PKCS#11 object. |
LongAttribute |
getObjectClass()
Gets the object class attribute of the PKCS#11 object. |
static java.lang.String |
getObjectClassName(java.lang.Long objectClass)
Get the given object class as string. |
long |
getObjectHandle()
Gets the object handle of the underlying PKCS#11 object on the token. |
java.util.Vector |
getSetAttributes()
This method returns the PKCS#11 attributes of this object. |
static CK_ATTRIBUTE[] |
getSetAttributes(Object object)
This method returns the PKCS#11 attributes of an object. |
protected static Object |
getUnknownObject(Session session,
long objectHandle)
Try to create an object which has no or an unkown object class attribute. |
static Object.VendorDefinedObjectBuilder |
getVendorDefinedObjectBuilder()
Get the currently set vendor-defined object 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(Object 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. |
void |
setObjectHandle(long objectHandle)
Sets the object handle of the underlying PKCS#11 object on the token. |
static void |
setVendorDefinedObjectBuilder(Object.VendorDefinedObjectBuilder builder)
Set a vendor-defined object builder that should be called to create an instance of an vendor-defined PKCS#11 object; i.e. |
java.lang.String |
toString()
This method returns a string representation of the current object. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static Object.VendorDefinedObjectBuilder vendorObjectBuilder_
protected static java.util.Hashtable objectClassNames_
protected java.util.Hashtable attributeTable_
protected ObjectClassAttribute objectClass_
protected long objectHandle_
| Constructor Detail |
public Object()
protected Object(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.| Method Detail |
public static Object getInstance(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.
protected static Object getUnknownObject(Session session,
long objectHandle)
throws TokenException
Object .session - The session to use.objectHandle - The handle of the objectTokenException - If no object could be created.public static void setVendorDefinedObjectBuilder(Object.VendorDefinedObjectBuilder builder)
builder - The vendor-defined object builder. Null to clear any
previously installed vendor-defined builder.public static java.lang.String getObjectClassName(java.lang.Long objectClass)
objectClass - The object class to get as string.public static Object.VendorDefinedObjectBuilder getVendorDefinedObjectBuilder()
protected static void putAttributesInTable(Object object)
object - The object to handle.protected void allocateAttributes()
public java.lang.Object clone()
clone in class java.lang.Objectpublic boolean equals(java.lang.Object otherObject)
equals in class java.lang.ObjectotherObject - The other object to compare to.public java.util.Hashtable getAttributeTable()
public long getObjectHandle()
public void setObjectHandle(long objectHandle)
objectHandle - The object handle of the corresponding PKCS#11 object.public LongAttribute getObjectClass()
public java.util.Vector getSetAttributes()
public int hashCode()
hashCode in class java.lang.Object
public void readAttributes(Session session)
throws TokenException
session - The session handle 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.public java.lang.String toString()
toString in class java.lang.Object
public static CK_ATTRIBUTE[] getSetAttributes(Object object)
throws PKCS11Exception
object - The iaik.pkcs.pkcs11.object.Object object to get the
attributes from.PKCS11Exception - If setting the attribute values.
protected static void getAttributeValue(Session session,
long objectHandle,
Attribute attribute)
throws PKCS11Exception
attribute from
the token using the given session.
The object from which to read the attribute is specified using the
objectHandle. The attribute will contain
the results.
If the attempt to read the attribute returns
CKR_ATTRIBUTE_TYPE_INVALID, this will be indicated by
setting Attribute.setPresent(boolean) to false.
It CKR_ATTRIBUTE_SENSITIVE is returned, the attribute object is
marked as present
(by callign Attribute.setPresent(boolean) with true),
and in addition as sensitive by calling
Attribute.setSensitive(boolean) with true.session - The session to use for reading the attribute.objectHandle - The handle of the object which contains the attribute.attribute - The object specifying the attribute type
(see Attribute.getType()) and receiving the
attribute value
(see Attribute.setCkAttribute(CK_ATTRIBUTE)).PKCS11Exception - If getting the attribute failed.
protected static void getAttributeValues(Session session,
long objectHandle,
Attribute[] attributes)
throws PKCS11Exception
getAttributeValue(iaik.pkcs.pkcs11.Session, long, iaik.pkcs.pkcs11.objects.Attribute), but
a complete array at once. This can lead to performance improvements.
If reading all attributes at once fails, it tries to read each attributes individually.session - The session to use for reading the attributes.objectHandle - The handle of the object which contains the attributes.attributes - The objects specifying the attribute types
(see Attribute.getType()) and receiving the
attribute values
(see Attribute.setCkAttribute(CK_ATTRIBUTE)).PKCS11Exception - If getting the attributes failed.
|
IAIK PKCS#11 Wrapper version 1.2.18 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||