[gnome-keyring/trust-store] [gcr] Save subject and md5 hash as well when storing trust.



commit 48483c5d993e0d098d03efdf03d3d52422903c85
Author: Stef Walter <stef memberwebs com>
Date:   Sun Sep 19 02:32:28 2010 +0000

    [gcr] Save subject and md5 hash as well when storing trust.
    
    In addition to the attributes we use to look things up store
    CKA_SUBJECT and CKA_CERT_MD5_HASH as well.

 gcr/gcr-trust.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gcr/gcr-trust.c b/gcr/gcr-trust.c
index 947fb71..03c04e7 100644
--- a/gcr/gcr-trust.c
+++ b/gcr/gcr-trust.c
@@ -294,6 +294,8 @@ prepare_set_certificate_exception (GcrCertificate *cert, GcrPurpose purpose, Gcr
 	GckAttributes *attrs;
 	GckEnumerator *en;
 	GList *modules;
+	gpointer data;
+	gsize n_data;
 
 	modules = _gcr_get_pkcs11_modules ();
 
@@ -303,6 +305,16 @@ prepare_set_certificate_exception (GcrCertificate *cert, GcrPurpose purpose, Gcr
 	gck_attributes_add_boolean (attrs, CKA_MODIFIABLE, TRUE);
 	gck_attributes_add_boolean (attrs, CKA_TOKEN, TRUE);
 
+	data = gcr_certificate_get_subject_raw (cert, &n_data);
+	g_return_val_if_fail (data, NULL);
+	gck_attributes_add_data (attrs, CKA_SUBJECT, data, n_data);
+	g_free (data);
+
+	data = gcr_certificate_get_fingerprint (cert, G_CHECKSUM_MD5, &n_data);
+	g_return_val_if_fail (data, NULL);
+	gck_attributes_add_data (attrs, CKA_CERT_MD5_HASH, data, n_data);
+	g_free (data);
+
 	/*
 	 * TODO: We need to be able to sort the modules by preference
 	 * on which sources of trust storage we want to read over which
@@ -380,9 +392,8 @@ perform_set_certificate_exception (GckEnumerator *en, GCancellable *cancel, GErr
 				g_object_unref (session);
 			}
 
+			g_object_unref (slot);
 		}
-
-		g_object_unref (slot);
 	}
 
 	gck_attributes_unref (attrs);



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