GTlsDatabase and related objects

The database is an abstract object implemented by the various TLS
backends, which is used by GTlsConnection to lookup certificates
and keys, as well as verify certificate chains.

Also add GTlsInteraction, which can be used to prompt the user
for a password or PIN (used with the database).

https://bugzilla.gnome.org/show_bug.cgi?id=636572
This commit is contained in:
Stef Walter
2011-08-04 08:54:55 +02:00
parent a187199efd
commit 0f99cfa882
26 changed files with 3095 additions and 139 deletions

View File

@@ -149,6 +149,28 @@ g_tls_backend_supports_tls (GTlsBackend *backend)
return TRUE;
}
/**
* g_tls_backend_get_default_database:
* @backend: the #GTlsBackend
*
* Gets the default #GTlsDatabase used to verify TLS connections.
*
* Return value: the default database, which should be unreffed when done.
*
* Since: 2.30
*/
GTlsDatabase *
g_tls_backend_get_default_database (GTlsBackend *backend)
{
g_return_val_if_fail (G_IS_TLS_BACKEND (backend), NULL);
/* This method was added later, so accept the (remote) possibility it can be NULL */
if (!G_TLS_BACKEND_GET_INTERFACE (backend)->get_default_database)
return NULL;
return G_TLS_BACKEND_GET_INTERFACE (backend)->get_default_database (backend);
}
/**
* g_tls_backend_get_certificate_type:
* @backend: the #GTlsBackend
@@ -199,3 +221,25 @@ g_tls_backend_get_server_connection_type (GTlsBackend *backend)
{
return G_TLS_BACKEND_GET_INTERFACE (backend)->get_server_connection_type ();
}
/**
* g_tls_backend_get_file_database_type:
* @backend: the #GTlsBackend
*
* Gets the #GTyep of @backend's #GTlsFileDatabase implementation.
*
* Return value: the #GType of backend's #GTlsFileDatabase implementation.
*
* Since: 2.30
*/
GType
g_tls_backend_get_file_database_type (GTlsBackend *backend)
{
g_return_val_if_fail (G_IS_TLS_BACKEND (backend), 0);
/* This method was added later, so accept the (remote) possibility it can be NULL */
if (!G_TLS_BACKEND_GET_INTERFACE (backend)->get_file_database_type)
return 0;
return G_TLS_BACKEND_GET_INTERFACE (backend)->get_file_database_type ();
}