![]() |
![]() |
![]() |
Gck Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Known Derived Interfaces | Properties |
struct GckObject; struct GckObjectClass; GckObject * gck_object_from_handle (GckSession *session
,gulong object_handle
); GList * gck_objects_from_handle_array (GckSession *session
,gulong *object_handles
,gulong n_object_handles
); gboolean gck_object_equal (gconstpointer object1
,gconstpointer object2
); guint gck_object_hash (gconstpointer object
); GckModule * gck_object_get_module (GckObject *self
); gulong gck_object_get_handle (GckObject *self
); GckSession * gck_object_get_session (GckObject *self
); gboolean gck_object_destroy (GckObject *self
,GCancellable *cancellable
,GError **error
); void gck_object_destroy_async (GckObject *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gck_object_destroy_finish (GckObject *self
,GAsyncResult *result
,GError **error
); gboolean gck_object_set (GckObject *self
,GckAttributes *attrs
,GCancellable *cancellable
,GError **error
); void gck_object_set_async (GckObject *self
,GckAttributes *attrs
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gck_object_set_finish (GckObject *self
,GAsyncResult *result
,GError **error
); GckAttributes * gck_object_get (GckObject *self
,GCancellable *cancellable
,GError **error
,...
); void gck_object_get_async (GckObject *self
,const gulong *attr_types
,guint n_attr_types
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); GckAttributes * gck_object_get_finish (GckObject *self
,GAsyncResult *result
,GError **error
); guchar * gck_object_get_data (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,gsize *n_data
,GError **error
); guchar * gck_object_get_data_full (GckObject *self
,gulong attr_type
,GckAllocator allocator
,GCancellable *cancellable
,gsize *n_data
,GError **error
); void gck_object_get_data_async (GckObject *self
,gulong attr_type
,GckAllocator allocator
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); guchar * gck_object_get_data_finish (GckObject *self
,GAsyncResult *result
,gsize *n_data
,GError **error
); GckAttributes * gck_object_get_full (GckObject *self
,const gulong *attr_types
,guint n_attr_types
,GCancellable *cancellable
,GError **error
); GckAttributes * gck_object_get_template (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,GError **error
); void gck_object_get_template_async (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); GckAttributes * gck_object_get_template_finish (GckObject *self
,GAsyncResult *result
,GError **error
); gboolean gck_object_set_template (GckObject *self
,gulong attr_type
,GckAttributes *attrs
,GCancellable *cancellable
,GError **error
); void gck_object_set_template_async (GckObject *self
,gulong attr_type
,GckAttributes *attrs
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gck_object_set_template_finish (GckObject *self
,GAsyncResult *result
,GError **error
);
"handle" gulong : Read / Write / Construct Only "module" GckModule* : Read / Write / Construct Only "session" GckSession* : Read / Write / Construct Only
A GckObject holds a handle to a PKCS11 object such as a key or certificate. Token objects are stored on the token persistently. Others are transient and are called session objects.
struct GckObjectClass { GObjectClass parent; };
The class for a GckObject.
If the attribute_types
field is set by a derived class, then the a
GckEnumerator which has been setup using gck_enumerator_set_object_type()
with this derived type will retrieve these attributes when enumerating. In
this case the class must implement an 'attributes' property of boxed type
GCK_TYPE_ATTRIBUTES.
GObjectClass |
derived from this |
GckObject * gck_object_from_handle (GckSession *session
,gulong object_handle
);
Initialize a GckObject from a raw PKCS#11 handle. Normally you would use
gck_session_create_object()
or gck_session_find_objects()
to access objects.
|
The session through which this object is accessed or created. |
|
The raw CK_OBJECT_HANDLE of the object. |
Returns : |
The new GckObject. You should use
g_object_unref() when done with this object. [transfer full]
|
GList * gck_objects_from_handle_array (GckSession *session
,gulong *object_handles
,gulong n_object_handles
);
Initialize a list of GckObject from raw PKCS#11 handles. The handles argument must contain contiguous CK_OBJECT_HANDLE handles in an array.
|
The session for these objects |
|
The raw object handles. [array length=n_object_handles] |
|
The number of raw object handles. |
Returns : |
The list of GckObject
objects. You should use gck_list_unref_free() when done with this
list. [transfer full][element-type Gck.Object]
|
gboolean gck_object_equal (gconstpointer object1
,gconstpointer object2
);
Checks equality of two objects. Two GckObject objects can point to the same underlying PKCS#11 object.
guint gck_object_hash (gconstpointer object
);
Create a hash value for the GckObject.
This function is intended for easily hashing a GckObject to add to a GHashTable or similar data structure.
|
a pointer to a GckObject. [type Gck.Object] |
Returns : |
An integer that can be used as a hash value, or 0 if invalid. |
GckModule * gck_object_get_module (GckObject *self
);
Get the PKCS#11 module to which this object belongs.
|
The object. |
Returns : |
the module, which should be unreffed after use. [transfer full] |
gulong gck_object_get_handle (GckObject *self
);
Get the raw PKCS#11 handle of a GckObject.
|
The object. |
Returns : |
the raw CK_OBJECT_HANDLE object handle |
GckSession * gck_object_get_session (GckObject *self
);
Get the PKCS#11 session assigned to make calls on when operating on this object.
This will only return a session if it was set explitly on this object. By default an object will open and close sessions appropriate for its calls.
|
The object |
Returns : |
the assigned session, which must be unreffed after use. [transfer full] |
gboolean gck_object_destroy (GckObject *self
,GCancellable *cancellable
,GError **error
);
Destroy a PKCS#11 object, deleting it from storage or the session. This call may block for an indefinite period.
|
The object to destroy. |
|
Optional cancellable object, or NULL to ignore. |
|
A location to return an error. |
Returns : |
Whether the call was successful or not. |
void gck_object_destroy_async (GckObject *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Destroy a PKCS#11 object, deleting it from storage or the session. This call will return immediately and complete asynchronously.
|
The object to destroy. |
|
Optional cancellable object, or NULL to ignore. |
|
Callback which is called when operation completes. |
|
Data to pass to the callback. |
gboolean gck_object_destroy_finish (GckObject *self
,GAsyncResult *result
,GError **error
);
Get the status of the operation to destroy a PKCS#11 object, begun with
gck_object_destroy_async()
.
|
The object being destroyed. |
|
The result of the destory operation passed to the callback. |
|
A location to store an error. |
Returns : |
Whether the object was destroyed successfully or not. |
gboolean gck_object_set (GckObject *self
,GckAttributes *attrs
,GCancellable *cancellable
,GError **error
);
Set PKCS#11 attributes on an object. This call may block for an indefinite period.
If the attrs
GckAttributes is floating, it is consumed.
|
The object to set attributes on. |
|
The attributes to set on the object. |
|
Optional cancellable object, or NULL to ignore. |
|
A location to return an error. |
Returns : |
Whether the call was successful or not. |
void gck_object_set_async (GckObject *self
,GckAttributes *attrs
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Set PKCS#11 attributes on an object. This call will return immediately and completes asynchronously.
If the attrs
GckAttributes is floating, it is consumed.
|
The object to set attributes on. |
|
The attributes to set on the object. |
|
Optional cancellable object, or NULL to ignore. |
|
Callback which is called when operation completes. |
|
Data to pass to the callback. |
gboolean gck_object_set_finish (GckObject *self
,GAsyncResult *result
,GError **error
);
Get the status of the operation to set attributes on a PKCS#11 object,
begun with gck_object_set_async()
.
|
The object to set attributes on. |
|
The result of the destory operation passed to the callback. |
|
A location to store an error. |
Returns : |
Whether the attributes were successfully set on the object or not. |
GckAttributes * gck_object_get (GckObject *self
,GCancellable *cancellable
,GError **error
,...
);
Get the specified attributes from the object. This call may block for an indefinite period.
|
The object to get attributes from. |
|
A GCancellable or NULL
|
|
A location to store an error. |
|
The attribute types to get. |
Returns : |
the resulting PKCS#11 attributes, or NULL if an
error occurred; the result must be unreffed when you're finished
with it. [transfer full]
|
void gck_object_get_async (GckObject *self
,const gulong *attr_types
,guint n_attr_types
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Get the specified attributes from the object. The attributes will be cleared
of their current values, and new attributes will be stored. The attributes
should not be accessed in any way except for referencing and unreferencing
them until gck_object_get_finish()
is called.
This call returns immediately and completes asynchronously.
|
The object to get attributes from. |
|
the types of the attributes to get. [array length=n_attr_types] |
|
the number of attr_types |
|
optional cancellation object, or NULL
|
|
A callback which is called when the operation completes. |
|
Data to be passed to the callback. |
GckAttributes * gck_object_get_finish (GckObject *self
,GAsyncResult *result
,GError **error
);
Get the result of a get operation and return specified attributes from the object.
No extra references are added to the returned attributes pointer.
|
The object to get attributes from. |
|
The result passed to the callback. |
|
A location to store an error. |
Returns : |
The filled in attributes structure if successful or NULL if not successful. |
guchar * gck_object_get_data (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,gsize *n_data
,GError **error
);
Get the data for the specified attribute from the object. For convenience the returned data has a null terminator.
This call may block for an indefinite period.
|
The object to get attribute data from. |
|
The attribute to get data for. |
|
A GCancellable or NULL
|
|
The length of the resulting data. |
|
A location to store an error. |
Returns : |
the resulting PKCS#11
attribute data, or NULL if an error occurred. [transfer full][array length=n_data]
|
guchar * gck_object_get_data_full (GckObject *self
,gulong attr_type
,GckAllocator allocator
,GCancellable *cancellable
,gsize *n_data
,GError **error
);
Get the data for the specified attribute from the object. For convenience the returned data has an extra null terminator, not included in the returned length.
This call may block for an indefinite period.
|
The object to get attribute data from. |
|
The attribute to get data for. |
|
An allocator with which to allocate memory for the data, or NULL for default. |
|
Optional cancellation object, or NULL. |
|
The length of the resulting data. |
|
A location to store an error. |
Returns : |
The resulting PKCS#11
attribute data, or NULL if an error occurred. [transfer full][array length=n_data]
|
void gck_object_get_data_async (GckObject *self
,gulong attr_type
,GckAllocator allocator
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Get the data for the specified attribute from the object.
This call will return immediately and complete asynchronously.
|
The object to get attribute data from. |
|
The attribute to get data for. |
|
An allocator with which to allocate memory for the data, or NULL for default. [skip] |
|
Optional cancellation object, or NULL. |
|
Called when the operation completes. |
|
Data to be passed to the callback. |
guchar * gck_object_get_data_finish (GckObject *self
,GAsyncResult *result
,gsize *n_data
,GError **error
);
Get the result of an operation to get attribute data from an object. For convenience the returned data has an extra null terminator, not included in the returned length.
|
The object to get an attribute from. |
|
The result passed to the callback. |
|
The length of the resulting data. |
|
A location to store an error. |
Returns : |
The PKCS#11 attribute data
or NULL if an error occurred. [transfer full][array length=n_data]
|
GckAttributes * gck_object_get_full (GckObject *self
,const gulong *attr_types
,guint n_attr_types
,GCancellable *cancellable
,GError **error
);
Get the specified attributes from the object. This call may block for an indefinite period.
No extra references are added to the returned attributes pointer. During this call you may not access the attributes in any way.
|
The object to get attributes from. |
|
the types of the attributes to get. [array length=n_attr_types] |
|
the number of attr_types |
|
optional cancellation object, or NULL
|
|
A location to store an error. |
Returns : |
a pointer to the filled in attributes if successful,
or NULL if not. [transfer full]
|
GckAttributes * gck_object_get_template (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,GError **error
);
Get an attribute template from the object. The attr_type must be for an attribute which returns a template.
This call may block for an indefinite period.
|
The object to get an attribute template from. |
|
The template attribute type. |
|
Optional cancellation object, or NULL. |
|
A location to store an error. |
Returns : |
the resulting PKCS#11 attribute template, or NULL
if an error occurred. [transfer full]
|
void gck_object_get_template_async (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Get an attribute template from the object. The attr_type must be for an attribute which returns a template.
This call will return immediately and complete asynchronously.
|
The object to get an attribute template from. |
|
The template attribute type. |
|
Optional cancellation object, or NULL. |
|
Called when the operation completes. |
|
Data to be passed to the callback. |
GckAttributes * gck_object_get_template_finish (GckObject *self
,GAsyncResult *result
,GError **error
);
Get the result of an operation to get attribute template from an object.
|
The object to get an attribute from. |
|
The result passed to the callback. |
|
A location to store an error. |
Returns : |
the resulting PKCS#11 attribute template, or NULL
if an error occurred. [transfer full]
|
gboolean gck_object_set_template (GckObject *self
,gulong attr_type
,GckAttributes *attrs
,GCancellable *cancellable
,GError **error
);
Set an attribute template on the object. The attr_type must be for an attribute which contains a template.
If the attrs
GckAttributes is floating, it is consumed.
This call may block for an indefinite period.
|
The object to set an attribute template on. |
|
The attribute template type. |
|
The attribute template. |
|
Optional cancellation object, or NULL. |
|
A location to store an error. |
Returns : |
TRUE if the operation succeeded. |
void gck_object_set_template_async (GckObject *self
,gulong attr_type
,GckAttributes *attrs
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Set an attribute template on the object. The attr_type must be for an attribute which contains a template.
If the attrs
GckAttributes is floating, it is consumed.
This call will return immediately and complete asynchronously.
|
The object to set an attribute template on. |
|
The attribute template type. |
|
The attribute template. |
|
Optional cancellation object, or NULL. |
|
Called when the operation completes. |
|
Data to be passed to the callback. |
gboolean gck_object_set_template_finish (GckObject *self
,GAsyncResult *result
,GError **error
);
Get the result of an operation to set attribute template on an object.
|
The object to set an attribute template on. |
|
The result passed to the callback. |
|
A location to store an error. |
Returns : |
TRUE if the operation succeeded. |
"handle"
property"handle" gulong : Read / Write / Construct Only
The raw PKCS11 handle for this object.
"module"
property"module" GckModule* : Read / Write / Construct Only
The GckModule that this object belongs to.
"session"
property"session" GckSession* : Read / Write / Construct Only
The PKCS11 session to make calls on when this object needs to perform operations on itself.
If this is NULL then a new session is opened for each operation,
such as gck_object_get()
, gck_object_set()
or gck_object_destroy()
.