## GP11Session

GP11Session — Represents an open PKCS11 session.

## Synopsis

                        GP11Session;
    GP11Session*        gp11_session_from_handle            (GP11Slot *slot,
                                                             CK_SESSION_HANDLE handle);
    GP11Module*         gp11_session_get_module             (GP11Session *self);
    GP11Slot*           gp11_session_get_slot               (GP11Session *self);
    CK_SESSION_HANDLE   gp11_session_get_handle             (GP11Session *self);
    GP11SessionInfo*    gp11_session_get_info               (GP11Session *self);
    gboolean            gp11_session_login                  (GP11Session *self,
                                                             gulong user_type,
                                                             const guchar *pin,
                                                             gsize n_pin,
                                                             GError **err);
    gboolean            gp11_session_login_full             (GP11Session *self,
                                                             gulong user_type,
                                                             const guchar *pin,
                                                             gsize n_pin,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gp11_session_login_async            (GP11Session *self,
                                                             gulong user_type,
                                                             const guchar *pin,
                                                             gsize n_pin,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gp11_session_login_finish           (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);
    gboolean            gp11_session_logout                 (GP11Session *self,
                                                             GError **err);
    gboolean            gp11_session_logout_full            (GP11Session *self,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gp11_session_logout_async           (GP11Session *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gp11_session_logout_finish          (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);
    GP11Object*         gp11_session_create_object          (GP11Session *self,
                                                             GError **err);
    void                gp11_session_create_object_async    (GP11Session *self,
                                                             GP11Attributes *attrs,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GP11Object*         gp11_session_create_object_finish   (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);
    GList*              gp11_session_find_objects           (GP11Session *self,
                                                             GError **err);
    void                gp11_session_find_objects_async     (GP11Session *self,
                                                             GP11Attributes *attrs,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GList*              gp11_session_find_objects_finish    (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);
    guchar*             gp11_session_encrypt                (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GError **err);
    guchar*             gp11_session_encrypt_full           (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gp11_session_encrypt_async          (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    guchar*             gp11_session_encrypt_finish         (GP11Session *self,
                                                             GAsyncResult *result,
                                                             gsize *n_result,
                                                             GError **err);
    guchar*             gp11_session_decrypt                (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GError **err);
    guchar*             gp11_session_decrypt_full           (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gp11_session_decrypt_async          (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    guchar*             gp11_session_decrypt_finish         (GP11Session *self,
                                                             GAsyncResult *result,
                                                             gsize *n_result,
                                                             GError **err);
    guchar*             gp11_session_sign                   (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GError **err);
    guchar*             gp11_session_sign_full              (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gp11_session_sign_async             (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    guchar*             gp11_session_sign_finish            (GP11Session *self,
                                                             GAsyncResult *result,
                                                             gsize *n_result,
                                                             GError **err);
    gboolean            gp11_session_verify                 (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             const guchar *signature,
                                                             gsize n_signature,
                                                             GError **err);
    gboolean            gp11_session_verify_full            (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             const guchar *signature,
                                                             gsize n_signature,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gp11_session_verify_async           (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mechanism,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             const guchar *signature,
                                                             gsize n_signature,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gp11_session_verify_finish          (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);
                        GP11SessionInfo;
    void                gp11_session_info_free              (GP11SessionInfo *session_info);
                        GP11Mechanism;

## Object Hierarchy

      GObject
       +----GP11Session

## Properties

      "handle"                   gulong                : Read / Write / Construct Only
      "module"                   GP11Module*           : Read / Write / Construct Only
      "slot"                     GP11Slot*             : Read / Write / Construct Only

## Signals

      "discard-handle"                                 : Run Last

## Description

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

## Details

### GP11Session

    typedef struct _GP11Session GP11Session;

Represents an open PKCS11 session.

### gp11_session_from_handle ()

    GP11Session*        gp11_session_from_handle            (GP11Slot *slot,
                                                             CK_SESSION_HANDLE handle);

Initialize a GP11Session object from a raw PKCS11 session handle. Usually one would use the `gp11_slot_open_session()` function to create a session.

`slot` : | The slot which the session belongs to.
`handle` : | The raw PKCS11 handle of the session.
Returns : | The new GP11Session object.

### gp11_session_get_module ()

    GP11Module*         gp11_session_get_module             (GP11Session *self);

Get the PKCS11 module to which this session belongs.

`self` : | The session object.
Returns : | The module, which should be unreffed after use.

### gp11_session_get_slot ()

    GP11Slot*           gp11_session_get_slot               (GP11Session *self);

Get the PKCS11 slot to which this session belongs.

`self` : | The session object.
Returns : | The slot, which should be unreffed after use.

### gp11_session_get_handle ()

    CK_SESSION_HANDLE   gp11_session_get_handle             (GP11Session *self);

Get the raw PKCS11 session handle from a GP11Session object.

`self` : | The session object.
Returns : | The raw session handle.

### gp11_session_get_info ()

    GP11SessionInfo*    gp11_session_get_info               (GP11Session *self);

Get information about the session.

`self` : | The session object.
Returns : | The session info. Use the `gp11_session_info_free()` to release when done.

### gp11_session_login ()

    gboolean            gp11_session_login                  (GP11Session *self,
                                                             gulong user_type,
                                                             const guchar *pin,
                                                             gsize n_pin,
                                                             GError **err);

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

`self` : | Log into this session.
`user_type` : | The type of login user.
`pin` : | The user's PIN, or NULL for protected authentication path.
`n_pin` : | The length of the PIN.
`err` : | A location to return an error.
Returns : | Whether successful or not.

### gp11_session_login_full ()

    gboolean            gp11_session_login_full             (GP11Session *self,
                                                             gulong user_type,
                                                             const guchar *pin,
                                                             gsize n_pin,
                                                             GCancellable *cancellable,
                                                             GError **err);

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

`self` : | Log into this session.
`user_type` : | The type of login user.
`pin` : | The user's PIN, or NULL for protected authentication path.
`n_pin` : | The length of the PIN.
`cancellable` : | Optional cancellation object, or NULL.
`err` : | A location to return an error.
Returns : | Whether successful or not.

### gp11_session_login_async ()

    void                gp11_session_login_async            (GP11Session *self,
                                                             gulong user_type,
                                                             const guchar *pin,
                                                             gsize n_pin,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

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

`self` : | Log into this session.
`user_type` : | The type of login user.
`pin` : | The user's PIN, or NULL for protected authentication path.
`n_pin` : | The length of the PIN.
`cancellable` : | Optional cancellation object, or NULL.
`callback` : | Called when the operation completes.
`user_data` : | Data to pass to the callback.

### gp11_session_login_finish ()

    gboolean            gp11_session_login_finish           (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);

Get the result of a login operation.

`self` : | The session logged into.
`result` : | The result passed to the callback.
`err` : | A location to return an error.
Returns : | Whether the operation was successful or not.

### gp11_session_logout ()

    gboolean            gp11_session_logout                 (GP11Session *self,
                                                             GError **err);

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

`self` : | Logout of this session.
`err` : | A location to return an error.
Returns : | Whether the logout was successful or not.

### gp11_session_logout_full ()

    gboolean            gp11_session_logout_full            (GP11Session *self,
                                                             GCancellable *cancellable,
                                                             GError **err);

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

`self` : | Logout of this session.
`cancellable` : | Optional cancellation object, or NULL.
`err` : | A location to return an error.
Returns : | Whether the logout was successful or not.

### gp11_session_logout_async ()

    void                gp11_session_logout_async           (GP11Session *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

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

`self` : | Logout of this session.
`cancellable` : | Optional cancellation object, or NULL.
`callback` : | Called when the operation completes.
`user_data` : | Data to pass to the callback.

### gp11_session_logout_finish ()

    gboolean            gp11_session_logout_finish          (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);

Get the result of logging out of a session.

`self` : | Logout of this session.
`result` : | The result passed to the callback.
`err` : | A location to return an error.
Returns : | Whether the logout was successful or not.

### gp11_session_create_object ()

    GP11Object*         gp11_session_create_object          (GP11Session *self,
                                                             GError **err);

Create a new PKCS11 object. This call may block for an indefinite period.

The arguments must be triples of: attribute type, data type, value

The variable argument list should contain:

a) | The gulong attribute type (ie: CKA_LABEL).
b) | The attribute data type (one of GP11_BOOLEAN, GP11_ULONG, GP11_STRING, GP11_DATE) orthe raw attribute value length.
c) | The attribute value, either a gboolean, gulong, gchar*, GDate* or a pointer to a raw attribute value.

The variable argument list should be terminated with GP11_INVALID.

`self` : | The session to create the object on.
`err` : | A location to store an error. ...: The attributes to create the new object with.
Returns : | The newly created object, or NULL if an error occurred.

### gp11_session_create_object_async ()

    void                gp11_session_create_object_async    (GP11Session *self,
                                                             GP11Attributes *attrs,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Create a new PKCS11 object. This call will return immediately and complete asynchronously.

`self` : | The session to create the object on.
`attrs` : | The attributes to create the object with.
`cancellable` : | Optional cancellation object or NULL.
`callback` : | Called when the operation completes.
`user_data` : | Data to pass to the callback.

### gp11_session_create_object_finish ()

    GP11Object*         gp11_session_create_object_finish   (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);

Get the result of creating a new PKCS11 object.

`self` : | The session to create the object on.
`result` : | The result passed to the callback.
`err` : | A location to return an error, or NULL.
Returns : | The newly created object or NULL if an error occurred.

### gp11_session_find_objects ()

    GList*              gp11_session_find_objects           (GP11Session *self,
                                                             GError **err);

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

The arguments must be triples of: attribute type, data type, value

The variable argument list should contain:

a) | The gulong attribute type (ie: CKA_LABEL).
b) | The attribute data type (one of GP11_BOOLEAN, GP11_ULONG, GP11_STRING, GP11_DATE) orthe raw attribute value length.
c) | The attribute value, either a gboolean, gulong, gchar*, GDate* or a pointer to a raw attribute value.

The variable argument list should be terminated with GP11_INVALID.

`self` : | The session to find objects on.
`err` : | A location to return an error or NULL. ...: The attributes to match.
Returns : | A list of the matching objects, which may be empty.

### gp11_session_find_objects_async ()

    void                gp11_session_find_objects_async     (GP11Session *self,
                                                             GP11Attributes *attrs,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

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

`self` : | The session to find objects on.
`attrs` : | The attributes to match.
`cancellable` : | Optional cancellation object or NULL.
`callback` : | Called when the operation completes.
`user_data` : | Data to pass to the callback.

### gp11_session_find_objects_finish ()

    GList*              gp11_session_find_objects_finish    (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);

Get the result of a find operation.

`self` : | The session to find objects on.
`result` : | The attributes to match.
`err` : | A location to return an error.
Returns : | A list of the matching objects, which may be empty.

### gp11_session_encrypt ()

    guchar*             gp11_session_encrypt                (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to encrypt with.
`mech_type` : | The mechanism type to use for encryption.
`input` : | The data to encrypt.
`n_input` : | The length of the data to encrypt.
`n_result` : | A location to store the length of the result data.
`err` : | A location to place error information.
Returns : | The data that was encrypted, or NULL if an error occured.

### gp11_session_encrypt_full ()

    guchar*             gp11_session_encrypt_full           (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GCancellable *cancellable,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to encrypt with.
`mech_args` : | The mechanism type and parameters to use for encryption.
`input` : | The data to encrypt.
`n_input` : | The length of the data to encrypt.
`n_result` : | A location to store the length of the result data.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`err` : | A location to place error information.
Returns : | The data that was encrypted, or NULL if an error occured.

### gp11_session_encrypt_async ()

    void                gp11_session_encrypt_async          (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

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

`self` : | The session.
`key` : | The key to encrypt with.
`mech_args` : | The mechanism type and parameters to use for encryption.
`input` : | The data to encrypt.
`n_input` : | The length of the data to encrypt.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`callback` : | Called when the operation completes.
`user_data` : | A pointer to pass to the callback.

### gp11_session_encrypt_finish ()

    guchar*             gp11_session_encrypt_finish         (GP11Session *self,
                                                             GAsyncResult *result,
                                                             gsize *n_result,
                                                             GError **err);

Get the result of an encryption operation.

`self` : | The session.
`result` : | The result object passed to the callback.
`n_result` : | A location to store the length of the result data.
`err` : | A location to place error information.
Returns : | The data that was encrypted, or NULL if an error occurred.

### gp11_session_decrypt ()

    guchar*             gp11_session_decrypt                (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to decrypt with.
`mech_type` : | The mechanism type to use for decryption.
`input` : | The data to decrypt.
`n_input` : | The length of the data to decrypt.
`n_result` : | A location to store the length of the result data.
`err` : | A location to place an error.
Returns : | The data that was decrypted, or NULL if an error occured.

### gp11_session_decrypt_full ()

    guchar*             gp11_session_decrypt_full           (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GCancellable *cancellable,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to decrypt with.
`mech_args` : | The mechanism type and parameters to use for decryption.
`input` : | The data to decrypt.
`n_input` : | The length of the data to decrypt.
`n_result` : | A location to store the length of the result data.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`err` : | A location to place error information.
Returns : | The data that was decrypted, or NULL if an error occured.

### gp11_session_decrypt_async ()

    void                gp11_session_decrypt_async          (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

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

`self` : | The session.
`key` : | The key to decrypt with.
`mech_args` : | The mechanism type and parameters to use for decryption.
`input` : | The data to decrypt.
`n_input` : | The length of the data to decrypt.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`callback` : | Called when the operation completes.
`user_data` : | A pointer to pass to the callback.

### gp11_session_decrypt_finish ()

    guchar*             gp11_session_decrypt_finish         (GP11Session *self,
                                                             GAsyncResult *result,
                                                             gsize *n_result,
                                                             GError **err);

Get the result of an decryption operation.

`self` : | The session.
`result` : | The result object passed to the callback.
`n_result` : | A location to store the length of the result data.
`err` : | A location to place error information.
Returns : | The data that was decrypted, or NULL if an error occurred.

### gp11_session_sign ()

    guchar*             gp11_session_sign                   (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to sign with.
`mech_type` : | The mechanism type to use for signing.
`input` : | The data to sign.
`n_input` : | The length of the data to sign.
`n_result` : | A location to store the length of the result data.
`err` : | A location to place an error.
Returns : | The data that was signed, or NULL if an error occured.

### gp11_session_sign_full ()

    guchar*             gp11_session_sign_full              (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             gsize *n_result,
                                                             GCancellable *cancellable,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to sign with.
`mech_args` : | The mechanism type and parameters to use for signing.
`input` : | The data to sign.
`n_input` : | The length of the data to sign.
`n_result` : | A location to store the length of the result data.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`err` : | A location to place error information.
Returns : | The data that was signed, or NULL if an error occured.

### gp11_session_sign_async ()

    void                gp11_session_sign_async             (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

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

`self` : | The session.
`key` : | The key to sign with.
`mech_args` : | The mechanism type and parameters to use for signing.
`input` : | The data to sign.
`n_input` : | The length of the data to sign.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`callback` : | Called when the operation completes.
`user_data` : | A pointer to pass to the callback.

### gp11_session_sign_finish ()

    guchar*             gp11_session_sign_finish            (GP11Session *self,
                                                             GAsyncResult *result,
                                                             gsize *n_result,
                                                             GError **err);

Get the result of an signing operation.

`self` : | The session.
`result` : | The result object passed to the callback.
`n_result` : | A location to store the length of the result data.
`err` : | A location to place error information.
Returns : | The data that was signed, or NULL if an error occurred.

### gp11_session_verify ()

    gboolean            gp11_session_verify                 (GP11Session *self,
                                                             GP11Object *key,
                                                             gulong mech_type,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             const guchar *signature,
                                                             gsize n_signature,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to verify with.
`mech_type` : | The mechanism type to use for verifying.
`input` : | The data to verify.
`n_input` : | The length of the data to verify.
`signature` : | The signature.
`n_signature` : | The length of the signature.
`err` : | A location to place an error.
Returns : | TRUE if the data verified correctly, otherwise a failure or error occurred.

### gp11_session_verify_full ()

    gboolean            gp11_session_verify_full            (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mech_args,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             const guchar *signature,
                                                             gsize n_signature,
                                                             GCancellable *cancellable,
                                                             GError **err);

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

`self` : | The session.
`key` : | The key to verify with.
`mech_args` : | The mechanism type and parameters to use for signing.
`input` : | The data to verify.
`n_input` : | The length of the data to verify.
`signature` : | The signature.
`n_signature` : | The length of the signature.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`err` : | A location to place an error.
Returns : | TRUE if the data verified correctly, otherwise a failure or error occurred.

### gp11_session_verify_async ()

    void                gp11_session_verify_async           (GP11Session *self,
                                                             GP11Object *key,
                                                             GP11Mechanism *mechanism,
                                                             const guchar *input,
                                                             gsize n_input,
                                                             const guchar *signature,
                                                             gsize n_signature,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

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

`self` : | The session.
`key` : | The key to verify with.
`mechanism` : |
`input` : | The data to verify.
`n_input` : | The length of the data to verify.
`signature` : | The signature.
`n_signature` : | The length of the signature.
`cancellable` : | A GCancellable which can be used to cancel the operation.
`callback` : | Called when the operation completes.
`user_data` : | A pointer to pass to the callback.

### gp11_session_verify_finish ()

    gboolean            gp11_session_verify_finish          (GP11Session *self,
                                                             GAsyncResult *result,
                                                             GError **err);

Get the result of an verify operation.

`self` : | The session.
`result` : | The result object passed to the callback.
`err` : | A location to place error information.
Returns : | TRUE if the data verified correctly, otherwise a failure or error occurred.

### GP11SessionInfo

    typedef struct {
    	gulong slot_id;
    	gulong state;
    	gulong flags;
    	gulong device_error;
    } GP11SessionInfo;

Information about the session. This is analogous to a CK_SESSION_INFO structure.

When done with this structure, release it using `gp11_session_info_free()`.

gulong `slot_id`; | The handle of the PKCS11 slot that this session is opened on.
gulong `state`; | The user login state of the session.
gulong `flags`; | Various PKCS11 flags.
gulong `device_error`; | The last device error that occurred from an operation on this session.

### gp11_session_info_free ()

    void                gp11_session_info_free              (GP11SessionInfo *session_info);

Free the GP11SessionInfo structure and all associated memory.

`session_info` : | Session info to free.

### GP11Mechanism

    typedef struct {
    	gulong type;
    	gpointer parameter;
    	gulong n_parameter;
    } GP11Mechanism;

Represents a mechanism used with crypto operations.

gulong `type`; | The mechanism type
gpointer `parameter`; | Mechanism specific data.
gulong `n_parameter`; | Length of mechanism specific data.

## Property Details

### The `"handle"` property

      "handle"                   gulong                : Read / Write / Construct Only

The raw CK_SESSION_HANDLE handle of this session.

### The `"module"` property

      "module"                   GP11Module*           : Read / Write / Construct Only

The GP11Module that this session is opened on.

### The `"slot"` property

      "slot"                     GP11Slot*             : Read / Write / Construct Only

The GP11Slot this session is opened on.

## Signal Details

### The `"discard-handle"` signal

    gboolean            user_function                      (GP11Session *session,
                                                            gulong       handle,
                                                            gpointer     user_data)      : Run Last

When a GP11Session 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. This is used by `gp11_module_set_pool_sessions()` to implement the module session pool.

`session` : | The session.
`handle` : | The handle being discarded.
`user_data` : | user data set when the signal handler was connected.
Returns : | Whether or not this handle was claimed.