Gck.Session¶
- Subclasses:
- None 
Methods¶
- Inherited:
- GObject.Object (37), Gio.AsyncInitable (4), Gio.Initable (2) 
- Structs:
| class | 
 | 
| class | 
 | 
| class | 
 | 
| class | 
 | 
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | 
Virtual Methods¶
- Inherited:
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| w/co | PKCS#11 application data | ||
| r/w/co | PKCS11 Session Handle | ||
| r/w | Interaction asking for pins | ||
| r | PKCS11 Module | ||
| w/co | PKCS#11 open session flags | ||
| r/w/co | Session Options | ||
| r/w/co | PKCS11 Slot | 
Signals¶
- Inherited:
| Name | Short Description | 
|---|---|
| When a  | 
Fields¶
- Inherited:
| Name | Type | Access | Description | 
|---|---|---|---|
| parent | r | ||
| reserved | [ | r | 
Class Details¶
- class Gck.Session(**kwargs)¶
- Bases:
- Abstract:
- No 
- Structure:
 - 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.Sessionobject
- Return type:
 - 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:
- slot ( - Gck.Slot) – the slot to open session on
- options ( - Gck.SessionOptions) – session options
- interaction ( - Gio.TlsInteractionor- None) – optional interaction for logins or object authentication
- cancellable ( - Gio.Cancellableor- None) – optional cancellation object
 
- Raises:
- Returns:
- the new session 
- Return type:
 - 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:
- slot ( - Gck.Slot) – the slot to open session on
- options ( - Gck.SessionOptions) – session options
- interaction ( - Gio.TlsInteractionor- None) – optional interaction for logins or object authentication
- cancellable ( - Gio.Cancellableor- None) – optional cancellation object
- callback ( - Gio.AsyncReadyCallbackor- None) – called when the operation completes
 
 - 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:
- Returns:
- the new session 
- Return type:
 - Get the result of an open session operation. 
 - create_object(attrs, cancellable)[source]¶
- Parameters:
- attrs ( - Gck.Attributes) – The attributes to create the object with.
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- the newly created object or - Noneif an error occurred
- Return type:
 - Create a new PKCS#11 object. This call may block for an indefinite period. - If the attrs - Gck.Attributesis floating, it is consumed.
 - create_object_async(attrs, cancellable, callback, *user_data)[source]¶
- Parameters:
- attrs ( - Gck.Attributes) – The attributes to create the object with.
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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:
- Returns:
- the newly created object or - Noneif an error occurred
- Return type:
 - 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.Cancellableor- None) – Optional cancellation object, or- None
 
- Raises:
- Returns:
- the data that was decrypted, or - Noneif an error occured
- Return type:
 - 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:
- key ( - Gck.Object) – The key to decrypt with.
- mechanism ( - Gck.Mechanism) – The mechanism type and parameters to use for decryption.
- input ( - bytes) – data to decrypt
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
- user_data ( - objector- None) – A pointer to pass to the callback.
 
 - 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:
- Returns:
- the data that was decrypted, or - Noneif an error occurred
- Return type:
 - Get the result of an decryption operation. 
 - decrypt_full(key, mechanism, input, cancellable)[source]¶
- Parameters:
- key ( - Gck.Object) – The key to decrypt with.
- mechanism ( - Gck.Mechanism) – The mechanism type and parameters to use for decryption.
- input ( - bytes) – data to decrypt
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
 
- Raises:
- Returns:
- the data that was decrypted, or - Noneif an error occured
- Return type:
 - 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.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- the new derived key or - Noneif the operation failed
- Return type:
 - Derive a key from another key. This call may block for an indefinite period. - If the attrs - Gck.Attributesis floating, it is consumed.
 - derive_key_async(base, mechanism, attrs, cancellable, callback, *user_data)[source]¶
- Parameters:
- base ( - Gck.Object) – The key to derive from.
- mechanism ( - Gck.Mechanism) – The mechanism to use for derivation.
- attrs ( - Gck.Attributes) – Additional attributes for the derived key.
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - Derive a key from another key. This call will return immediately and complete asynchronously. - If the attrs - Gck.Attributesis floating, it is consumed.
 - derive_key_finish(result)[source]¶
- Parameters:
- result ( - Gio.AsyncResult) – The async result passed to the callback.
- Raises:
- Returns:
- the new derived key or - Noneif the operation failed
- Return type:
 - Get the result of a derive key operation. 
 - derive_key_full(base, mechanism, attrs, cancellable)[source]¶
- Parameters:
- base ( - Gck.Object) – The key to derive from.
- mechanism ( - Gck.Mechanism) – The mechanism to use for derivation.
- attrs ( - Gck.Attributes) – Additional attributes for the derived key.
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- the new derived key or - Noneif the operation failed
- Return type:
 - Derive a key from another key. This call may block for an indefinite period. - If the attrs - Gck.Attributesis 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.Cancellableor- None) – Optional cancellation object, or- None
 
