diff libpurple/plugins/ssl/ssl-gnutls.c @ 18938:f2ddc4b10d72

- Add debugging babble
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 22 Jun 2007 03:58:35 +0000
parents cb9d2b9ad6bc
children f393eddab077
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Fri Jun 22 03:38:43 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Fri Jun 22 03:58:35 2007 +0000
@@ -113,6 +113,35 @@
 	} else {
 		purple_debug_info("gnutls", "Handshake complete\n");
 
+		/* TODO: Remove all this debugging babble */
+		/* Now we are cooking with gas! */
+		PurpleSslOps *ops = purple_ssl_get_ops();
+		GList * peers = ops->get_peer_certificates(gsc);
+		
+		PurpleCertificateScheme *x509 =
+			purple_certificate_find_scheme("x509");
+
+		GList * l;
+		for (l=peers; l; l = l->next) {
+			PurpleCertificate *crt = l->data;
+			GByteArray *z =
+				x509->get_fingerprint_sha1(crt);
+			gchar * fpr =
+				purple_base16_encode_chunked(z->data,
+							     z->len);
+
+			purple_debug_info("gnutls/x509",
+					  "Key print: %s\n",
+					  fpr);
+
+			/* Kill the cert! */
+			x509->destroy_certificate(crt);
+			
+			g_free(fpr);
+			g_byte_array_free(z, TRUE);
+		}
+		g_list_free(peers);
+		
 		{
 		  const gnutls_datum_t *cert_list;
 		  unsigned int cert_list_size = 0;