gnome-keyring r1573 - in trunk: . gcr



Author: nnielsen
Date: Sat Feb 14 00:23:22 2009
New Revision: 1573
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1573&view=rev

Log:
Fill in key and signature algorithms and parameters.

Modified:
   trunk/ChangeLog
   trunk/gcr/gcr-certificate-details-widget.c

Modified: trunk/gcr/gcr-certificate-details-widget.c
==============================================================================
--- trunk/gcr/gcr-certificate-details-widget.c	(original)
+++ trunk/gcr/gcr-certificate-details-widget.c	Sat Feb 14 00:23:22 2009
@@ -39,6 +39,7 @@
 	GtkTextBuffer *buffer;
 	GtkTextTag *field_tag;
 	gint field_width;
+	guint key_size;
 };
 
 G_DEFINE_TYPE (GcrCertificateDetailsWidget, gcr_certificate_details_widget, GTK_TYPE_ALIGNMENT);
@@ -106,6 +107,8 @@
 	gchar *text;
 	
 	text = g_strdup_printf ("%s:", field);
+	if (value == NULL)
+		value = "";
 	
 	/* Measure the width of the field */
 	layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), text);
@@ -219,9 +222,11 @@
 	GtkTextIter start, iter;
 	const guchar *data, *value;
 	gsize n_data, n_value;
+	const gchar *text;
 	guint version;
 	gchar *display;
 	ASN1_TYPE asn;
+	GQuark oid;
 	GDate date;
 	
 	gtk_text_buffer_get_start_iter (self->pv->buffer, &start);
@@ -276,8 +281,16 @@
 	/* Signature */
 	append_heading (self, _("Signature"));
 	
-	/* TODO: Complete Signature algorithm, and params */
-	append_field_and_value (self, _("Signature Algorithm"), "TODO", FALSE);
+	oid = egg_asn1_read_oid (asn, "signatureAlgorithm.algorithm");
+	text = egg_oid_get_description (oid);
+	append_field_and_value (self, _("Signature Algorithm"), text, FALSE);
+	
+	value = egg_asn1_read_content (asn, data, n_data, "signatureAlgorithm.parameters", &n_value);
+	if (value && n_value) {
+		display = egg_hex_encode_full (value, n_value, TRUE, ' ', 1);
+		append_field_and_value (self, _("Signature Parameters"), display, TRUE);
+		g_free (display);
+	}
 	
 	value = egg_asn1_read_content (asn, data, n_data, "signature", &n_value);
 	g_return_if_fail (value);
@@ -288,8 +301,17 @@
 	/* Public Key Info */
 	append_heading (self, _("Public Key Info"));
 	
-	/* TODO: Complete algorithm, params, key size */
-	append_field_and_value (self, _("Key Algorithm"), "TODO", FALSE);
+	oid = egg_asn1_read_oid (asn, "tbsCertificate.subjectPublicKeyInfo.algorithm.algorithm");
+	text = egg_oid_get_description (oid);
+	append_field_and_value (self, _("Key Algorithm"), text, FALSE);
+	
+	value = egg_asn1_read_content (asn, data, n_data, "tbsCertificate.subjectPublicKeyInfo.algorithm.parameters", &n_value);
+	if (value && n_value) {
+		display = egg_hex_encode_full (value, n_value, TRUE, ' ', 1);
+		append_field_and_value (self, _("Key Parameters"), display, TRUE);
+		g_free (display);
+	}
+
 	append_field_and_value (self, _("Key Size"), "TODO", FALSE);
 	
 	value = egg_asn1_read_content (asn, data, n_data, "tbsCertificate.subjectPublicKeyInfo.subjectPublicKey", &n_value);



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