- Raises:
- Returns:
- the data that was encrypted, or - Noneif an error occured.
- Return type:
 - 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:
- key ( - Gck.Object) – The key to encrypt with.
- mechanism ( - Gck.Mechanism) – The mechanism type and parameters to use for encryption.
- input ( - bytes) – the data to encrypt
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
- user_data ( - objector- None) – A pointer to pass to the callback.
 
 - 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:
- Returns:
- the data that was encrypted, or - Noneif an error occurred.
- Return type:
 - Get the result of an encryption operation. 
 - encrypt_full(key, mechanism, input, cancellable)[source]¶
- Parameters:
- key ( - Gck.Object) – The key to encrypt with.
- mechanism ( - Gck.Mechanism) – The mechanism type and parameters to use for encryption.
- input ( - bytes) – the data to encrypt
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
 
- Raises:
- Returns:
- the data that was encrypted, or - Noneif an error occured
- Return type:
 - 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:
 - 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:
- match ( - Gck.Attributes) – the attributes to match against objects
- cancellable ( - Gio.Cancellableor- None) – optional cancellation object or- None
 
- Raises:
- Returns:
- a list of the matching objects, which may be empty 
- Return type:
 - 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:
- match ( - Gck.Attributes) – the attributes to match against the objects
- cancellable ( - Gio.Cancellableor- None) – optional cancellation object or- None
- callback ( - Gio.AsyncReadyCallbackor- None) – called when the operation completes
 
 - 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:
- Returns:
- an array of handles that matched, which may be empty, or - Noneon failure
- Return type:
 - Get the result of a find handles operation. 
 - find_objects(match, cancellable)[source]¶
- Parameters:
- match ( - Gck.Attributes) – the attributes to match
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object or- None.
 
- Raises:
- Returns:
- a list of the matching objects, which may be empty 
- Return type:
 - 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:
- match ( - Gck.Attributes) – The attributes to match.
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - Find the objects matching the passed attributes. This call will return immediately and complete asynchronously. - If the match - Gck.Attributesis floating, it is consumed.
 - find_objects_finish(result)[source]¶
- Parameters:
- result ( - Gio.AsyncResult) – The attributes to match.
- Raises:
- Returns:
- a list of the matching objects, which may be empty 
- Return type:
 - 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.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- Trueif 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:
- 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.Cancellableor- None) – Optional cancellation object or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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:
- Returns:
- Trueif 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.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- Trueif 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:
 - 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:
 - Get information about the session. 
 - get_interaction()[source]¶
- Returns:
- the interaction object, or - None
- Return type:
 - 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:
 - Get the PKCS#11 module to which this session belongs. 
 - get_options()[source]¶
- Returns:
- The session options. 
- Return type:
 - Get the options this session was opened with. 
 - get_slot()[source]¶
- Returns:
- The slot, which should be unreffed after use. 
- Return type:
 - Get the PKCS#11 slot to which this session belongs. 
 - get_state()[source]¶
- Returns:
- the session state 
- Return type:
 - Get the session state. The state is the various PKCS#11 CKS_XXX flags. 
 - init_pin(pin, cancellable)[source]¶
- Parameters:
- Raises:
- Returns:
- Whether successful or not. 
- Return type:
 - 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:
- pin ( - bytesor- None) – the user’s PIN, or- Nonefor protected authentication path
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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_SOuser 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:
- Returns:
- Whether the operation was successful or not. 
- Return type:
 - Get the result of initializing a user’s PIN. 
 - login(user_type, pin, cancellable)[source]¶
- Parameters:
- Raises:
- Returns:
- Whether successful or not. 
- Return type:
 - 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:
- user_type ( - int) – The type of login user.
- pin ( - bytesor- None) – the user’s PIN, or- Nonefor protected authentication path
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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:
- Returns:
- Whether the operation was successful or not. 
- Return type:
 - Get the result of a login operation. 
 - login_interactive(user_type, interaction, cancellable)[source]¶
- Parameters:
- user_type ( - int) – the type of login user
- interaction ( - Gio.TlsInteractionor- None) – interaction to request PIN when necessary
- cancellable ( - Gio.Cancellableor- None) – optional cancellation object, or- None
 
- Raises:
- Returns:
- Whether successful or not. 
- Return type:
 - 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:
- user_type ( - int) – the type of login user
- interaction ( - Gio.TlsInteractionor- None) – interaction to request PIN when necessary
- cancellable ( - Gio.Cancellableor- None) – optional cancellation object, or- None
- callback ( - Gio.AsyncReadyCallbackor- None) – called when the operation completes
 
 - 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:
- Returns:
- Whether the operation was successful or not. 
- Return type:
 - Get the result of a login operation. 
 - logout(cancellable)[source]¶
- Parameters:
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
- Raises:
- Returns:
- Whether the logout was successful or not. 
- Return type:
 - Log out of the session. This call may block for an indefinite period. 
 - logout_async(cancellable, callback, *user_data)[source]¶
