changeset 18987:a763dd083b79

- Finished tls_peers cert_in_pool - Started tls_peers get_cert
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 06 Jul 2007 00:21:42 +0000
parents dfd9f883b774
children 4189fc3befba
files libpurple/certificate.c
diffstat 1 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.c	Thu Jul 05 18:36:04 2007 +0000
+++ b/libpurple/certificate.c	Fri Jul 06 00:21:42 2007 +0000
@@ -310,18 +310,42 @@
 static gboolean
 x509_tls_peers_cert_in_pool(const gchar *id)
 {
+	gchar *keypath;
+	gboolean ret = FALSE;
+	
 	g_return_val_if_fail(id, FALSE);
 
-	/* TODO: Fill this out */
-	return FALSE;
+	keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id);
+
+	ret = g_file_test(keypath, G_FILE_TEST_IS_REGULAR);
+	
+	g_free(keypath);
+	return ret;
 }
 
 static PurpleCertificate *
 x509_tls_peers_get_cert(const gchar *id)
 {
+	PurpleCertificateScheme *x509;
+	PurpleCertificate *crt;
+	gchar *keypath;
+	
 	g_return_val_if_fail(id, NULL);
 
-	/* TODO: Fill this out */
+	/* Is it in the pool? */
+	if ( !x509_tls_peers_cert_in_pool(id) ) {
+		return NULL;
+	}
+	
+	/* Look up the X.509 scheme */
+	x509 = purple_certificate_find_scheme("x509");
+	g_return_val_if_fail(x509, NULL);
+
+	/* Okay, now find and load that key */
+	keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id);
+
+	/* TODO: finish this */
+
 	return NULL;
 }