[gnome-keyring/trust-store] [gcr] Add function to load module from file.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/trust-store] [gcr] Add function to load module from file.
- Date: Fri, 10 Dec 2010 04:35:43 +0000 (UTC)
commit a3f17760b4d7f3fc3448a726a3507d1bb501b3ed
Author: Stef Walter <stefw collabora co uk>
Date: Fri Dec 10 04:31:06 2010 +0000
[gcr] Add function to load module from file.
Add gcr_pkcs11_add_module_from_file()
docs/reference/gcr/gcr-sections.txt | 1 +
gcr/gcr-library.c | 36 ++++++++++++++++++++++++++++++++++-
gcr/gcr-library.h | 4 +++
3 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gcr/gcr-sections.txt b/docs/reference/gcr/gcr-sections.txt
index 66a93a4..299ce95 100644
--- a/docs/reference/gcr/gcr-sections.txt
+++ b/docs/reference/gcr/gcr-sections.txt
@@ -173,6 +173,7 @@ gcr_trust_remove_certificate_exception_finish
gcr_pkcs11_get_modules
gcr_pkcs11_set_modules
gcr_pkcs11_add_module
+gcr_pkcs11_add_module_from_file
gcr_pkcs11_get_trust_lookup_modules
gcr_pkcs11_get_trust_store_slot
gcr_pkcs11_get_trust_store_uri
diff --git a/gcr/gcr-library.c b/gcr/gcr-library.c
index 64a20b6..c6f912d 100644
--- a/gcr/gcr-library.c
+++ b/gcr/gcr-library.c
@@ -180,7 +180,7 @@ gcr_pkcs11_get_modules (void)
/**
* gcr_pkcs11_set_modules:
- * @list: a list of #GckModule
+ * @modules: a list of #GckModule
*
* Set the list of PKCS\#11 modules that are used by the GCR library.
* Each module in the list is a #GckModule object.
@@ -224,6 +224,40 @@ gcr_pkcs11_add_module (GckModule *module)
}
/**
+ * gcr_pkcs11_add_module_from_file:
+ * @module_path: the full file path of the PKCS\#11 module
+ * @init_params: initialization string for the module, or NULL
+ * @error: a #GError or NULL
+ *
+ * Initialize a PKCS\#11 module and add it to the modules that are
+ * used by the GCR library. Note that is an error to initialize the same
+ * PKCS\#11 module twice.
+ *
+ * It is not normally necessary to call this function. The available
+ * PKCS\#11 modules installed on the system are automatically loaded
+ * by the GCR library.
+ *
+ * Returns: whether the module was sucessfully added.
+ */
+gboolean
+gcr_pkcs11_add_module_from_file (const gchar *module_path, const gchar *init_params,
+ GError **error)
+{
+ GckModule *module;
+
+ g_return_val_if_fail (module_path, FALSE);
+ g_return_val_if_fail (!error || !*error, FALSE);
+
+ module = gck_module_initialize (module_path, (gpointer)init_params, 0, error);
+ if (module == NULL)
+ return FALSE;
+
+ gcr_pkcs11_add_module (module);
+ g_object_unref (module);
+ return TRUE;
+}
+
+/**
* gcr_pkcs11_get_trust_store_slot:
* @error: a #GError or NULL
*
diff --git a/gcr/gcr-library.h b/gcr/gcr-library.h
index 8a03109..d1204fe 100644
--- a/gcr/gcr-library.h
+++ b/gcr/gcr-library.h
@@ -38,6 +38,10 @@ void gcr_pkcs11_set_modules (GList *modules);
void gcr_pkcs11_add_module (GckModule *module);
+gboolean gcr_pkcs11_add_module_from_file (const gchar *module_path,
+ const gchar *init_params,
+ GError **error);
+
GList* gcr_pkcs11_get_trust_lookup_modules (void);
GckSlot* gcr_pkcs11_get_trust_store_slot (GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]