|
IAIK PKCS#11 Wrapper version 1.2.16 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectiaik.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.
Nested 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 Hashtable |
attributeTable_
Contains all attribute objects an object posesses. |
protected ObjectClassAttribute |
objectClass_
The class type of this object. |
protected static 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. |
Object |
clone()
Create a (deep) clone of this object. |
boolean |
equals(Object otherObject)
Compares all member variables of this object with the other object. |
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 .
|
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 String |
getObjectClassName(Long objectClass)
Get the given object class as string. |
long |
getObjectHandle()
Gets the object handle of the underlying PKCS#11 object on the token. |
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. an instance of a vendor defined sub-class of this class. |
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 Hashtable objectClassNames_
protected 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 object
TokenException
- 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 String getObjectClassName(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 Object clone()
public boolean equals(Object otherObject)
otherObject
- The other object to compare to.
public Hashtable getAttributeTable()
public long getObjectHandle()
public void setObjectHandle(long objectHandle)
objectHandle
- The object handle of the corresponding PKCS#11 object.public LongAttribute getObjectClass()
public Vector getSetAttributes()
public int hashCode()
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 String toString()
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.
|
IAIK PKCS#11 Wrapper version 1.2.16 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |