changeset 18931:e634122cec47

- purple_ssl_get_peer_certificates
author William Ehlhardt <williamehlhardt@gmail.com>
date Thu, 21 Jun 2007 20:56:54 +0000
parents 559f29b68dcf
children d0d88bd477c1
files libpurple/certificate.h libpurple/sslconn.c libpurple/sslconn.h
diffstat 3 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.h	Thu Jun 21 20:53:03 2007 +0000
+++ b/libpurple/certificate.h	Thu Jun 21 20:56:54 2007 +0000
@@ -131,9 +131,16 @@
 	/** Reference to the verification logic used */
 	PurpleCertificateVerifier *verifier;
 
-	/** List of certificates in the chain to be verified.
+	/** Certificate subject's name.
+	 *
+	 * For X.509 certificates, this is the Common Name
+	 */
+	gchar *subject_name;
+	
+	/** List of certificates in the chain to be verified (such as that returned by purple_ssl_get_peer_certificates )
 	 *
 	 * This is most relevant for X.509 certificates used in SSL sessions.
+	 * The list order should be: certificate, issuer, issuer's issuer, etc.
 	 */
 	GList *cert_chain;
 	
--- a/libpurple/sslconn.c	Thu Jun 21 20:53:03 2007 +0000
+++ b/libpurple/sslconn.c	Thu Jun 21 20:56:54 2007 +0000
@@ -244,6 +244,17 @@
 	return (ops->write)(gsc, data, len);
 }
 
+GList *
+purple_ssl_get_peer_certificates(PurpleSslConnection *gsc)
+{
+	PurpleSslOps *ops;
+
+	g_return_val_if_fail(gsc != NULL, NULL);
+
+	ops = purple_ssl_get_ops();
+	return (ops->get_peer_certificates)(gsc);
+}
+
 void
 purple_ssl_set_ops(PurpleSslOps *ops)
 {
--- a/libpurple/sslconn.h	Thu Jun 21 20:53:03 2007 +0000
+++ b/libpurple/sslconn.h	Thu Jun 21 20:56:54 2007 +0000
@@ -235,6 +235,16 @@
  */
 size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len);
 
+/**
+ * Obtains the peer's presented certificates
+ *
+ * @param gsc    The SSL connection handle
+ *
+ * @return The peer certificate chain, in the order of certificate, issuer,
+ *         issuer's issuer, etc. NULL if no certificates have been provided,
+ */
+GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc);
+
 /*@}*/
 
 /**************************************************************************/