[glib-networking/wip/tingping/pkcs11] wip
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/tingping/pkcs11] wip
- Date: Mon, 29 Jul 2019 19:42:34 +0000 (UTC)
commit a8283c2e1b3c7c395097ea1614304565bdb9344c
Author: Patrick Griffis <tingping tingping se>
Date: Wed May 1 12:33:31 2019 -0700
wip
meson.build | 1 +
tls/gnutls/gtlsbackend-gnutls.c | 1 +
tools/gtls-database-tool.c | 40 ++++++++++++++++++++++++++++++++++++++++
tools/meson.build | 7 +++++++
4 files changed, 49 insertions(+)
---
diff --git a/meson.build b/meson.build
index 5c03f6e..85391c8 100644
--- a/meson.build
+++ b/meson.build
@@ -154,6 +154,7 @@ top_inc = include_directories('.')
tls_inc = include_directories('tls')
subdir('po')
+subdir('tools')
enable_installed_tests = get_option('installed_tests')
test_template = files('template.test.in')
diff --git a/tls/gnutls/gtlsbackend-gnutls.c b/tls/gnutls/gtlsbackend-gnutls.c
index 23278cd..77e8b48 100644
--- a/tls/gnutls/gtlsbackend-gnutls.c
+++ b/tls/gnutls/gtlsbackend-gnutls.c
@@ -66,6 +66,7 @@ gtls_gnutls_init (gpointer data)
GTypePlugin *plugin;
gnutls_global_init ();
+ g_assert (gnutls_pkcs11_init (GNUTLS_PKCS11_FLAG_AUTO, NULL) == GNUTLS_E_SUCCESS);
#ifdef GTLS_GNUTLS_DEBUG
gnutls_global_set_log_function (gtls_log_func);
diff --git a/tools/gtls-database-tool.c b/tools/gtls-database-tool.c
new file mode 100644
index 0000000..2683fc4
--- /dev/null
+++ b/tools/gtls-database-tool.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2019 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * In addition, when the library is used with OpenSSL, a special
+ * exception applies. Refer to the LICENSE_EXCEPTION file for details.
+ *
+ * Author: Patrick Griffis <pgriffis igalia com>
+ */
+
+#include <gio/gio.h>
+
+int
+main (int argc, char const *argv[])
+{
+ g_autoptr(GTlsBackend) backend = g_tls_backend_get_default ();
+ g_autoptr(GTlsDatabase) db = g_tls_backend_get_default_database (backend);
+ g_autoptr(GTlsDatabase) pk_db = g_tls_backend_get_pkcs11_database (backend);
+ g_autoptr(GError) error = NULL;
+
+ g_autoptr(GByteArray) issuer = g_byte_array_new_take ((guint8*)g_strdup("DC = com, DC = pivkey, CN =
PIVKey Device Certificate Authority"), strlen("DC = com, DC = pivkey, CN = PIVKey Device Certificate
Authority"));
+
+ GList *certs = g_tls_database_lookup_certificates_issued_by (pk_db, issuer, NULL,
G_TLS_DATABASE_LOOKUP_NONE, NULL, &error);
+ g_message ("%p %p %p", pk_db, certs, error);
+
+ return 0;
+}
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..4ae3e61
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,7 @@
+tools = [
+ 'gtls-database-tool',
+]
+
+foreach tool : tools
+ executable(tool, tool + '.c', dependencies: gio_dep)
+endforeach
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]