Functions

  builder_unref (builder)
  error_get_quark ()
  list_get_boxed_type ()
  message_from_rv (rv)
  modules_enumerate_objects (modules, attrs, session_options)
  modules_enumerate_uri (modules, uri, session_options)
  modules_get_slots (modules, token_present)
  modules_initialize_registered (cancellable)
  modules_initialize_registered_async (cancellable, callback, *user_data)
  modules_initialize_registered_finish (result)
  modules_object_for_uri (modules, uri, session_options)
  modules_objects_for_uri (modules, uri, session_options)
  modules_token_for_uri (modules, uri)
  modules_tokens_for_uri (modules, uri)
  objects_from_handle_array (session, object_handles)
  slots_enumerate_objects (slots, match, options)
  uri_build (uri_data, flags)
  uri_error_get_quark ()
  uri_parse (string, flags)
  value_to_boolean (value, result)
  value_to_ulong (value, result)

Details

Gck.builder_unref(builder)[source]
Parameters:builder (object or None) – the builder

Unreferences a builder. If this was the last reference then the builder is freed.

It is an error to use this function on builders that were allocated on the stack.

Gck.error_get_quark()[source]
Return type:int
Gck.list_get_boxed_type()[source]
Return type:GObject.GType
Gck.message_from_rv(rv)[source]
Parameters:rv (int) – The PKCS\#11 return value to get a message for.
Returns:The user readable message.
Return type:str

Get a message for a PKCS\#11 return value or error code. Do not pass CKR_OK or other such non errors to this function.

Gck.modules_enumerate_objects(modules, attrs, session_options)[source]
Parameters:
Returns:

A new enumerator, which should be released with GObject.Object.unref().

Return type:

Gck.Enumerator

Setup an enumerator for listing matching objects on the modules.

This call will not block but will return an enumerator immediately.

If the attrs Gck.Attributes is floating, it is consumed.

Gck.modules_enumerate_uri(modules, uri, session_options)[source]
Parameters:
Raises:

GLib.Error

Returns:

A new Gck.Enumerator, or None if an error occurs.

Return type:

Gck.Enumerator

Enumerate objects that match a URI.

This call will not block. Use the Gck.Enumerator functions in order to get at the actual objects that match.

Gck.modules_get_slots(modules, token_present)[source]
Parameters:
  • modules ([Gck.Module]) – The modules
  • token_present (bool) – Whether to only list slots with token present
Returns:

A list of Gck.Slot objects, which should be freed with gck_list_unref_free().

Return type:

[Gck.Slot]

Get a list of slots for across all of the modules.

Gck.modules_initialize_registered(cancellable)[source]
Parameters:cancellable (Gio.Cancellable or None) – optional cancellation object
Raises:GLib.Error
Returns:A newly allocated list of Gck.Module objects, which should be released with gck_list_unref_free().
Return type:[Gck.Module]

Load and initialize all the registered modules.

Gck.modules_initialize_registered_async(cancellable, callback, *user_data)[source]
Parameters:

Load and initialize all the registered modules asynchronously.

Gck.modules_initialize_registered_finish(result)[source]
Parameters:result (Gio.AsyncResult) – the asynchronous result
Raises:GLib.Error
Returns:a list of newly initialized Gck.Module objects
Return type:[Gck.Module]

Finishes the asynchronous operation to initialize the registered PKCS\#11 modules.

Gck.modules_object_for_uri(modules, uri, session_options)[source]
Parameters:
Raises:

GLib.Error

Returns:

A new Gck.Object which should be released with GObject.Object.unref(), or None if no matching object was found.

Return type:

Gck.Object or None

Find an object that matches a URI.

This call can block. Use Gck.modules_enumerate_uri() for a non-blocking version.

Gck.modules_objects_for_uri(modules, uri, session_options)[source]
Parameters:
Raises:

GLib.Error

Returns:

A list of Gck.Object which should be released with gck_list_unref_free(), or None if no matching object was found.

Return type:

[Gck.Object]

Find objects that match a URI.

This call can block. Use Gck.modules_enumerate_uri() for a non-blocking version.

Gck.modules_token_for_uri(modules, uri)[source]
Parameters:
  • modules ([Gck.Module]) – The modules
  • uri (str) – The URI that the token must match
Raises:

GLib.Error

Returns:

A newly allocated Gck.Slot or None if no such token was found.

Return type:

Gck.Slot

Lookup a token that matches the URI.

Gck.modules_tokens_for_uri(modules, uri)[source]
Parameters:
  • modules ([Gck.Module]) – The modules
  • uri (str) – The URI that the token must match
Raises:

GLib.Error

Returns:

A list of newly allocated Gck.Slot objects. Use gck_list_unref_free() to release the list once you’re done with it.

Return type:

[Gck.Slot]

Lookup a token that matches the URI.

Gck.objects_from_handle_array(session, object_handles)[source]
Parameters:
  • session (Gck.Session) – The session for these objects
  • object_handles ([int]) – The raw object handles.
Returns:

The list of Gck.Object objects. You should use gck_list_unref_free() when done with this list.

Return type:

[Gck.Object]

Initialize a list of Gck.Object from raw PKCS\#11 handles. The handles argument must contain contiguous CK_OBJECT_HANDLE handles in an array.

Gck.slots_enumerate_objects(slots, match, options)[source]
Parameters:
Returns:

a new enumerator

Return type:

Gck.Enumerator

Setup an enumerator for listing matching objects on the slots.

If the match Gck.Attributes is floating, it is consumed.

This call will not block but will return an enumerator immediately.

Gck.uri_build(uri_data, flags)[source]
Parameters:
  • uri_data (Gck.UriData) – the info to build the URI from.
  • flags (Gck.UriFlags) – The context that the URI is for
Returns:

a newly allocated string containing a PKCS\#11 URI.

Return type:

str

Build a PKCS\#11 URI. The various parts relevant to the flags specified will be used to build the URI.

Gck.uri_error_get_quark()[source]
Return type:int
Gck.uri_parse(string, flags)[source]
Parameters:
  • string (str) – the URI to parse.
  • flags (Gck.UriFlags) – the context in which the URI will be used.
Raises:

GLib.Error

Returns:

a newly allocated Gck.UriData; which should be freed with Gck.UriData.free()

Return type:

Gck.UriData

Parse a PKCS\#11 URI for use in a given context.

The result will contain the fields that are relevant for the given context. See Gck.UriData for more info. Other fields will be set to None.

Gck.value_to_boolean(value, result)[source]
Parameters:
  • value (bytes) – memory to convert
  • result (bool) – A location to store the result
Returns:

Whether the conversion was successful.

Return type:

bool

Convert CK_BBOOL type memory to a boolean.

Gck.value_to_ulong(value, result)[source]
Parameters:
  • value (bytes) – memory to convert
  • result (int) – A location to store the result
Returns:

Whether the conversion was successful.

Return type:

bool

Convert CK_ULONG type memory to a boolean.