Gck.Session

g GObject.GInterface GObject.GInterface Gio.AsyncInitable Gio.AsyncInitable GObject.GInterface->Gio.AsyncInitable Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object Gck.Session Gck.Session GObject.Object->Gck.Session Gio.AsyncInitable->Gck.Session Gio.Initable->Gck.Session

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.AsyncInitable (4), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

from_handle (slot, session_handle, options)

class

open (slot, options, interaction, cancellable)

class

open_async (slot, options, interaction, cancellable, callback, *user_data)

class

open_finish (result)

create_object (attrs, cancellable)

create_object_async (attrs, cancellable, callback, *user_data)

create_object_finish (result)

decrypt (key, mech_type, input, cancellable)

decrypt_async (key, mechanism, input, cancellable, callback, *user_data)

decrypt_finish (result)

decrypt_full (key, mechanism, input, cancellable)

derive_key (base, mech_type, attrs, cancellable)

derive_key_async (base, mechanism, attrs, cancellable, callback, *user_data)

derive_key_finish (result)

derive_key_full (base, mechanism, attrs, cancellable)

encrypt (key, mech_type, input, cancellable)

encrypt_async (key, mechanism, input, cancellable, callback, *user_data)

encrypt_finish (result)

encrypt_full (key, mechanism, input, cancellable)

enumerate_objects (match)

find_handles (match, cancellable)

find_handles_async (match, cancellable, callback, *user_data)

find_handles_finish (result)

find_objects (match, cancellable)

find_objects_async (match, cancellable, callback, *user_data)

find_objects_finish (result)

generate_key_pair (mech_type, public_attrs, private_attrs, cancellable)

generate_key_pair_async (mechanism, public_attrs, private_attrs, cancellable, callback, *user_data)

generate_key_pair_finish (result)

generate_key_pair_full (mechanism, public_attrs, private_attrs, cancellable)

get_handle ()

get_info ()

get_interaction ()

get_module ()

get_options ()

get_slot ()

get_state ()

init_pin (pin, cancellable)

init_pin_async (pin, cancellable, callback, *user_data)

init_pin_finish (result)

login (user_type, pin, cancellable)

login_async (user_type, pin, cancellable, callback, *user_data)

login_finish (result)

login_interactive (user_type, interaction, cancellable)

login_interactive_async (user_type, interaction, cancellable, callback, *user_data)

login_interactive_finish (result)

logout (cancellable)

logout_async (cancellable, callback, *user_data)

logout_finish (result)

set_interaction (interaction)

set_pin (old_pin, new_pin, cancellable)

set_pin_async (old_pin, n_old_pin, new_pin, cancellable, callback, *user_data)

set_pin_finish (result)

sign (key, mech_type, input, cancellable)

sign_async (key, mechanism, input, cancellable, callback, *user_data)

sign_finish (result)

sign_full (key, mechanism, input, n_result, cancellable)

unwrap_key (wrapper, mech_type, input, attrs, cancellable)

unwrap_key_async (wrapper, mechanism, input, attrs, cancellable, callback, *user_data)

unwrap_key_finish (result)

unwrap_key_full (wrapper, mechanism, input, attrs, cancellable)

verify (key, mech_type, input, signature, cancellable)

verify_async (key, mechanism, input, signature, cancellable, callback, *user_data)

verify_finish (result)

verify_full (key, mechanism, input, signature, cancellable)

wrap_key (wrapper, mech_type, wrapped, cancellable)

wrap_key_async (wrapper, mechanism, wrapped, cancellable, callback, *user_data)

wrap_key_finish (result)

wrap_key_full (wrapper, mechanism, wrapped, cancellable)

Virtual Methods

Inherited:

GObject.Object (7), Gio.AsyncInitable (2), Gio.Initable (1)

Properties

Name

Type

Flags

Short Description

app-data

int

w/co

PKCS#11 application data

handle

int

r/w/co

PKCS11 Session Handle

interaction

Gio.TlsInteraction

r/w

Interaction asking for pins

module

Gck.Module

r

PKCS11 Module

opening-flags

int

w/co

PKCS#11 open session flags

options

Gck.SessionOptions

r/w/co

Session Options

slot

Gck.Slot

r/w/co

PKCS11 Slot

Signals

Inherited:

GObject.Object (1)

Name

Short Description

discard-handle

When a Gck.Session is being disposed of it emits this signal to allow a session pool to pick up the handle and keep it around.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

reserved

[object]

r

Class Details

class Gck.Session(**kwargs)
Bases:

GObject.Object, Gio.AsyncInitable, Gio.Initable

