Library Settings

## Library Settings Library Settings — functions for manipulating GCR library global settings. |

## Synopsis

    GList *             gcr_pkcs11_get_modules              (void);
    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,
                                                             gpointer unused,
                                                             GError **error);
    GList *             gcr_pkcs11_get_trust_lookup_slots   (void);
    GckSlot *           gcr_pkcs11_get_trust_store_slot     (void);
    const gchar **      gcr_pkcs11_get_trust_lookup_uris    (void);
    void                gcr_pkcs11_set_trust_lookup_uris    (const gchar **pkcs11_uris);
    const gchar *       gcr_pkcs11_get_trust_store_uri      (void);
    void                gcr_pkcs11_set_trust_store_uri      (const gchar *pkcs11_uri);

## Description

Manage or lookup various global aspesct and settings of the library.

The GCR library maintains a global list of PKCS#11 modules to use for its various lookups and storage operations. Each module is represented by a GckModule object. You can examine this list by using `gcr_pkcs11_get_modules()`.

The list is configured automatically by looking for system installed PKCS#11 modules. It's not not normally necessary to modify this list. But if you have special needs, you can use the `gcr_pkcs11_set_modules()` and `gcr_pkcs11_add_module()` to do so.

Trust assertions are stored and looked up in specific PKCS#11 slots. You can examine this list with `gcr_pkcs11_get_trust_lookup_slots()`

## Details

### gcr_pkcs11_get_modules ()

    GList *             gcr_pkcs11_get_modules              (void);

List all the PKCS#11 modules that are used by the GCR library. Each module is a GckModule object.

When done with the list, free it with `gck_list_unref_free()`.

Returns : | A newly allocated list of GckModule objects.

### gcr_pkcs11_set_modules ()

    void                gcr_pkcs11_set_modules              (GList *modules);

Set the list of PKCS#11 modules that are used by the GCR library. Each module in the list is a GckModule object.

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.

`modules` : | a list of GckModule

### gcr_pkcs11_add_module ()

    void                gcr_pkcs11_add_module               (GckModule *module);

Add a GckModule to the list of PKCS#11 modules that are used by the GCR library.

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.

`module` : | a GckModule

### gcr_pkcs11_add_module_from_file ()

    gboolean            gcr_pkcs11_add_module_from_file     (const gchar *module_path,
                                                             gpointer unused,
                                                             GError **error);

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.

`module_path` : | the full file path of the PKCS#11 module
`unused` : | unused
`error` : | a GError or NULL
Returns : | whether the module was sucessfully added.

### gcr_pkcs11_get_trust_lookup_slots ()

    GList *             gcr_pkcs11_get_trust_lookup_slots   (void);

List all the PKCS#11 slots that are used by the GCR library for lookup of trust assertions. Each slot is a GckSlot object.

When done with the list, free it with `gck_list_unref_free()`.

Returns : | a list of GckSlot objects to use for lookup of trust.

### gcr_pkcs11_get_trust_store_slot ()

    GckSlot *           gcr_pkcs11_get_trust_store_slot     (void);

Selects an appropriate PKCS#11 slot to store trust assertions. The slot to use is normally configured automatically by the system.

When done with the GckSlot, use `g_object_unref()` to release it.

Returns : | the GckSlot to use for trust assertions.

### gcr_pkcs11_get_trust_lookup_uris ()

    const gchar **      gcr_pkcs11_get_trust_lookup_uris    (void);

Get the PKCS#11 URIs that are used to identify which slots to use for lookup trust assertions.

Returns : | the uri which identifies trust storage slot

### gcr_pkcs11_set_trust_lookup_uris ()

    void                gcr_pkcs11_set_trust_lookup_uris    (const gchar **pkcs11_uris);

Set the PKCS#11 URIs that are used to identify which slots to use for lookup of trust assertions.

It is not normally necessary to call this function. The relevant PKCS#11 slots are automatically configured by the GCR library.

`pkcs11_uris` : | the uris which identifies trust lookup slots

### gcr_pkcs11_get_trust_store_uri ()

    const gchar *       gcr_pkcs11_get_trust_store_uri      (void);

Get the PKCS#11 URI that is used to identify which slot to use for storing trust storage.

Returns : | the uri which identifies trust storage slot

### gcr_pkcs11_set_trust_store_uri ()

    void                gcr_pkcs11_set_trust_store_uri      (const gchar *pkcs11_uri);

Set the PKCS#11 URI that is used to identify which slot to use for storing trust assertions.

It is not normally necessary to call this function. The relevant PKCS#11 slot is automatically configured by the GCR library.

`pkcs11_uri` : | the uri which identifies trust storage slot