Session
Object Hierarchy:
Description:
[ CCode ( type_id = "gck_session_get_type ()" ) ]
public class Session : Object, AsyncInitable, Initable
public class Session : Object, AsyncInitable, Initable
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.
Namespace: Gck
Package: gck-2
Content:
Properties:
- public void* app_data { construct; }
Raw PKCS#11 application data used to open the PKCS#11 session.
- public ulong handle { get; construct; }
The raw CK_SESSION_HANDLE handle of this session.
- public TlsInteraction interaction { owned get; set; }
Interaction object used to ask the user for pins when opening sessions.
- public Module module { owned get; }
The GckModule that this session is opened on.
- public ulong opening_flags { construct; }
Raw PKCS#11 flags used to open the PKCS#11 session.
- public SessionOptions options { get; construct; }
The options this session was opened with.
- public Slot slot { owned get; construct; }
The GckSlot this session is opened on.
Static methods:
- public static Session from_handle (Slot slot, ulong session_handle, SessionOptions options)
Initialize a session object from a raw PKCS#11 session handle.
- public static Session open (Slot slot, SessionOptions options, TlsInteraction? interaction, Cancellable? cancellable = null) throws Error
Open a session on the slot.
- public static async Session open_async (Slot slot, SessionOptions options, TlsInteraction? interaction, Cancellable? cancellable) throws Error
Open a session on the slot.
Creation methods:
- protected Session ()
Methods:
- public Object create_object (Attributes attrs, Cancellable? cancellable = null) throws Error
Create a new PKCS#11 object.
- public async Object create_object_async (Attributes attrs, Cancellable? cancellable) throws Error
Create a new PKCS#11 object.
- public uint8[] decrypt (Object key, ulong mech_type, uint8[] input, Cancellable? cancellable = null) throws Error
Decrypt data in a mechanism specific manner.
- public async uint8[] decrypt_async (Object key, Mechanism mechanism, uint8[] input, Cancellable? cancellable) throws Error
Decrypt data in a mechanism specific manner.
- public uint8[] decrypt_full (Object key, Mechanism mechanism, uint8[] input, Cancellable? cancellable = null) throws Error
Decrypt data in a mechanism specific manner.
- public Object derive_key (Object @base, ulong mech_type, Attributes attrs, Cancellable? cancellable = null) throws Error
Derive a key from another key.
- public async Object derive_key_async (Object @base, Mechanism mechanism, Attributes attrs, Cancellable? cancellable) throws Error
Derive a key from another key.
- public Object derive_key_full (Object @base, Mechanism mechanism, Attributes attrs, Cancellable? cancellable = null) throws Error
Derive a key from another key.
- public uint8[] encrypt (Object key, ulong mech_type, uint8[] input, Cancellable? cancellable = null) throws Error
Encrypt data in a mechanism specific manner.
- public async uint8[] encrypt_async (Object key, Mechanism mechanism, uint8[] input, Cancellable? cancellable) throws Error
Encrypt data in a mechanism specific manner.
- public uint8[] encrypt_full (Object key, Mechanism mechanism, uint8[] input, Cancellable? cancellable = null) throws Error
Encrypt data in a mechanism specific manner.
- public Enumerator enumerate_objects (Attributes match)
Setup an enumerator for listing matching objects available via this session.
- public ulong[]? find_handles (Attributes match, Cancellable? cancellable) throws Error
Find the objects matching the passed attributes.
- public async ulong[]? find_handles_async (Attributes match, Cancellable? cancellable) throws Error
Find the objects matching the passed attributes.
- public List<Object> find_objects (Attributes match, Cancellable? cancellable = null) throws Error
Find the objects matching the passed attributes.
- public async List<Object> find_objects_async (Attributes match, Cancellable? cancellable) throws Error
Find the objects matching the passed attributes.
- public bool generate_key_pair (ulong mech_type, Attributes public_attrs, Attributes private_attrs, out Object public_key, out Object private_key, Cancellable? cancellable = null) throws Error
Generate a new key pair of public and private keys.
- public async bool generate_key_pair_async (Mechanism mechanism, Attributes public_attrs, Attributes private_attrs, Cancellable? cancellable, out Object public_key, out Object private_key) throws Error
Generate a new key pair of public and private keys.
- public bool generate_key_pair_full (Mechanism mechanism, Attributes public_attrs, Attributes private_attrs, out Object public_key, out Object private_key, Cancellable? cancellable = null) throws Error
Generate a new key pair of public and private keys.
- public ulong get_handle ()
Get the raw PKCS#11 session handle from a session object.
- public SessionInfo get_info ()
Get information about the session.
- public TlsInteraction? get_interaction ()
Get the interaction object set on this session, which is used to prompt for pins and the like.
- public Module get_module ()
Get the PKCS#11 module to which this session belongs.
- public SessionOptions get_options ()
Get the options this session was opened with.
- public Slot get_slot ()
Get the PKCS#11 slot to which this session belongs.
- public ulong get_state ()
Get the session state.
- public bool init_pin (uint8[]? pin, Cancellable? cancellable = null) throws Error
Initialize the user's pin on this slot that this session is opened on.
- public async bool init_pin_async (uint8[]? pin, Cancellable? cancellable) throws Error
Initialize the user's pin on this slot that this session is opened on.
- public bool login (ulong user_type, uint8[]? pin, Cancellable? cancellable = null) throws Error
Login the user on the session.
- public async bool login_async (ulong user_type, uint8[]? pin, Cancellable? cancellable) throws Error
Login the user on the session.
- public bool login_interactive (ulong user_type, TlsInteraction? interaction, Cancellable? cancellable = null) throws Error
Login the user on the session requesting the password interactively when necessary.
- public async bool login_interactive_async (ulong user_type, TlsInteraction? interaction, Cancellable? cancellable) throws Error
Login the user on the session prompting for passwords interactively when necessary.
- public bool logout (Cancellable? cancellable = null) throws Error
Log out of the session.
- public async bool logout_async (Cancellable? cancellable) throws Error
Log out of the session.
- public void set_interaction (TlsInteraction? interaction)
Set the interaction object on this session, which is used to prompt for pins and the like.
- public bool set_pin (uint8[]? old_pin, uint8[]? new_pin, Cancellable? cancellable = null) throws Error
Change the user's pin on this slot that this session is opened on.
- public async bool set_pin_async (uint8[]? old_pin, size_t n_old_pin, uint8[]? new_pin, Cancellable? cancellable) throws Error
Change the user's pin on this slot that this session is opened on.
- public uint8[] sign (Object key, ulong mech_type, uint8[] input, Cancellable? cancellable = null) throws Error
Sign data in a mechanism specific manner.
- public async uint8[] sign_async (Object key, Mechanism mechanism, uint8[] input, Cancellable? cancellable) throws Error
Sign data in a mechanism specific manner.
- public uint8 sign_full (Object key, Mechanism mechanism, uint8[] input, size_t n_result, Cancellable? cancellable = null) throws Error
Sign data in a mechanism specific manner.
- public Object unwrap_key (Object wrapper, ulong mech_type, uint8[] input, Attributes attrs, Cancellable? cancellable = null) throws Error
Unwrap a key from a byte stream.
- public async Object unwrap_key_async (Object wrapper, Mechanism mechanism, uint8[] input, Attributes attrs, Cancellable? cancellable) throws Error
Unwrap a key from a byte stream.
- public Object unwrap_key_full (Object wrapper, Mechanism mechanism, uint8[] input, Attributes attrs, Cancellable? cancellable = null) throws Error
Unwrap a key from a byte stream.
- public bool verify (Object key, ulong mech_type, uint8[] input, uint8[] signature, Cancellable? cancellable = null) throws Error
Verify data in a mechanism specific manner.
- public async bool verify_async (Object key, Mechanism mechanism, uint8[] input, uint8[] signature, Cancellable? cancellable) throws Error
Verify data in a mechanism specific manner.
- public bool verify_full (Object key, Mechanism mechanism, uint8[] input, uint8[] signature, Cancellable? cancellable = null) throws Error
Verify data in a mechanism specific manner.
- public uint8[] wrap_key (Object wrapper, ulong mech_type, Object wrapped, Cancellable? cancellable = null) throws Error
Wrap a key into a byte stream.
- public async uint8[] wrap_key_async (Object wrapper, Mechanism mechanism, Object wrapped, Cancellable? cancellable) throws Error
Wrap a key into a byte stream.
- public uint8[] wrap_key_full (Object wrapper, Mechanism mechanism, Object wrapped, Cancellable? cancellable = null) throws Error
Wrap a key into a byte stream.
Signals:
- public signal bool discard_handle (ulong handle)
When a GckSession is being disposed of it emits this signal to allow a session pool to pick up the handle and keep it around.
Inherited Members:
All known members inherited from class GLib.Object
All known members inherited from interface GLib.AsyncInitable
All known members inherited from interface GLib.Initable