changeset 19073:2156321c5482

- x509_nss get_times
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 03 Aug 2007 07:43:40 +0000
parents 4bdf4ce3473b
children 3004bfa0e846
files libpurple/plugins/ssl/ssl-nss.c
diffstat 1 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/ssl-nss.c	Fri Aug 03 07:37:57 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-nss.c	Fri Aug 03 07:43:40 2007 +0000
@@ -537,7 +537,30 @@
 static gboolean
 x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration)
 {
-	return FALSE;
+	CERTCertificate *crt_dat;
+	PRTime nss_activ, nss_expir;
+	
+	g_return_val_if_fail(crt, FALSE);
+	g_return_val_if_fail(crt->scheme == &x509_nss, FALSE);
+
+	crt_dat = X509_NSS_DATA(crt);
+	g_return_val_if_fail(crt_dat, FALSE);
+
+	/* Extract the times into ugly PRTime thingies */
+	/* TODO: Maybe this shouldn't throw an error? */
+	g_return_val_if_fail(
+		SECSuccess == CERT_GetCertTimes(crt_dat,
+						&nss_activ, &nss_expir),
+		FALSE);
+
+	if (activation) {
+		*activation = nss_activ;
+	}
+	if (expiration) {
+		*expiration = nss_expir;
+	}
+	
+	return TRUE;
 }
 
 static PurpleCertificateScheme x509_nss = {