From: Stef Walter Date: Wed, 1 Aug 2012 09:15:44 +0000 (+0200) Subject: gcr: Dump issuer and subject raw dns in frob-certificate X-Git-Tag: upstream/3.7.5~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8390b4f5d6db2da3f70a6a7bc6fff864d3059a4;p=platform%2Fupstream%2Fgcr.git gcr: Dump issuer and subject raw dns in frob-certificate https://bugzilla.gnome.org/show_bug.cgi?id=681149 --- 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 #include @@ -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));