![]() |
![]() |
![]() |
GCK Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
GckObject; GckObject* gck_object_from_handle (GckSession *session
,CK_OBJECT_HANDLE handle
); GList* gck_objects_from_handle_array (GckSession *session
,CK_OBJECT_HANDLE_PTR handles
,CK_ULONG n_handles
); gboolean gck_object_equal (gconstpointer object1
,gconstpointer object2
); guint gck_object_hash (gconstpointer object
); GckModule* gck_object_get_module (GckObject *self
); CK_OBJECT_HANDLE gck_object_get_handle (GckObject *self
); GckSession* gck_object_get_session (GckObject *self
); gboolean gck_object_destroy (GckObject *self
,GCancellable *cancellable
,GError **err
); void gck_object_destroy_async (GckObject *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gck_object_destroy_finish (GckObject *self
,GAsyncResult *result
,GError **err
); gboolean gck_object_set (GckObject *self
,GckAttributes *attrs
,GCancellable *cancellable
,GError **err
); 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 **err
); GckAttributes* gck_object_get (GckObject *self
,GCancellable *cancellable
,GError **err
,...
); void gck_object_get_async (GckObject *self
,gulong *attr_types
,guint n_attr_types
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); GckAttributes* gck_object_get_finish (GckObject *self
,GAsyncResult *result
,GError **err
); gpointer gck_object_get_data (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,gsize *n_data
,GError **err
); gpointer gck_object_get_data_full (GckObject *self
,gulong attr_type
,GckAllocator allocator
,GCancellable *cancellable
,gsize *n_data
,GError **err
); void gck_object_get_data_async (GckObject *self
,gulong attr_type
,GckAllocator allocator
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gpointer gck_object_get_data_finish (GckObject *self
,GAsyncResult *result
,gsize *n_data
,GError **err
);
"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.
typedef struct _GckObject GckObject;
Represents a PKCS11 object handle such as a key or certifiacte.
GckObject* gck_object_from_handle (GckSession *session
,CK_OBJECT_HANDLE handle
);
Initialize a GckObject from a raw PKCS11 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 handle of the object. |
Returns : |
The new GckObject. You should use g_object_unref() when done with this object.
|
GList* gck_objects_from_handle_array (GckSession *session
,CK_OBJECT_HANDLE_PTR handles
,CK_ULONG n_handles
);
Initialize a list of GckObject from raw PKCS11 handles. The handles argument must contain contiguous CK_OBJECT_HANDLE handles in an array.
|
|
|
The raw object handles. |
|
The number of raw object handles. |
Returns : |
The list of GckObject. You should use gck_list_unref_free() when done with
this list.
|
gboolean gck_object_equal (gconstpointer object1
,gconstpointer object2
);
Checks equality of two objects. Two GckObject objects can point to the same underlying PKCS11 object.
|
A pointer to the first GckObject |
|
A pointer to the second GckObject |
Returns : |
TRUE if object1 and object2 are equal. FALSE if either is not a GckObject. |
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 |
Returns : |
An integer that can be used as a hash value, or 0 if invalid. |
GckModule* gck_object_get_module (GckObject *self
);
Get the PKCS11 module to which this object belongs.
|
The object. |
Returns : |
The module, which should be unreffed after use. |
CK_OBJECT_HANDLE gck_object_get_handle (GckObject *self
);
Get the raw PKCS11 handle of a GckObject.
|
The object. |
Returns : |
The raw object handle. |
GckSession* gck_object_get_session (GckObject *self
);
Get the PKCS11 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. |
gboolean gck_object_destroy (GckObject *self
,GCancellable *cancellable
,GError **err
);
Destroy a PKCS11 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 PKCS11 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 **err
);
Get the status of the operation to destroy a PKCS11 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 **err
);
Set PKCS11 attributes on an object. This call may block for an indefinite period.
|
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 PKCS11 attributes on an object. This call will return immediately and completes asynchronously.
|
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 **err
);
Get the status of the operation to set attributes on a PKCS11 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 **err
,...
);
Get the specified attributes from the object. This call may block for an indefinite period.
|
The object to get attributes from. |
|
|
|
A location to store an error. |
|
The attribute types to get. |
Returns : |
The resulting PKCS11 attributes, or NULL if an error occurred. The result must be unreffed when you're finished with it. |
void gck_object_get_async (GckObject *self
,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. |
|
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 **err
);
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. |
gpointer gck_object_get_data (GckObject *self
,gulong attr_type
,GCancellable *cancellable
,gsize *n_data
,GError **err
);
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. |
|
|
|
The length of the resulting data. |
|
A location to store an error. |
Returns : |
The resulting PKCS11 attribute data, or NULL if an error occurred. |
gpointer gck_object_get_data_full (GckObject *self
,gulong attr_type
,GckAllocator allocator
,GCancellable *cancellable
,gsize *n_data
,GError **err
);
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 PKCS11 attribute data, or NULL if an error occurred. |
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. |
|
Optional cancellation object, or NULL. |
|
Called when the operation completes. |
|
Data to be passed to the callback. |
gpointer gck_object_get_data_finish (GckObject *self
,GAsyncResult *result
,gsize *n_data
,GError **err
);
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 PKCS11 attribute data or NULL if an error occurred. |
"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()
.