Gck.Slot

g GObject.Object GObject.Object Gck.Slot Gck.Slot GObject.Object->Gck.Slot

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

from_handle (module, slot_id)

enumerate_objects (match, options)

equal (slot2)

get_handle ()

get_info ()

get_mechanism_info (mech_type)

get_mechanisms ()

get_module ()

get_token_info ()

has_flags (flags)

hash ()

match (uri)

open_session (options, cancellable)

open_session_async (options, cancellable, callback, *user_data)

open_session_finish (result)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

handle

int

r/w/co

PKCS11 Slot ID

module

Gck.Module

r/w/co

PKCS11 Module

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

reserved

[object]

r

Class Details

class Gck.Slot(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gck.SlotClass

Represents a PKCS#11 slot that can contain a token.

A PKCS#11 slot can contain a token. As an example, a slot might be a card reader, and the token the card. If the PKCS#11 module is not a hardware driver, often the slot and token are equivalent.

classmethod from_handle(module, slot_id)[source]
Parameters:
  • module (Gck.Module) – The module that this slot is on.

  • slot_id (int) – The raw PKCS#11 handle or slot id of this slot.

Returns:

The new Gck.Slot object.

Return type:

Gck.Slot

Create a new Gck.Slot object for a raw PKCS#11 handle.

enumerate_objects(match, options)[source]
Parameters:
Returns:

a new enumerator

Return type:

Gck.Enumerator

Setup an enumerator for listing matching objects on the slot.

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

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

equal(slot2)[source]
Parameters:

slot2 (Gck.Slot) – a pointer to the second Gck.Slot

Returns:

True if slot1 and slot2 are equal. False if either is not a Gck.Slot.

Return type:

bool

Checks equality of two slots. Two Gck.Slot objects can point to the same underlying PKCS#11 slot.

get_handle()[source]
Returns:

the raw CK_SLOT_ID handle

Return type:

int

Get the raw PKCS#11 handle of a slot.

get_info()[source]
Returns:

the slot information, when done, use Gck.SlotInfo.free() to release it.

Return type:

Gck.SlotInfo

Get the information for this slot.

get_mechanism_info(mech_type)[source]
Parameters:

mech_type (int) – The mechanisms type to get info for.

Returns:

the mechanism information, or None if failed; use Gck.MechanismInfo.free() when done with it

Return type:

Gck.MechanismInfo

Get information for the specified mechanism.

get_mechanisms()[source]
Returns:

a list of the mechanisms for this slot, which should be freed with g_array_free ()

Return type:

[int]

Get the available mechanisms for this slot.

get_module()[source]
Returns:

The module, you must unreference this after you’re done with it.

Return type:

Gck.Module

Get the module that this slot is on.

get_token_info()[source]
Returns:

the token information; when done, use Gck.TokenInfo.free() to release it

Return type:

Gck.TokenInfo

Get the token information for this slot.

has_flags(flags)[source]
Parameters:

flags (int) – The flags to check.

Returns:

Whether one or more flags exist.

Return type:

bool

Check if the PKCS11 slot has the given flags.

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.Slot.

This function is intended for easily hashing a Gck.Slot to add to a GLib.HashTable or similar data structure.

match(uri)[source]
Parameters:

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

Returns:

whether the URI matches or not

Return type:

bool

Check whether the PKCS#11 URI matches the slot

open_session(options, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

a new session or None if an error occurs

Return type:

Gck.Session

Open a session on the slot. If the ‘auto reuse’ setting is set, then this may be a recycled session with the same flags.

This call may block for an indefinite period.

open_session_async(options, cancellable, callback, *user_data)[source]
Parameters:

Open a session on the slot. If the ‘auto reuse’ setting is set, then this may be a recycled session with the same flags.

This call will return immediately and complete asynchronously.

open_session_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – The result passed to the callback.

Raises:

GLib.Error

Returns:

the new session or None if an error occurs

Return type:

Gck.Session

Get the result of an open session operation. If the ‘auto reuse’ setting is set, then this may be a recycled session with the same flags.

Property Details

Gck.Slot.props.handle
Name:

handle

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The raw CK_SLOT_ID handle of this slot.

Gck.Slot.props.module
Name:

module

Type:

Gck.Module

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The PKCS11 object that this slot is a part of.