Gck.Object¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
PKCS11 Object Handle |
||
r/w/co |
PKCS11 Module |
||
r/w/co |
PKCS11 Session to make calls on |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gck.Object(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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.
- classmethod from_handle(session, object_handle)[source]¶
- Parameters:
session (
Gck.Session) – The session through which this object is accessed or created.object_handle (
int) – The rawCK_OBJECT_HANDLEof the object.
- Returns:
The new object
- Return type:
Initialize a
Gck.Objectfrom a raw PKCS#11 handle. Normally you would use [method`Session`.create_object] or [method`Session`.find_objects] to access objects.
- cache_lookup(attr_types, cancellable)[source]¶
- Parameters:
attr_types ([
int]) – the types of attributes to updatecancellable (
Gio.CancellableorNone) – optional cancellation object
- Raises:
- Returns:
the attributes retrieved or
Noneon failure- Return type:
Lookup attributes in the cache, or retrieve them from the object if necessary.
If self is a
Gck.ObjectCachethen this will lookup the attributes there first if available, otherwise will read them from the object and update the cache.If self is not a
Gck.ObjectCache, then the attributes will simply be read from the object.This may block, use the asynchronous version when this is not desirable
- cache_lookup_async(attr_types, cancellable, callback, *user_data)[source]¶
- Parameters:
attr_types ([
int]) – the types of attributes to updatecancellable (
Gio.CancellableorNone) – optional cancellation objectcallback (
Gio.AsyncReadyCallbackorNone) – called when the operation completes
Lookup attributes in the cache, or retrieve them from the object if necessary.
If self is a
Gck.ObjectCachethen this will lookup the attributes there first if available, otherwise will read them from the object and update the cache.If self is not a
Gck.ObjectCache, then the attributes will simply be read from the object.This will return immediately and complete asynchronously
- cache_lookup_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – the asynchrounous result passed to the callback- Raises:
- Returns:
the attributes retrieved or
Noneon failure- Return type:
Complete an operation to lookup attributes in the cache or retrieve them from the object if necessary.
- destroy(cancellable)[source]¶
- Parameters:
cancellable (
Gio.CancellableorNone) – Optional cancellable object, orNoneto ignore.- Raises:
- Returns:
Whether the call was successful or not.
- Return type:
Destroy a PKCS#11 object, deleting it from storage or the session. This call may block for an indefinite period.
- destroy_async(cancellable, callback, *user_data)[source]¶
- Parameters:
cancellable (
Gio.CancellableorNone) – Optional cancellable object, orNoneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – Callback which is called when operation completes.
Destroy a PKCS#11 object, deleting it from storage or the session. This call will return immediately and complete asynchronously.
- destroy_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – The result of the destory operation passed to the callback.- Raises:
- Returns:
Whether the object was destroyed successfully or not.
- Return type:
Get the status of the operation to destroy a PKCS#11 object, begun with
Gck.Object.destroy_async().
- equal(object2)[source]¶
- Parameters:
object2 (
Gck.Object) – a pointer to the secondGck.Object- Returns:
Trueif object1 and object2 are equal.Falseif either is not aGck.Object.- Return type:
Checks equality of two objects. Two
Gck.Objectobjects can point to the same underlying PKCS#11 object.
- get_async(attr_types, cancellable, callback, *user_data)[source]¶
- Parameters:
attr_types ([
int]) – the types of the attributes to getcancellable (
Gio.CancellableorNone) – optional cancellation object, orNonecallback (
Gio.AsyncReadyCallbackorNone) – A callback which is called when the operation completes.user_data (
objectorNone) – Data to be passed to the callback.
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.
- get_data(attr_type, cancellable)[source]¶
- Parameters:
attr_type (
int) – The attribute to get data for.cancellable (
Gio.CancellableorNone) – AGio.CancellableorNone
- Raises:
- Returns:
the resulting PKCS#11 attribute data, or
Noneif an error occurred- Return type:
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.
- get_data_async(attr_type, allocator, cancellable, callback, *user_data)[source]¶
- Parameters:
attr_type (
int) – The attribute to get data for.allocator (
Gck.Allocator) – An allocator with which to allocate memory for the data, orNonefor default.cancellable (
Gio.CancellableorNone) – Optional cancellation object, orNone.callback (
Gio.AsyncReadyCallbackorNone) – Called when the operation completes.user_data (
objectorNone) – Data to be passed to the callback.
Get the data for the specified attribute from the object.
This call will return immediately and complete asynchronously.
- get_data_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – The result passed to the callback.- Raises:
- Returns:
The PKCS#11 attribute data or
Noneif an error occurred.- Return type:
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.
- get_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – The result passed to the callback.- Raises:
- Returns:
The filled in attributes structure if successful or
Noneif not successful.- Return type:
Get the result of a get operation and return specified attributes from the object.
No extra references are added to the returned attributes pointer.
- get_full(attr_types, cancellable)[source]¶
- Parameters:
attr_types ([
int]) – the types of the attributes to getcancellable (
Gio.CancellableorNone) – optional cancellation object, orNone
- Raises:
- Returns:
a pointer to the filled in attributes if successful, or
Noneif not- Return type:
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.
- get_handle()[source]¶
- Returns:
the raw CK_OBJECT_HANDLE object handle
- Return type:
Get the raw PKCS#11 handle of a
Gck.Object.
- get_module()[source]¶
- Returns:
the module, which should be unreffed after use
- Return type:
Get the PKCS#11 module to which this object belongs.
- get_session()[source]¶
- Returns:
the assigned session, which must be unreffed after use
- Return type:
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.
- get_template(attr_type, cancellable)[source]¶
- Parameters:
attr_type (
int) – The template attribute type.cancellable (
Gio.CancellableorNone) – Optional cancellation object, orNone.
- Raises:
- Returns:
the resulting PKCS#11 attribute template, or
Noneif an error occurred- Return type:
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.
- get_template_async(attr_type, cancellable, callback, *user_data)[source]¶
- Parameters:
attr_type (
int) – The template attribute type.cancellable (
Gio.CancellableorNone) – Optional cancellation object, orNone.callback (
Gio.AsyncReadyCallbackorNone) – Called when the operation completes.user_data (
objectorNone) – Data to be passed to the callback.
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.
- get_template_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – The result passed to the callback.- Raises:
- Returns:
the resulting PKCS#11 attribute template, or
Noneif an error occurred- Return type:
Get the result of an operation to get attribute template from an object.
- hash()[source]¶
- Returns:
An integer that can be used as a hash value, or 0 if invalid.
- Return type:
Create a hash value for the
Gck.Object.This function is intended for easily hashing a
Gck.Objectto add to aGLib.HashTableor similar data structure.
- set(attrs, cancellable)[source]¶
- Parameters:
attrs (
Gck.Attributes) – The attributes to set on the object.cancellable (
Gio.CancellableorNone) – Optional cancellable object, orNoneto ignore.
- Raises:
- Returns:
Whether the call was successful or not.
- Return type:
Set PKCS#11 attributes on an object. This call may block for an indefinite period.
- set_async(attrs, cancellable, callback, *user_data)[source]¶
- Parameters:
attrs (
Gck.Attributes) – The attributes to set on the object.cancellable (
Gio.CancellableorNone) – Optional cancellable object, orNoneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – Callback which is called when operation completes.
Set PKCS#11 attributes on an object. This call will return immediately and completes asynchronously.
- set_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – The result of the destory operation passed to the callback.- Raises:
- Returns:
Whether the attributes were successfully set on the object or not.
- Return type:
Get the status of the operation to set attributes on a PKCS#11 object, begun with
Gck.Object.set_async().
- set_template(attr_type, attrs, cancellable)[source]¶
- Parameters:
attr_type (
int) – The attribute template type.attrs (
Gck.Attributes) – The attribute template.cancellable (
Gio.CancellableorNone) – Optional cancellation object, orNone.
- Raises:
- Returns:
Trueif the operation succeeded.- Return type:
Set an attribute template on the object. The attr_type must be for an attribute which contains a template.
If the attrs
Gck.Attributesis floating, it is consumed.This call may block for an indefinite period.
- set_template_async(attr_type, attrs, cancellable, callback, *user_data)[source]¶
- Parameters:
attr_type (
int) – The attribute template type.attrs (
Gck.Attributes) – The attribute template.cancellable (
Gio.CancellableorNone) – Optional cancellation object, orNone.callback (
Gio.AsyncReadyCallbackorNone) – Called when the operation completes.user_data (
objectorNone) – Data to be passed to the callback.
Set an attribute template on the object. The attr_type must be for an attribute which contains a template.
If the attrs
Gck.Attributesis floating, it is consumed.This call will return immediately and complete asynchronously.
- set_template_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – The result passed to the callback.- Raises:
- Returns:
Trueif the operation succeeded.- Return type:
Get the result of an operation to set attribute template on an object.
Property Details¶
- Gck.Object.props.handle¶
- Name:
handle- Type:
- Default Value:
0- Flags:
The raw PKCS11 handle for this object.
- Gck.Object.props.module¶
- Name:
module- Type:
- Default Value:
- Flags:
The
Gck.Modulethat this object belongs to.
- Gck.Object.props.session¶
- Name:
session- Type:
- Default Value:
- Flags:
The PKCS11 session to make calls on when this object needs to perform operations on itself.
If this is
Nonethen a new session is opened for each operation, such as gck_object_get(),Gck.Object.set() orGck.Object.destroy().