示例#1
0
/**
 * gck_slot_open_session_async:
 * @self: The slot to open a session on.
 * @options: Options to open the new session with.
 * @pkcs11_flags: Additional raw PKCS#11 flags.
 * @app_data: Application data for notification callback.
 * @notify: PKCS#11 notification callback.
 * @cancellable: Optional cancellation object, or NULL.
 * @callback: Called when the operation completes.
 * @user_data: Data to pass to the callback.
 *
 * Open a session on the slot. If the 'auto reuse' setting is set,
 * then this may be a recycled session with the same flags.
 *
 * This call will return immediately and complete asynchronously.
 **/
void
gck_slot_open_session_full_async (GckSlot *self, guint options, gulong pkcs11_flags, gpointer app_data,
                                  CK_NOTIFY notify, GCancellable *cancellable,
                                  GAsyncReadyCallback callback, gpointer user_data)
{
	OpenSession *args;

	g_object_ref (self);

	args =  _gck_call_async_prep (self, self, perform_open_session, complete_open_session,
	                              sizeof (*args), free_open_session);

	args->app_data = app_data;
	args->notify = notify;
	args->slot = g_object_ref (self);

	args->auto_login = ((options & GCK_SESSION_LOGIN_USER) == GCK_SESSION_LOGIN_USER);

	args->flags = pkcs11_flags | CKF_SERIAL_SESSION;
	if ((options & GCK_SESSION_READ_WRITE) == GCK_SESSION_READ_WRITE)
		args->flags |= CKF_RW_SESSION;

	_gck_call_async_ready_go (args, cancellable, callback, user_data);
	g_object_unref (self);
}
示例#2
0
void
gck_slot_init_token_async (GckSlot *self, const guchar *pin, gsize length,
                            const gchar *label, GCancellable *cancellable,
                            GAsyncReadyCallback callback, gpointer user_data)
{
	InitToken* args = _gck_call_async_prep (self, self, perform_init_token,
	                                         NULL, sizeof (*args));

	args->pin = pin;
	args->length = length;
	args->label = label;

	_gck_call_async_go (args, cancellable, callback, user_data);
}
示例#3
0
文件: gck-module.c 项目: GNOME/gcr
/**
 * gck_module_initialize_async:
 * @path: the file system path to the PKCS\#11 module to load
 * @cancellable: (allow-none): optional cancellation object
 * @callback: a callback which will be called when the operation completes
 * @user_data: data to pass to the callback
 *
 * Asynchronously load and initialize a PKCS\#11 module represented by a
 * #GckModule object.
 **/
void
gck_module_initialize_async (const gchar *path,
                             GCancellable *cancellable,
                             GAsyncReadyCallback callback,
                             gpointer user_data)
{
	Initialize *args;

	g_return_if_fail (path != NULL);

	args =  _gck_call_async_prep (NULL, NULL, perform_initialize, NULL,
	                              sizeof (*args), free_initialize);
	args->path = g_strdup (path);

	_gck_call_async_ready_go (args, cancellable, callback, user_data);
}