Abstract:

No

Structure:

Gck.SessionClass

Represents an open PKCS11 session.

Before performing any PKCS11 operations, a session must be opened. This is analogous to an open database handle, or a file handle.

classmethod from_handle(slot, session_handle, options)[source]
Parameters:
  • slot (Gck.Slot) – The slot which the session belongs to.

  • session_handle (int) – the raw PKCS#11 handle of the session

  • options (Gck.SessionOptions) – Session options. Those which are used during opening a session have no effect.

Returns:

the new Gck.Session object

Return type:

Gck.Session

Initialize a session object from a raw PKCS#11 session handle. Usually one would use the [method`Slot`.open_session] function to create a session.

classmethod open(slot, options, interaction, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the new session

Return type:

Gck.Session

Open a session on the slot. This call may block for an indefinite period.

classmethod open_async(slot, options, interaction, cancellable, callback, *user_data)[source]
Parameters:

Open a session on the slot. This call will return immediately and complete asynchronously.

classmethod open_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the new session

Return type:

Gck.Session

Get the result of an open session operation.

create_object(attrs, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the newly created object or None if an error occurred

Return type:

Gck.Object

Create a new PKCS#11 object. This call may block for an indefinite period.

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

create_object_async(attrs, cancellable, callback, *user_data)[source]
Parameters:

Create a new PKCS#11 object. This call will return immediately and complete asynchronously.

If attrs is a floating reference, it is consumed.

create_object_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the newly created object or None if an error occurred

Return type:

Gck.Object

Get the result of creating a new PKCS#11 object.

decrypt(key, mech_type, input, cancellable)[source]
Parameters:
  • key (Gck.Object) – The key to decrypt with.

  • mech_type (int) – The mechanism type to use for decryption.

  • input (bytes) – data to decrypt

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

Raises:

GLib.Error

Returns:

the data that was decrypted, or None if an error occured

Return type:

bytes

Decrypt data in a mechanism specific manner. This call may block for an indefinite period.

decrypt_async(key, mechanism, input, cancellable, callback, *user_data)[source]
Parameters:

Decrypt data in a mechanism specific manner. This call will return immediately and complete asynchronously.

decrypt_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the data that was decrypted, or None if an error occurred

Return type:

bytes

Get the result of an decryption operation.

decrypt_full(key, mechanism, input, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the data that was decrypted, or None if an error occured

Return type:

bytes

Decrypt data in a mechanism specific manner. This call may block for an indefinite period.

derive_key(base, mech_type, attrs, cancellable)[source]
Parameters:
  • base (Gck.Object) – The key to derive from.

  • mech_type (int) – The mechanism to use for derivation.

  • attrs (Gck.Attributes) – Additional attributes for the derived key.

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

Raises:

GLib.Error

Returns:

the new derived key or None if the operation failed

Return type:

Gck.Object

Derive a key from another key. This call may block for an indefinite period.

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

derive_key_async(base, mechanism, attrs, cancellable, callback, *user_data)[source]
Parameters:

Derive a key from another key. This call will return immediately and complete asynchronously.

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

derive_key_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the new derived key or None if the operation failed

Return type:

Gck.Object

Get the result of a derive key operation.

derive_key_full(base, mechanism, attrs, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the new derived key or None if the operation failed

Return type:

Gck.Object

Derive a key from another key. This call may block for an indefinite period.

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

encrypt(key, mech_type, input, cancellable)[source]
Parameters:
  • key (Gck.Object) – The key to encrypt with.

  • mech_type (int) – The mechanism type to use for encryption.

  • input (bytes) – the data to encrypt

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

Raises:

GLib.Error

Returns:

the data that was encrypted, or None if an error occured.

Return type:

bytes

Encrypt data in a mechanism specific manner. This call may block for an indefinite period.

encrypt_async(key, mechanism, input, cancellable, callback, *user_data)[source]
Parameters:

Encrypt data in a mechanism specific manner. This call will return immediately and complete asynchronously.

encrypt_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the data that was encrypted, or None if an error occurred.

Return type:

bytes

Get the result of an encryption operation.

encrypt_full(key, mechanism, input, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the data that was encrypted, or None if an error occured

Return type:

bytes

Encrypt data in a mechanism specific manner. This call may block for an indefinite period.

enumerate_objects(match)[source]
Parameters:

match (Gck.Attributes) – attributes that the objects must match, or empty for all objects

Returns:

a new enumerator

Return type:

Gck.Enumerator

Setup an enumerator for listing matching objects available via this session.

If match is a floating reference, it is consumed.

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

find_handles(match, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

a list of the matching objects, which may be empty

Return type:

[int] or None

Find the objects matching the passed attributes. This call may block for an indefinite period.

If match is a floating reference, it is consumed.

find_handles_async(match, cancellable, callback, *user_data)[source]
Parameters:

Find the objects matching the passed attributes. This call will return immediately and complete asynchronously.

If match is a floating reference, it is consumed.

find_handles_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – the asynchronous result

Raises:

GLib.Error

Returns:

an array of handles that matched, which may be empty, or None on failure

Return type:

[int] or None

Get the result of a find handles operation.

find_objects(match, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

a list of the matching objects, which may be empty

Return type:

[Gck.Object]

Find the objects matching the passed attributes. This call may block for an indefinite period.

If match is a floating reference, it is consumed.

find_objects_async(match, cancellable, callback, *user_data)[source]
Parameters:

Find the objects matching the passed attributes. This call will return immediately and complete asynchronously.

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

find_objects_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – The attributes to match.

Raises:

GLib.Error

Returns:

a list of the matching objects, which may be empty

Return type:

[Gck.Object]

Get the result of a find operation.

generate_key_pair(mech_type, public_attrs, private_attrs, cancellable)[source]
Parameters:
  • mech_type (int) – The mechanism type to use for key generation.

  • public_attrs (Gck.Attributes) – Additional attributes for the generated public key.

  • private_attrs (Gck.Attributes) – Additional attributes for the generated private key.

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

Raises:

GLib.Error

Returns:

True if the operation succeeded.

public_key:

location to return the resulting public key

private_key:

location to return the resulting private key.

Return type:

(bool, public_key: Gck.Object, private_key: Gck.Object)

Generate a new key pair of public and private keys. This call may block for an indefinite period.

If public_attrs and/or private_attrs is a floating reference, it is consumed.

generate_key_pair_async(mechanism, public_attrs, private_attrs, cancellable, callback, *user_data)[source]
Parameters:

Generate a new key pair of public and private keys. This call will return immediately and complete asynchronously.

If public_attrs and/or private_attrs is a floating reference, it is consumed.

generate_key_pair_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

True if the operation succeeded.

public_key:

a location to return the resulting public key

private_key:

a location to return the resulting private key

Return type:

(bool, public_key: Gck.Object, private_key: Gck.Object)

Get the result of a generate key pair operation.

generate_key_pair_full(mechanism, public_attrs, private_attrs, cancellable)[source]
Parameters:
  • mechanism (Gck.Mechanism) – The mechanism to use for key generation.

  • public_attrs (Gck.Attributes) – Additional attributes for the generated public key.

  • private_attrs (Gck.Attributes) – Additional attributes for the generated private key.

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

Raises:

GLib.Error

Returns:

True if the operation succeeded.

public_key:

a location to return the resulting public key

private_key:

a location to return the resulting private key

Return type:

(bool, public_key: Gck.Object, private_key: Gck.Object)

Generate a new key pair of public and private keys. This call may block for an indefinite period.

If public_attrs and/or private_attrs is a floating reference, it is consumed.

get_handle()[source]
Returns:

The raw session handle.

Return type:

int

Get the raw PKCS#11 session handle from a session object.

get_info()[source]
Returns:

the session info. Use the Gck.SessionInfo.free() to release when done

Return type:

Gck.SessionInfo

Get information about the session.

get_interaction()[source]
Returns:

the interaction object, or None

Return type:

Gio.TlsInteraction or None

Get the interaction object set on this session, which is used to prompt for pins and the like.

get_module()[source]
Returns:

the module, which should be unreffed after use

Return type:

Gck.Module

Get the PKCS#11 module to which this session belongs.

get_options()[source]
Returns:

The session options.

Return type:

Gck.SessionOptions

Get the options this session was opened with.

get_slot()[source]
Returns:

The slot, which should be unreffed after use.

Return type:

Gck.Slot

Get the PKCS#11 slot to which this session belongs.

get_state()[source]
Returns:

the session state

Return type:

int

Get the session state. The state is the various PKCS#11 CKS_XXX flags.

init_pin(pin, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

Whether successful or not.

Return type:

bool

Initialize the user’s pin on this slot that this session is opened on. According to the PKCS#11 standards, the session must be logged in with the CKU_SO user type.

This call may block for an indefinite period.

init_pin_async(pin, cancellable, callback, *user_data)[source]
Parameters:

Initialize the user’s pin on this slot that this session is opened on. According to the PKCS#11 standards, the session must be logged in with the CKU_SO user type.

This call will return immediately and completes asynchronously.

init_pin_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

Whether the operation was successful or not.

Return type:

bool

Get the result of initializing a user’s PIN.

login(user_type, pin, cancellable)[source]
Parameters:
  • user_type (int) – The type of login user.

  • pin (bytes or None) – the user’s PIN, or None for protected authentication path

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

Raises:

GLib.Error

Returns:

Whether successful or not.

Return type:

bool

Login the user on the session. This call may block for an indefinite period.

login_async(user_type, pin, cancellable, callback, *user_data)[source]
Parameters:

Login the user on the session. This call will return immediately and completes asynchronously.

login_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

Whether the operation was successful or not.

Return type:

bool

Get the result of a login operation.

login_interactive(user_type, interaction, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

Whether successful or not.

Return type:

bool

Login the user on the session requesting the password interactively when necessary. This call may block for an indefinite period.

login_interactive_async(user_type, interaction, cancellable, callback, *user_data)[source]
Parameters:

Login the user on the session prompting for passwords interactively when necessary. This call will return immediately and completes asynchronously.

login_interactive_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

Whether the operation was successful or not.

Return type:

bool

Get the result of a login operation.

logout(cancellable)[source]
Parameters:

cancellable (Gio.Cancellable or None) – Optional cancellation object, or None.

Raises:

GLib.Error

Returns:

Whether the logout was successful or not.

Return type:

bool

Log out of the session. This call may block for an indefinite period.

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

Log out of the session. This call returns immediately and completes asynchronously.

logout_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

Whether the logout was successful or not.

Return type:

bool

Get the result of logging out of a session.

set_interaction(interaction)[source]
Parameters:

interaction (Gio.TlsInteraction or None) – the interaction or None

Set the interaction object on this session, which is used to prompt for pins and the like.

set_pin(old_pin, new_pin, cancellable)[source]
Parameters:
  • old_pin (bytes or None) – the user’s old PIN, or None for protected authentication path.

  • new_pin (bytes or None) – the user’s new PIN, or None for protected authentication path

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

Raises:

GLib.Error

Returns:

Whether successful or not.

Return type:

bool

Change the user’s pin on this slot that this session is opened on.

This call may block for an indefinite period.

set_pin_async(old_pin, n_old_pin, new_pin, cancellable, callback, *user_data)[source]
Parameters:
  • old_pin (bytes or None) – the user’s old PIN, or None for protected authentication path

  • n_old_pin (int) – the length of the old PIN

  • new_pin (bytes or None) – the user’s new PIN, or None for protected authentication path

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

  • callback (Gio.AsyncReadyCallback or None) – Called when the operation completes.

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

Change the user’s pin on this slot that this session is opened on.

This call will return immediately and completes asynchronously.

set_pin_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

Whether the operation was successful or not.

Return type:

bool

Get the result of changing a user’s PIN.

sign(key, mech_type, input, cancellable)[source]
Parameters:
  • key (Gck.Object) – The key to sign with.

  • mech_type (int) – The mechanism type to use for signing.

  • input (bytes) – data to sign

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

Raises:

GLib.Error

Returns:

the data that was signed, or None if an error occured

Return type:

bytes

Sign data in a mechanism specific manner. This call may block for an indefinite period.

sign_async(key, mechanism, input, cancellable, callback, *user_data)[source]
Parameters:

Sign data in a mechanism specific manner. This call will return immediately and complete asynchronously.

sign_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the data that was signed, or None if an error occurred

Return type:

bytes

Get the result of an signing operation.

sign_full(key, mechanism, input, n_result, cancellable)[source]
Parameters:
  • key (Gck.Object) – The key to sign with.

  • mechanism (Gck.Mechanism) – The mechanism type and parameters to use for signing.

  • input (bytes) – data to sign

  • n_result (int) – location to store the length of the result data

  • cancellable (Gio.Cancellable or None) – A Gio.Cancellable which can be used to cancel the operation.

Raises:

GLib.Error

Returns:

The data that was signed, or None if an error occured.

Return type:

int

Sign data in a mechanism specific manner. This call may block for an indefinite period.

unwrap_key(wrapper, mech_type, input, attrs, cancellable)[source]
Parameters:
  • wrapper (Gck.Object) – The key to use for unwrapping.

  • mech_type (int) – The mechanism to use for unwrapping.

  • input (bytes) – the wrapped data as a byte stream

  • attrs (Gck.Attributes) – Additional attributes for the unwrapped key.

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

Raises:

GLib.Error

Returns:

the new unwrapped key or None if the operation failed

Return type:

Gck.Object

Unwrap a key from a byte stream. This call may block for an indefinite period.

If attrs is a floating reference, it is consumed.

unwrap_key_async(wrapper, mechanism, input, attrs, cancellable, callback, *user_data)[source]
Parameters:

Unwrap a key from a byte stream. This call will return immediately and complete asynchronously.

If attrs is a floating reference, it is consumed.

unwrap_key_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the new unwrapped key or None if the operation failed.

Return type:

Gck.Object

Get the result of a unwrap key operation.

unwrap_key_full(wrapper, mechanism, input, attrs, cancellable)[source]
Parameters:
  • wrapper (Gck.Object) – The key to use for unwrapping.

  • mechanism (Gck.Mechanism) – The mechanism to use for unwrapping.

  • input (bytes) – the wrapped data as a byte stream

  • attrs (Gck.Attributes) – Additional attributes for the unwrapped key.

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

Raises:

GLib.Error

Returns:

the new unwrapped key or None if the operation failed

Return type:

Gck.Object

Unwrap a key from a byte stream. This call may block for an indefinite period.

If attrs is a floating reference, it is consumed.

verify(key, mech_type, input, signature, cancellable)[source]
Parameters:
  • key (Gck.Object) – The key to verify with.

  • mech_type (int) – The mechanism type to use for verifying.

  • input (bytes) – data to verify

  • signature (bytes) – the signature

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

Raises:

GLib.Error

Returns:

True if the data verified correctly, otherwise a failure or error occurred.

Return type:

bool

Verify data in a mechanism specific manner. This call may block for an indefinite period.

verify_async(key, mechanism, input, signature, cancellable, callback, *user_data)[source]
Parameters:

Verify data in a mechanism specific manner. This call returns immediately and completes asynchronously.

verify_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

True if the data verified correctly, otherwise a failure or error occurred.

Return type:

bool

Get the result of an verify operation.

verify_full(key, mechanism, input, signature, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

True if the data verified correctly, otherwise a failure or error occurred.

Return type:

bool

Verify data in a mechanism specific manner. This call may block for an indefinite period.

wrap_key(wrapper, mech_type, wrapped, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the wrapped data or None if the operation failed

Return type:

bytes

Wrap a key into a byte stream. This call may block for an indefinite period.

wrap_key_async(wrapper, mechanism, wrapped, cancellable, callback, *user_data)[source]
Parameters:

Wrap a key into a byte stream. This call will return immediately and complete asynchronously.

wrap_key_finish(result)[source]
Parameters:

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

Raises:

GLib.Error

Returns:

the wrapped data or None if the operation failed

Return type:

bytes

Get the result of a wrap key operation.

wrap_key_full(wrapper, mechanism, wrapped, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

the wrapped data or None if the operation failed

Return type:

bytes

Wrap a key into a byte stream. This call may block for an indefinite period.

Signal Details

Gck.Session.signals.discard_handle(session, handle)
Signal Name:

discard-handle

Flags:

RUN_LAST

Parameters:
  • session (Gck.Session) – The object which received the signal

  • handle (int) – The handle being discarded.

Returns:

Whether or not this handle was claimed.

Return type:

bool

When a Gck.Session is being disposed of it emits this signal to allow a session pool to pick up the handle and keep it around.

If no signal handler claims the handle, then it is closed.

Property Details

Gck.Session.props.app_data
Name:

app-data

Type:

int

Default Value:

None

Flags:

WRITABLE, CONSTRUCT_ONLY

Raw PKCS#11 application data used to open the PKCS#11 session.

Gck.Session.props.handle
Name:

handle

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The raw CK_SESSION_HANDLE handle of this session.

Gck.Session.props.interaction
Name:

interaction

Type:

Gio.TlsInteraction

Default Value:

None

Flags:

READABLE, WRITABLE

Interaction object used to ask the user for pins when opening sessions. Used if the session_options of the enumerator have Gck.SessionOptions.LOGIN_USER

Gck.Session.props.module
Name:

module

Type:

Gck.Module

Default Value:

None

Flags:

READABLE

The Gck.Module that this session is opened on.

Gck.Session.props.opening_flags
Name:

opening-flags

Type:

int

Default Value:

0

Flags:

WRITABLE, CONSTRUCT_ONLY

Raw PKCS#11 flags used to open the PKCS#11 session.

Gck.Session.props.options
Name:

options

Type:

Gck.SessionOptions

Default Value:

Gck.SessionOptions.READ_ONLY

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The options this session was opened with.

Gck.Session.props.slot
Name:

slot

Type:

Gck.Slot

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Gck.Slot this session is opened on.