[gcr] gcr: Dump issuer and subject raw dns in frob-certificate



commit c8390b4f5d6db2da3f70a6a7bc6fff864d3059a4
Author: Stef Walter <stefw gnome org>
Date:   Wed Aug 1 11:15:44 2012 +0200

    gcr: Dump issuer and subject raw dns in frob-certificate
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681149

 gcr/tests/frob-certificate.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gcr/tests/frob-certificate.c b/gcr/tests/frob-certificate.c
index a84dbc7..caf8827 100644
--- a/gcr/tests/frob-certificate.c
+++ b/gcr/tests/frob-certificate.c
@@ -25,6 +25,8 @@
 
 #include "gcr/gcr.h"
 
+#include "egg/egg-hex.h"
+
 #include <gtk/gtk.h>
 
 #include <unistd.h>
@@ -36,11 +38,29 @@ on_parser_parsed (GcrParser *parser, gpointer user_data)
 {
 	GcrCertificateWidget *details;
 	GtkDialog *dialog = GTK_DIALOG (user_data);
+	GcrCertificate *cert;
+	gpointer dn;
+	gsize n_dn;
+	gchar *string;
 
 	details = g_object_new (GCR_TYPE_CERTIFICATE_WIDGET,
 	                        "attributes", gcr_parser_get_parsed_attributes (parser),
 	                        NULL);
 
+	cert = gcr_certificate_widget_get_certificate (details);
+
+	dn = gcr_certificate_get_subject_raw (cert, &n_dn);
+	string = egg_hex_encode_full (dn, n_dn, TRUE, '\\', 1);
+	g_print ("subject: %s\n", string);
+	g_free (string);
+	g_free (dn);
+
+	dn = gcr_certificate_get_issuer_raw (cert, &n_dn);
+	string = egg_hex_encode_full (dn, n_dn, TRUE, '\\', 1);
+	g_print ("issuer: %s\n", string);
+	g_free (string);
+	g_free (dn);
+
 	gtk_widget_show (GTK_WIDGET (details));
 	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (details));
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]