- Parameters:
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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:
- Returns:
- Whether the logout was successful or not. 
- Return type:
 - Get the result of logging out of a session. 
 - set_interaction(interaction)[source]¶
- Parameters:
- interaction ( - Gio.TlsInteractionor- 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:
- Raises:
- Returns:
- Whether successful or not. 
- Return type:
 - 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 ( - bytesor- None) – the user’s old PIN, or- Nonefor protected authentication path
- n_old_pin ( - int) – the length of the old PIN
- new_pin ( - bytesor- None) – the user’s new PIN, or- Nonefor protected authentication path
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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:
- Returns:
- Whether the operation was successful or not. 
- Return type:
 - 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.Cancellableor- None) – Optional cancellation object, or- None
 
- Raises:
- Returns:
- the data that was signed, or - Noneif an error occured
- Return type:
 - 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:
- 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
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
- user_data ( - objector- None) – A pointer to pass to the callback.
 
 - 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:
- Returns:
- the data that was signed, or - Noneif an error occurred
- Return type:
 - 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.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
 
- Raises:
- Returns:
- The data that was signed, or - Noneif an error occured.
- Return type:
 - 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.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- the new unwrapped key or - Noneif the operation failed
- Return type:
 - 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:
- 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.Cancellableor- None) – Optional cancellation object or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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:
- Returns:
- the new unwrapped key or - Noneif the operation failed.
- Return type:
 - 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.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- the new unwrapped key or - Noneif the operation failed
- Return type:
 - 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.Cancellableor- None) – Optional cancellation object, or- None
 
- Raises:
- Returns:
- Trueif the data verified correctly, otherwise a failure or error occurred.
- Return type:
 - 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:
- key ( - Gck.Object) – The key to verify with.
- mechanism ( - Gck.Mechanism) – The mechanism type and parameters to use for signing.
- input ( - bytes) – data to verify
- signature ( - bytes) – the signature
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
- user_data ( - objector- None) – A pointer to pass to the callback.
 
 - 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:
- Returns:
- Trueif the data verified correctly, otherwise a failure or error occurred.
- Return type:
 - Get the result of an verify operation. 
 - verify_full(key, mechanism, input, signature, cancellable)[source]¶
- Parameters:
- key ( - Gck.Object) – The key to verify with.
- mechanism ( - Gck.Mechanism) – The mechanism type and parameters to use for signing.
- input ( - bytes) – data to verify
- signature ( - bytes) – the signature
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellablewhich can be used to cancel the operation.
 
- Raises:
- Returns:
- Trueif the data verified correctly, otherwise a failure or error occurred.
- Return type:
 - Verify data in a mechanism specific manner. This call may block for an indefinite period. 
 - wrap_key(wrapper, mech_type, wrapped, cancellable)[source]¶
- Parameters:
- wrapper ( - Gck.Object) – The key to use for wrapping.
- mech_type ( - int) – The mechanism type to use for wrapping.
- wrapped ( - Gck.Object) – The key to wrap.
- cancellable ( - Gio.Cancellableor- None) – A- Gio.Cancellableor- None
 
- Raises:
- Returns:
- the wrapped data or - Noneif the operation failed
- Return type:
 - 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:
- wrapper ( - Gck.Object) – The key to use for wrapping.
- mechanism ( - Gck.Mechanism) – The mechanism to use for wrapping.
- wrapped ( - Gck.Object) – The key to wrap.
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object or- None.
- callback ( - Gio.AsyncReadyCallbackor- None) – Called when the operation completes.
 
 - 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:
- Returns:
- the wrapped data or - Noneif the operation failed
- Return type:
 - Get the result of a wrap key operation. 
 - wrap_key_full(wrapper, mechanism, wrapped, cancellable)[source]¶
- Parameters:
- wrapper ( - Gck.Object) – The key to use for wrapping.
- mechanism ( - Gck.Mechanism) – The mechanism to use for wrapping.
- wrapped ( - Gck.Object) – The key to wrap.
- cancellable ( - Gio.Cancellableor- None) – Optional cancellation object, or- None.
 
- Raises:
- Returns:
- the wrapped data or - Noneif the operation failed
- Return type:
 - 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:
- 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:
 - When a - Gck.Sessionis 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:
- Default Value:
- Flags:
 - Raw PKCS#11 application data used to open the PKCS#11 session. 
- Gck.Session.props.handle¶
- Name:
- handle
- Type:
- Default Value:
- 0
- Flags:
 - The raw CK_SESSION_HANDLE handle of this session. 
- Gck.Session.props.interaction¶
- Name:
- interaction
- Type:
- Default Value:
- Flags:
 - 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:
- Default Value:
- Flags:
 - The - Gck.Modulethat this session is opened on.
- Gck.Session.props.opening_flags¶
- Name:
- opening-flags
- Type:
- Default Value:
- 0
- Flags:
 - Raw PKCS#11 flags used to open the PKCS#11 session. 
- Gck.Session.props.options¶
- Name:
- options
- Type:
- Default Value:
- Flags:
 - The options this session was opened with.