Gck.Module

g GObject.Object GObject.Object Gck.Module Gck.Module GObject.Object->Gck.Module

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

initialize (path, cancellable)

class

initialize_async (path, cancellable, callback, *user_data)

class

initialize_finish (result)

equal (module2)

get_info ()

get_path ()

get_slots (token_present)

hash ()

match (uri)

Virtual Methods

Inherited:

GObject.Object (7)

do_authenticate_object (object, label, password)

do_authenticate_slot (slot, label, password)

Properties

Name

Type

Flags

Short Description

functions

int

r/w/co

PKCS11 Function List

path

str

r/w/co

Path to the PKCS11 Module

Signals

Inherited:

GObject.Object (1)

Name

Short Description

authenticate-object

Use Gck.Session.set_interaction() instead of connecting to this signal. deprecated

authenticate-slot

Use Gck.Session.set_interaction() instead of connecting to this signal. deprecated

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

reserved

[object]

r

Class Details

class Gck.Module(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gck.ModuleClass

Holds a loaded PKCS#11 module. A PKCS#11 module is a shared library.

You can load and initialize a PKCS#11 module with the [func`Module`.initialize] call. If you already have a loaded and initialized module that you’d like to use with the various Gck functions, then you can use [ctor`Module`.new].

classmethod initialize(path, cancellable)[source]
Parameters:
  • path (str) – The file system path to the PKCS#11 module to load.

  • cancellable (Gio.Cancellable or None) – optional cancellation object

Raises:

GLib.Error

Returns:

The loaded PKCS#11 module or None if failed.

Return type:

Gck.Module

Load and initialize a PKCS#11 module represented by a Gck.Module object.

classmethod initialize_async(path, cancellable, callback, *user_data)[source]
Parameters:
  • path (str) – the file system path to the PKCS#11 module to load

  • cancellable (Gio.Cancellable or None) – optional cancellation object

  • callback (Gio.AsyncReadyCallback or None) – a callback which will be called when the operation completes

  • user_data (object or None) – data to pass to the callback

Asynchronously load and initialize a PKCS#11 module represented by a [class`Module`] object.

classmethod initialize_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – the asynchronous result

Raises:

GLib.Error

Returns:

The initialized module, or None

Return type:

Gck.Module or None

Finishes the asynchronous initialize operation.

equal(module2)[source]
Parameters:

module2 (Gck.Module) – a pointer to the second Gck.Module

Returns:

True if module1 and module2 are equal. False if either is not a Gck.Module.

Return type:

bool

Checks equality of two modules. Two Gck.Module objects can point to the same underlying PKCS#11 module.

get_info()[source]
Returns:

the module info; release this with Gck.ModuleInfo.free()

Return type:

Gck.ModuleInfo

Get the info about a PKCS#11 module.

get_path()[source]
Returns:

The path, do not modify or free this value.

Return type:

str

Get the file path of this module. This may not be an absolute path, and usually reflects the path passed to [func`Module`.initialize].

get_slots(token_present)[source]
Parameters:

token_present (bool) – Whether to limit only to slots with a token present.

Returns:

The possibly empty list of slots. Release this with gck_list_unref_free().

Return type:

[Gck.Slot]

Get the Gck.Slot objects for a given module.

hash()[source]
Returns:

An integer that can be used as a hash value, or 0 if invalid.

Return type:

int

Create a hash value for the Gck.Module.

This function is intended for easily hashing a [class`Module`] to add to a [struct`GLib`.HashTable] or similar data structure.

match(uri)[source]
Parameters:

uri (Gck.UriData) – the uri to match against the module

Returns:

whether the URI matches or not

Return type:

bool

Check whether the PKCS#11 URI matches the module

do_authenticate_object(object, label, password) virtual
Parameters:
Return type:

bool

do_authenticate_slot(slot, label, password) virtual
Parameters:
Return type:

bool

Signal Details

Gck.Module.signals.authenticate_object(module, object, label, password)
Signal Name:

authenticate-object

Flags:

RUN_LAST

Parameters:
  • module (Gck.Module) – The object which received the signal

  • object (Gck.Object) – The object to be authenticated.

  • label (str) – A displayable label which describes the object.

  • password (object or None) – A str where a password should be returned.

Return type:

bool

Use Gck.Session.set_interaction() instead of connecting to this signal.

Deprecated since version 3.4.

Gck.Module.signals.authenticate_slot(module, slot, string, password)
Signal Name:

authenticate-slot

Flags:

RUN_LAST

Parameters:
  • module (Gck.Module) – The object which received the signal

  • slot (Gck.Slot) – The slot to be authenticated.

  • string (str) – A displayable label which describes the object.

  • password (object or None) – A str where a password should be returned.

Return type:

bool

Use Gck.Session.set_interaction() instead of connecting to this signal.

Deprecated since version 3.4.

Property Details

Gck.Module.props.functions
Name:

functions

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The raw PKCS#11 function list for the module.

This points to a CK_FUNCTION_LIST structure.

Gck.Module.props.path
Name:

path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The PKCS#11 module file path.

This may be set to None if this object was created from an already initialized module via the gck_module_new() function.