diff --git a/docs/reference/gcr/gcr-sections.txt b/docs/reference/gcr/gcr-sections.txt
index 2f652b9..b28a131 100644
--- a/docs/reference/gcr/gcr-sections.txt
+++ b/docs/reference/gcr/gcr-sections.txt
@@ -435,6 +435,7 @@ GcrUnlockOptionsWidgetPrivate
 <SUBSECTION Private>
 GCR_COLONS_SCHEMA_PUB
 GCR_COLONS_SCHEMA_UID
+GCR_COLONS_SCHEMA_SEC
 GCR_GNUPG_COLLECTION
 GCR_GNUPG_COLLECTION_CLASS
 GCR_GNUPG_COLLECTION_GET_CLASS
@@ -451,6 +452,7 @@ GCR_TYPE_GNUPG_KEY
 GcrColonColumns
 GcrColonPubColumns
 GcrColonUidColumns
+GcrColonSecColumns
 GcrColons
 GcrGnupgCollection
 GcrGnupgCollectionClass
diff --git a/gcr/gcr-colons.h b/gcr/gcr-colons.h
index 5333998..ac89681 100644
--- a/gcr/gcr-colons.h
+++ b/gcr/gcr-colons.h
@@ -52,6 +52,7 @@ G_BEGIN_DECLS
 
 #define GCR_COLONS_SCHEMA_UID  (g_quark_from_static_string ("uid"))
 #define GCR_COLONS_SCHEMA_PUB  (g_quark_from_static_string ("pub"))
+#define GCR_COLONS_SCHEMA_SEC  (g_quark_from_static_string ("sec"))
 
 /* Common columns for all schemas */
 typedef enum {
@@ -67,6 +68,14 @@ typedef enum {
 } GcrColonPubColumns;
 
 /*
+ * Columns for sec schema, add them as they're used. eg:
+ * sec::2048:1:293FC71A513189BD:1299771018::::::::::
+ */
+typedef enum {
+	GCR_COLONS_SEC_KEYID = 4
+} GcrColonSecColumns;
+
+/*
  * Columns for uid schema, add them as they're used. eg:
  * pub:f:1024:17:6C7EE1B8621CC013:899817715:1055898235::m:::scESC:
  */
diff --git a/gcr/gcr-debug.c b/gcr/gcr-debug.c
index 6df2341..2ecbe4b 100644
--- a/gcr/gcr-debug.c
+++ b/gcr/gcr-debug.c
@@ -38,6 +38,7 @@ static GcrDebugFlags current_flags = 0;
 static GDebugKey keys[] = {
 	{ "certificate-chain", GCR_DEBUG_CERTIFICATE_CHAIN },
 	{ "parse", GCR_DEBUG_PARSE },
+	{ "gnupg", GCR_DEBUG_GNUPG },
 	{ 0, }
 };
 
diff --git a/gcr/gcr-debug.h b/gcr/gcr-debug.h
index 200c939..51ac345 100644
--- a/gcr/gcr-debug.h
+++ b/gcr/gcr-debug.h
@@ -31,6 +31,7 @@ typedef enum {
 	GCR_DEBUG_LIBRARY = 1 << 1,
 	GCR_DEBUG_CERTIFICATE_CHAIN = 1 << 2,
 	GCR_DEBUG_PARSE = 1 << 3,
+	GCR_DEBUG_GNUPG = 1 << 4
 } GcrDebugFlags;
 
 gboolean           _gcr_debug_flag_is_set              (GcrDebugFlags flag);
diff --git a/gcr/gcr-gnupg-collection.c b/gcr/gcr-gnupg-collection.c
index c6accf4..5a68470 100644
--- a/gcr/gcr-gnupg-collection.c
+++ b/gcr/gcr-gnupg-collection.c
@@ -25,6 +25,8 @@
 
 #include "gcr-colons.h"
 #include "gcr-collection.h"
+#define DEBUG_FLAG GCR_DEBUG_GNUPG
+#include "gcr-debug.h"
 #include "gcr-gnupg-collection.h"
 #include "gcr-gnupg-key.h"
 #include "gcr-internal.h"
@@ -37,15 +39,15 @@
 
 enum {
 	PROP_0,
-	PROP_DIRECTORY,
-	PROP_MAIN_CONTEXT
+	PROP_DIRECTORY
 };
 
 struct _GcrGnupgCollectionPrivate {
-	GHashTable *items;          /* Map of char *keyid -> GcrGnupgKey *key */
+	GHashTable *items;          /* char *keyid -> GcrGnupgKey* */
 	gchar *directory;
 };
 
+/* Forward declarations */
 static void _gcr_collection_iface (GcrCollectionIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GcrGnupgCollection, _gcr_gnupg_collection, G_TYPE_OBJECT,
@@ -76,6 +78,10 @@ _gcr_gnupg_collection_set_property (GObject *obj, guint prop_id, const GValue *v
 	case PROP_DIRECTORY:
 		g_return_if_fail (!self->pv->directory);
 		self->pv->directory = g_value_dup_string (value);
+		if (self->pv->directory && !g_path_is_absolute (self->pv->directory)) {
+			g_warning ("gnupg collection directory path should be absolute: %s",
+			           self->pv->directory);
+		}
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -166,15 +172,14 @@ _gcr_collection_iface (GcrCollectionIface *iface)
 
 /**
  * _gcr_gnupg_collection_new:
- * @directory: The gnupg home directory, or %NULL
+ * @directory: (allow-none): The gnupg home directory.
  *
  * Create a new GcrGnupgCollection.
  *
  * The gnupg home directory is where the keyring files live. If directory is
  * %NULL then the default gnupg home directory is used.
  *
- * Returns: A newly allocated collection, which should be released with
- *     g_object_unref().
+ * Returns: (transfer full): A newly allocated collection.
  */
 GcrCollection*
 _gcr_gnupg_collection_new (const gchar *directory)
@@ -185,6 +190,22 @@ _gcr_gnupg_collection_new (const gchar *directory)
 }
 
 /*
+ * We have to run the gnupg process twice to list the public and then the
+ * secret keys. These phases are tracked by GcrLoadingPhase. If the first
+ * phase completes successfully (using gpg --list-keys) then we move on to
+ * the second phase where the secret keys are loaded (using gpg --list-secret-keys)
+ *
+ * If a key is loaded as a public key by the public phase, it can be updated by
+ * the secret phase. A key discovered in the secret phase must have a public
+ * counterpart already loaded by the public phase.
+ */
+
+typedef enum {
+	GCR_LOADING_PHASE_PUBLIC = 1,
+	GCR_LOADING_PHASE_SECRET = 2,
+} GcrLoadingPhase;
+
+/*
  * We use @difference to track the keys that were in the collection before
  * the load process, and then remove any not found, at the end of the load
  * process. Strings are directly used from collection->pv->items keys.
@@ -192,15 +213,17 @@ _gcr_gnupg_collection_new (const gchar *directory)
 
 typedef struct {
 	GcrGnupgCollection *collection;       /* reffed pointer back to collection */
+	GcrLoadingPhase loading_phase;        /* Whether loading public or private */
 	GPtrArray *dataset;                   /* GcrColons* not yet made into a key */
 	guint spawn_sig;
-	guint child_sig;
-	GPid gnupg_pid;
 	GString *out_data;                    /* Pending output not yet parsed into colons */
 	GString *err_data;                    /* Pending errors not yet printed */
 	GHashTable *difference;               /* Hashset gchar *keyid -> gchar *keyid */
 } GcrGnupgCollectionLoad;
 
+/* Forward declarations */
+static void spawn_gnupg_list_process (GcrGnupgCollectionLoad *load, GSimpleAsyncResult *res);
+
 static void
 _gcr_gnupg_collection_load_free (gpointer data)
 {
@@ -215,21 +238,59 @@ _gcr_gnupg_collection_load_free (gpointer data)
 
 	if (load->spawn_sig)
 		g_source_remove (load->spawn_sig);
-	if (load->child_sig)
-		g_source_remove (load->child_sig);
-	if (load->gnupg_pid) {
-		kill (load->gnupg_pid, SIGTERM);
-		g_spawn_close_pid (load->gnupg_pid);
-	}
 	g_slice_free (GcrGnupgCollectionLoad, load);
 }
 
 static void
+process_dataset_as_public_key (GcrGnupgCollectionLoad *load, GPtrArray *dataset,
+                               const gchar *keyid)
+{
+	GcrGnupgKey *key;
+
+	/* Note that we've seen this keyid */
+	g_hash_table_remove (load->difference, keyid);
+
+	key = g_hash_table_lookup (load->collection->pv->items, keyid);
+
+	/* Already have this key, just update */
+	if (key) {
+		_gcr_debug ("updating public key: %s", keyid);
+		_gcr_gnupg_key_set_public_dataset (key, dataset);
+
+	/* Add a new key */
+	} else {
+		key = _gcr_gnupg_key_new (dataset, NULL);
+		_gcr_debug ("creating public key: %s", keyid);
+		g_hash_table_insert (load->collection->pv->items, g_strdup (keyid), key);
+		gcr_collection_emit_added (GCR_COLLECTION (load->collection), G_OBJECT (key));
+	}
+}
+
+static void
+process_dataset_as_secret_key (GcrGnupgCollectionLoad *load, GPtrArray *dataset,
+                               const gchar *keyid)
+{
+	GcrGnupgKey *key;
+
+	key = g_hash_table_lookup (load->collection->pv->items, keyid);
+
+	/* Don't have this key */
+	if (key == NULL) {
+		g_message ("Secret key seen but no public key for: %s", keyid);
+
+	/* Tell the private key that it's a secret one */
+	} else {
+		_gcr_debug ("adding secret dataset to key: %s", keyid);
+		_gcr_gnupg_key_set_secret_dataset (key, dataset);
+	}
+}
+
+static void
 process_dataset_as_key (GcrGnupgCollectionLoad *load)
 {
-	const gchar *keyid;
 	GPtrArray *dataset;
-	GcrGnupgKey *key;
+	const gchar *keyid;
+	GQuark schema;
 
 	g_assert (load->dataset->len);
 
@@ -238,21 +299,18 @@ process_dataset_as_key (GcrGnupgCollectionLoad *load)
 
 	keyid = _gcr_gnupg_key_get_keyid_for_colons (dataset);
 	if (keyid) {
-		/* Note that we've seen this keyid */
-		g_hash_table_remove (load->difference, keyid);
+		schema = _gcr_colons_get_schema (dataset->pdata[0]);
 
-		key = g_hash_table_lookup (load->collection->pv->items, keyid);
+		/* A public key */
+		if (schema == GCR_COLONS_SCHEMA_PUB)
+			process_dataset_as_public_key (load, dataset, keyid);
 
-		/* Already have this key, just update */
-		if (key) {
-			_gcr_gnupg_key_set_dataset (key, dataset);
+		/* A secret key */
+		else if (schema == GCR_COLONS_SCHEMA_SEC)
+			process_dataset_as_secret_key (load, dataset, keyid);
 
-		/* Add a new key */
-		} else {
-			key = _gcr_gnupg_key_new (dataset);
-			g_hash_table_insert (load->collection->pv->items, g_strdup (keyid), key);
-			gcr_collection_emit_added (GCR_COLLECTION (load->collection), G_OBJECT (key));
-		}
+		else
+			g_assert_not_reached ();
 
 	} else {
 		g_warning ("parsed gnupg data had no keyid");
@@ -268,6 +326,8 @@ on_line_parse_output (const gchar *line, gpointer user_data)
 	GcrColons *colons;
 	GQuark schema;
 
+	_gcr_debug ("output: %s", line);
+
 	colons = _gcr_colons_parse (line, -1);
 	if (!colons) {
 		g_warning ("invalid gnupg output line: %s", line);
@@ -277,10 +337,11 @@ on_line_parse_output (const gchar *line, gpointer user_data)
 	schema = _gcr_colons_get_schema (colons);
 
 	/*
-	 * Each time we see a line with 'pub' schema we assume that it's
-	 * a new key being listed.
+	 * Each time we see a line with 'pub' or 'sec' schema we assume that
+	 * it's a new key being listed.
 	 */
-	if (schema == GCR_COLONS_SCHEMA_PUB) {
+	if (schema == GCR_COLONS_SCHEMA_PUB || schema == GCR_COLONS_SCHEMA_SEC) {
+		_gcr_debug ("start of new key");
 		if (load->dataset->len)
 			process_dataset_as_key (load);
 		g_assert (!load->dataset->len);
@@ -371,12 +432,28 @@ on_spawn_completed (gpointer user_data)
 	if (load->dataset->len)
 		process_dataset_as_key (load);
 
+	/* If we completed loading public keys, then go and load secret */
+	switch (load->loading_phase) {
+	case GCR_LOADING_PHASE_PUBLIC:
+		_gcr_debug ("public load phase completed");
+		load->loading_phase = GCR_LOADING_PHASE_SECRET;
+		spawn_gnupg_list_process (load, res);
+		return;
+	case GCR_LOADING_PHASE_SECRET:
+		_gcr_debug ("secret load phase completed");
+		/* continue below */
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+
 	/* Remove any keys that we still have in the difference */
 	g_hash_table_iter_init (&iter, load->difference);
 	while (g_hash_table_iter_next (&iter, &keyid, NULL)) {
 		object = g_hash_table_lookup (load->collection->pv->items, keyid);
 		if (object != NULL) {
 			g_object_ref (object);
+			_gcr_debug ("removing key no longer present in keyring: %s", (gchar*)keyid);
 			g_hash_table_remove (load->collection->pv->items, keyid);
 			gcr_collection_emit_removed (GCR_COLLECTION (load->collection), object);
 			g_object_unref (object);
@@ -387,17 +464,12 @@ on_spawn_completed (gpointer user_data)
 }
 
 static void
-on_child_exited (GPid pid, gint status, gpointer user_data)
+on_child_exited (GPid pid, gint status, gpointer unused)
 {
-	GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-	GcrGnupgCollectionLoad *load = g_simple_async_result_get_op_res_gpointer (res);
 	gint code;
 
-	g_return_if_fail (pid == load->gnupg_pid);
-
-	g_spawn_close_pid (load->gnupg_pid);
-	load->gnupg_pid = 0;
-	load->child_sig = 0;
+	_gcr_debug ("process exited: %d", (gint)pid);
+	g_spawn_close_pid (pid);
 
 	if (WIFEXITED (status)) {
 		code = WEXITSTATUS (status);
@@ -419,6 +491,65 @@ static EggSpawnCallbacks spawn_callbacks = {
 	NULL
 };
 
+static void
+spawn_gnupg_list_process (GcrGnupgCollectionLoad *load, GSimpleAsyncResult *res)
+{
+	GError *error = NULL;
+	GPtrArray *argv;
+	GPid pid;
+
+	argv = g_ptr_array_new ();
+	g_ptr_array_add (argv, (gpointer)GPG_EXECUTABLE);
+
+	switch (load->loading_phase) {
+	case GCR_LOADING_PHASE_PUBLIC:
+		_gcr_debug ("starting public load phase");
+		g_ptr_array_add (argv, (gpointer)"--list-keys");
+		break;
+	case GCR_LOADING_PHASE_SECRET:
+		_gcr_debug ("starting secret load phase");
+		g_ptr_array_add (argv, (gpointer)"--list-secret-keys");
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+
+	g_ptr_array_add (argv, (gpointer)"--fixed-list-mode");
+	g_ptr_array_add (argv, (gpointer)"--with-colons");
+	if (load->collection->pv->directory) {
+		g_ptr_array_add (argv, (gpointer)"--homedir");
+		g_ptr_array_add (argv, (gpointer)load->collection->pv->directory);
+	}
+	g_ptr_array_add (argv, NULL);
+
+	g_assert (!load->spawn_sig);
+
+	if (_gcr_debugging) {
+		gchar *command = g_strjoinv (" ", (gchar**)argv->pdata);
+		_gcr_debug ("spawning gnupg process: %s", command);
+		g_free (command);
+	}
+
+	load->spawn_sig = egg_spawn_async_with_callbacks (load->collection->pv->directory,
+	                                                  (gchar**)argv->pdata, NULL,
+	                                                  G_SPAWN_DO_NOT_REAP_CHILD,
+	                                                  &pid, &spawn_callbacks,
+	                                                  g_object_ref (res),
+	                                                  NULL, &error);
+
+	if (error) {
+		_gcr_debug ("spawning process failed: %s", error->message);
+		g_simple_async_result_set_from_error (res, error);
+		g_simple_async_result_complete_in_idle (res);
+		g_clear_error (&error);
+	} else {
+		_gcr_debug ("process spawned: %d", (gint)pid);
+		g_child_watch_add (pid, on_child_exited, NULL);
+	}
+
+	g_ptr_array_unref (argv);
+}
+
 /**
  * _gcr_gnupg_collection_load_async:
  * @self: The collection
@@ -435,8 +566,6 @@ _gcr_gnupg_collection_load_async (GcrGnupgCollection *self, GCancellable *cancel
 {
 	GSimpleAsyncResult *res;
 	GcrGnupgCollectionLoad *load;
-	GError *error = NULL;
-	GPtrArray *argv;
 	GHashTableIter iter;
 	gpointer keyid;
 
@@ -444,17 +573,6 @@ _gcr_gnupg_collection_load_async (GcrGnupgCollection *self, GCancellable *cancel
 
 	/* TODO: Cancellation not yet implemented */
 
-	argv = g_ptr_array_new ();
-	g_ptr_array_add (argv, (gpointer)GPG_EXECUTABLE);
-	g_ptr_array_add (argv, (gpointer)"--list-keys");
-	g_ptr_array_add (argv, (gpointer)"--fixed-list-mode");
-	g_ptr_array_add (argv, (gpointer)"--with-colons");
-	if (self->pv->directory) {
-		g_ptr_array_add (argv, (gpointer)"--homedir");
-		g_ptr_array_add (argv, (gpointer)self->pv->directory);
-	}
-	g_ptr_array_add (argv, NULL);
-
 	res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
 	                                 _gcr_gnupg_collection_load_async);
 
@@ -476,28 +594,10 @@ _gcr_gnupg_collection_load_async (GcrGnupgCollection *self, GCancellable *cancel
 	g_simple_async_result_set_op_res_gpointer (res, load,
 	                                           _gcr_gnupg_collection_load_free);
 
-	load->spawn_sig = egg_spawn_async_with_callbacks (self->pv->directory,
-	                                                  (gchar**)argv->pdata, NULL,
-	                                                  G_SPAWN_DO_NOT_REAP_CHILD,
-	                                                  &load->gnupg_pid,
-	                                                  &spawn_callbacks,
-	                                                  g_object_ref (res),
-	                                                  NULL, &error);
-
-	if (error) {
-		g_simple_async_result_set_from_error (res, error);
-		g_simple_async_result_complete_in_idle (res);
-		g_clear_error (&error);
-	} else {
-		load->child_sig = g_child_watch_add_full (G_PRIORITY_DEFAULT,
-		                                          load->gnupg_pid,
-		                                          on_child_exited,
-		                                          g_object_ref (res),
-		                                          g_object_unref);
-	}
+	load->loading_phase = GCR_LOADING_PHASE_PUBLIC;
+	spawn_gnupg_list_process (load, res);
 
 	g_object_unref (res);
-	g_ptr_array_unref (argv);
 }
 
 /**
diff --git a/gcr/gcr-gnupg-key.c b/gcr/gcr-gnupg-key.c
index 874a3ba..5c07ac4 100644
--- a/gcr/gcr-gnupg-key.c
+++ b/gcr/gcr-gnupg-key.c
@@ -31,15 +31,18 @@
 
 enum {
 	PROP_0,
-	PROP_DATASET,
+	PROP_KEYID,
+	PROP_PUBLIC_DATASET,
+	PROP_SECRET_DATASET,
 	PROP_LABEL,
 	PROP_MARKUP,
 	PROP_DESCRIPTION,
-	PROP_KEYID
+	PROP_SHORT_KEYID
 };
 
 struct _GcrGnupgKeyPrivate {
-	GPtrArray *dataset;
+	GPtrArray *public_dataset;
+	GPtrArray *secret_dataset;
 };
 
 G_DEFINE_TYPE (GcrGnupgKey, _gcr_gnupg_key, G_TYPE_OBJECT);
@@ -53,7 +56,7 @@ calculate_name (GcrGnupgKey *self)
 {
 	GcrColons* colons;
 
-	colons = _gcr_colons_find (self->pv->dataset, GCR_COLONS_SCHEMA_UID);
+	colons = _gcr_colons_find (self->pv->public_dataset, GCR_COLONS_SCHEMA_UID);
 	g_return_val_if_fail (colons, NULL);
 
 	return _gcr_colons_get_string (colons, GCR_COLONS_UID_NAME);
@@ -74,12 +77,12 @@ calculate_markup (GcrGnupgKey *self)
 }
 
 static const gchar *
-calculate_keyid (GcrGnupgKey *self)
+calculate_short_keyid (GcrGnupgKey *self)
 {
 	const gchar *keyid;
 	gsize length;
 
-	keyid = _gcr_gnupg_key_get_keyid_for_colons (self->pv->dataset);
+	keyid = _gcr_gnupg_key_get_keyid_for_colons (self->pv->public_dataset);
 	if (keyid == NULL)
 		return NULL;
 
@@ -101,8 +104,10 @@ _gcr_gnupg_key_finalize (GObject *obj)
 {
 	GcrGnupgKey *self = GCR_GNUPG_KEY (obj);
 
-	if (self->pv->dataset)
-		g_ptr_array_free (self->pv->dataset, TRUE);
+	if (self->pv->public_dataset)
+		g_ptr_array_free (self->pv->public_dataset, TRUE);
+	if (self->pv->secret_dataset)
+		g_ptr_array_free (self->pv->secret_dataset, TRUE);
 
 	G_OBJECT_CLASS (_gcr_gnupg_key_parent_class)->finalize (obj);
 }
@@ -114,8 +119,11 @@ _gcr_gnupg_key_set_property (GObject *obj, guint prop_id, const GValue *value,
 	GcrGnupgKey *self = GCR_GNUPG_KEY (obj);
 
 	switch (prop_id) {
-	case PROP_DATASET:
-		_gcr_gnupg_key_set_dataset (self, g_value_get_boxed (value));
+	case PROP_PUBLIC_DATASET:
+		_gcr_gnupg_key_set_public_dataset (self, g_value_get_boxed (value));
+		break;
+	case PROP_SECRET_DATASET:
+		_gcr_gnupg_key_set_secret_dataset (self, g_value_get_boxed (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -130,8 +138,14 @@ _gcr_gnupg_key_get_property (GObject *obj, guint prop_id, GValue *value,
 	GcrGnupgKey *self = GCR_GNUPG_KEY (obj);
 
 	switch (prop_id) {
-	case PROP_DATASET:
-		g_value_set_boxed (value, self->pv->dataset);
+	case PROP_PUBLIC_DATASET:
+		g_value_set_boxed (value, self->pv->public_dataset);
+		break;
+	case PROP_SECRET_DATASET:
+		g_value_set_boxed (value, self->pv->secret_dataset);
+		break;
+	case PROP_KEYID:
+		g_value_set_string (value, _gcr_gnupg_key_get_keyid (self));
 		break;
 	case PROP_LABEL:
 		g_value_take_string (value, calculate_name (self));
@@ -142,8 +156,8 @@ _gcr_gnupg_key_get_property (GObject *obj, guint prop_id, GValue *value,
 	case PROP_MARKUP:
 		g_value_take_string (value, calculate_markup (self));
 		break;
-	case PROP_KEYID:
-		g_value_set_string (value, calculate_keyid (self));
+	case PROP_SHORT_KEYID:
+		g_value_set_string (value, calculate_short_keyid (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -163,94 +177,222 @@ _gcr_gnupg_key_class_init (GcrGnupgKeyClass *klass)
 	gobject_class->set_property = _gcr_gnupg_key_set_property;
 	gobject_class->get_property = _gcr_gnupg_key_get_property;
 
-	g_object_class_install_property (gobject_class, PROP_DATASET,
-	         g_param_spec_boxed ("dataset", "Dataset", "Colon Dataset",
+	/**
+	 * GcrGnupgKey::public-dataset:
+	 *
+	 * Public key data. Should always be present.
+	 */
+	g_object_class_install_property (gobject_class, PROP_PUBLIC_DATASET,
+	         g_param_spec_boxed ("public-dataset", "Public Dataset", "Public Key Colon Dataset",
+	                             G_TYPE_PTR_ARRAY, G_PARAM_READWRITE));
+
+	/**
+	 * GcrGnupgKey::secret-dataset:
+	 *
+	 * Secret key data. The keyid of this data must match public-dataset.
+	 * If present, this key represents a secret key.
+	 */
+	g_object_class_install_property (gobject_class, PROP_SECRET_DATASET,
+	         g_param_spec_boxed ("secret-dataset", "Secret Dataset", "Secret Key Colon Dataset",
 	                             G_TYPE_PTR_ARRAY, G_PARAM_READWRITE));
 
+	/**
+	 * GcrGnupgKey::keyid:
+	 *
+	 * Key identifier.
+	 */
+	g_object_class_install_property (gobject_class, PROP_KEYID,
+	         g_param_spec_string ("keyid", "Key ID", "Key identifier",
+	                              "", G_PARAM_READABLE));
+
+	/**
+	 * GcrGnupgKey::label:
+	 *
+	 * User readable label for this key.
+	 */
 	g_object_class_install_property (gobject_class, PROP_LABEL,
 	         g_param_spec_string ("label", "Label", "Key label",
 	                              "", G_PARAM_READABLE));
 
+	/**
+	 * GcrGnupgKey::description:
+	 *
+	 * Description of type of key.
+	 */
 	g_object_class_install_property (gobject_class, PROP_DESCRIPTION,
 	         g_param_spec_string ("description", "Description", "Description of object type",
 	                              "", G_PARAM_READABLE));
 
+	/**
+	 * GcrGnupgKey::markup:
+	 *
+	 * User readable markup which contains key label.
+	 */
 	g_object_class_install_property (gobject_class, PROP_MARKUP,
 	         g_param_spec_string ("markup", "Markup", "Markup which describes key",
 	                              "", G_PARAM_READABLE));
 
-	g_object_class_install_property (gobject_class, PROP_KEYID,
-	         g_param_spec_string ("keyid", "Key ID", "Display key identifier",
+	/**
+	 * GcrGnupgKey::short-keyid:
+	 *
+	 * User readable key identifier.
+	 */
+	g_object_class_install_property (gobject_class, PROP_SHORT_KEYID,
+	         g_param_spec_string ("short-keyid", "Short Key ID", "Display key identifier",
 	                              "", G_PARAM_READABLE));
 }
 
 /**
  * _gcr_gnupg_key_new:
- * @dataset: array of GcrColons*
+ * @pubset: array of GcrColons* representing public part of key
+ * @secset: (allow-none): array of GcrColons* representing secret part of key.
  *
- * Create a new GcrGnupgKey for the colons data passed.
+ * Create a new GcrGnupgKey for the colons data passed. If the secret part
+ * of the key is set, then this represents a secret key; otherwise it represents
+ * a public key.
  *
- * Returns: A newly allocated key, which should be released with
- *     g_object_unref().
+ * Returns: (transfer full): A newly allocated key.
  */
 GcrGnupgKey*
-_gcr_gnupg_key_new (GPtrArray *dataset)
+_gcr_gnupg_key_new (GPtrArray *pubset, GPtrArray *secset)
 {
-	g_return_val_if_fail (dataset, NULL);
-	return g_object_new (GCR_TYPE_GNUPG_KEY, "dataset", dataset, NULL);
+	g_return_val_if_fail (pubset, NULL);
+	return g_object_new (GCR_TYPE_GNUPG_KEY,
+	                     "public-dataset", pubset,
+	                     "secret-dataset", secset,
+	                     NULL);
 }
 
 /**
- * _gcr_gnupg_key_get_dataset:
+ * _gcr_gnupg_key_get_public_dataset:
  * @self: The key
  *
  * Get the colons data this key is based on.
  *
- * Returns: An array of GcrColons*, owned by the key.
+ * Returns: (transfer none): An array of GcrColons*.
  */
 GPtrArray*
-_gcr_gnupg_key_get_dataset (GcrGnupgKey *self)
+_gcr_gnupg_key_get_public_dataset (GcrGnupgKey *self)
 {
 	g_return_val_if_fail (GCR_IS_GNUPG_KEY (self), NULL);
-	return self->pv->dataset;
+	return self->pv->public_dataset;
 }
 
 /**
- * _gcr_gnupg_key_set_dataset:
+ * _gcr_gnupg_key_set_public_dataset:
  * @self: The key
  * @dataset: The new array of GcrColons*
  *
  * Change the colons data that this key is based on.
  */
 void
-_gcr_gnupg_key_set_dataset (GcrGnupgKey *self, GPtrArray *dataset)
+_gcr_gnupg_key_set_public_dataset (GcrGnupgKey *self, GPtrArray *dataset)
 {
 	GObject *obj;
 
 	g_return_if_fail (GCR_IS_GNUPG_KEY (self));
 	g_return_if_fail (dataset);
 
+	/* Check that it matches previous */
+	if (self->pv->public_dataset) {
+		const gchar *old_keyid = _gcr_gnupg_key_get_keyid_for_colons (self->pv->public_dataset);
+		const gchar *new_keyid = _gcr_gnupg_key_get_keyid_for_colons (dataset);
+
+		if (g_strcmp0 (old_keyid, new_keyid) != 0) {
+			g_warning ("it is an error to change a gnupg key so that the "
+			           "fingerprint is no longer the same: %s != %s",
+			           old_keyid, new_keyid);
+			return;
+		}
+	}
+
 	g_ptr_array_ref (dataset);
-	if (self->pv->dataset)
-		g_ptr_array_unref (self->pv->dataset);
-	self->pv->dataset = dataset;
+	if (self->pv->public_dataset)
+		g_ptr_array_unref (self->pv->public_dataset);
+	self->pv->public_dataset = dataset;
 
 	obj = G_OBJECT (self);
 	g_object_freeze_notify (obj);
-	g_object_notify (obj, "dataset");
+	g_object_notify (obj, "public-dataset");
 	g_object_notify (obj, "label");
 	g_object_notify (obj, "markup");
-	g_object_notify (obj, "keyid");
 	g_object_thaw_notify (obj);
 }
 
 /**
+ * _gcr_gnupg_key_get_secret_dataset:
+ * @self: The key
+ *
+ * Get the colons secret data this key is based on. %NULL if a public key.
+ *
+ * Returns: (transfer none): An array of GcrColons*.
+ */
+GPtrArray*
+_gcr_gnupg_key_get_secret_dataset (GcrGnupgKey *self)
+{
+	g_return_val_if_fail (GCR_IS_GNUPG_KEY (self), NULL);
+	return self->pv->secret_dataset;
+}
+
+/**
+ * _gcr_gnupg_key_set_secret_dataset:
+ * @self: The key
+ * @dataset: (allow-none): The new array of GcrColons*
+ *
+ * Set the secret data for this key. %NULL if public key.
+ */
+void
+_gcr_gnupg_key_set_secret_dataset (GcrGnupgKey *self, GPtrArray *dataset)
+{
+	GObject *obj;
+
+	g_return_if_fail (GCR_IS_GNUPG_KEY (self));
+
+	/* Check that it matches public key */
+	if (self->pv->public_dataset && dataset) {
+		const gchar *pub_keyid = _gcr_gnupg_key_get_keyid_for_colons (self->pv->public_dataset);
+		const gchar *sec_keyid = _gcr_gnupg_key_get_keyid_for_colons (dataset);
+
+		if (g_strcmp0 (pub_keyid, sec_keyid) != 0) {
+			g_warning ("it is an error to create a gnupg key so that the "
+			           "fingerprint of thet pub and sec parts are not the same: %s != %s",
+			           pub_keyid, sec_keyid);
+			return;
+		}
+	}
+
+	if (dataset)
+		g_ptr_array_ref (dataset);
+	if (self->pv->secret_dataset)
+		g_ptr_array_unref (self->pv->secret_dataset);
+	self->pv->secret_dataset = dataset;
+
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	g_object_notify (obj, "secret-dataset");
+	g_object_thaw_notify (obj);
+}
+
+/**
+ * _gcr_gnupg_key_get_keyid:
+ * @self: The key
+ *
+ * Get the keyid for this key.
+ */
+const gchar*
+_gcr_gnupg_key_get_keyid (GcrGnupgKey *self)
+{
+	g_return_val_if_fail (GCR_IS_GNUPG_KEY (self), NULL);
+	return _gcr_gnupg_key_get_keyid_for_colons (self->pv->public_dataset);
+}
+
+/**
  * _gcr_gnupg_key_get_keyid_for_colons:
  * @dataset: Array of GcrColons*
  *
  * Get the keyid for some colons data.
  *
- * Returns: The keyid, owned by the colons data.
+ * Returns: (transfer none): The keyid.
  */
 const gchar*
 _gcr_gnupg_key_get_keyid_for_colons (GPtrArray *dataset)
@@ -258,10 +400,12 @@ _gcr_gnupg_key_get_keyid_for_colons (GPtrArray *dataset)
 	GcrColons *colons;
 
 	colons = _gcr_colons_find (dataset, GCR_COLONS_SCHEMA_PUB);
-	if (colons == NULL)
-		return NULL;
-
-	return _gcr_colons_get_raw (colons, GCR_COLONS_PUB_KEYID);
+	if (colons != NULL)
+		return _gcr_colons_get_raw (colons, GCR_COLONS_PUB_KEYID);
+	colons = _gcr_colons_find (dataset, GCR_COLONS_SCHEMA_SEC);
+	if (colons != NULL)
+		return _gcr_colons_get_raw (colons, GCR_COLONS_SEC_KEYID);
+	return NULL;
 }
 
 /**
@@ -269,7 +413,7 @@ _gcr_gnupg_key_get_keyid_for_colons (GPtrArray *dataset)
  *
  * Get the columns that we should display for gnupg keys.
  *
- * Returns: The columns, NULL terminated, should not be freed.
+ * Returns: (transfer none): The columns, NULL terminated, should not be freed.
  */
 const GcrColumn*
 _gcr_gnupg_key_get_columns (void)
@@ -277,7 +421,7 @@ _gcr_gnupg_key_get_columns (void)
 	static GcrColumn columns[] = {
 		{ "label", G_TYPE_STRING, G_TYPE_STRING, NC_("column", "Name"),
 		  GCR_COLUMN_SORTABLE },
-		{ "keyid", G_TYPE_STRING, G_TYPE_STRING, NC_("column", "Key ID"),
+		{ "short-keyid", G_TYPE_STRING, G_TYPE_STRING, NC_("column", "Key ID"),
 		  GCR_COLUMN_SORTABLE },
 		{ NULL }
 	};
diff --git a/gcr/gcr-gnupg-key.h b/gcr/gcr-gnupg-key.h
index b1b8765..104c495 100644
--- a/gcr/gcr-gnupg-key.h
+++ b/gcr/gcr-gnupg-key.h
@@ -61,11 +61,19 @@ GType               _gcr_gnupg_key_get_type                      (void);
 
 const GcrColumn*    _gcr_gnupg_key_get_columns                   (void);
 
-GcrGnupgKey*        _gcr_gnupg_key_new                           (GPtrArray *dataset);
+GcrGnupgKey*        _gcr_gnupg_key_new                           (GPtrArray *pubset,
+                                                                  GPtrArray *secset);
 
-GPtrArray*          _gcr_gnupg_key_get_dataset                   (GcrGnupgKey *self);
+const gchar*        _gcr_gnupg_key_get_keyid                     (GcrGnupgKey *self);
 
-void                _gcr_gnupg_key_set_dataset                   (GcrGnupgKey *self,
+GPtrArray*          _gcr_gnupg_key_get_public_dataset            (GcrGnupgKey *self);
+
+void                _gcr_gnupg_key_set_public_dataset            (GcrGnupgKey *self,
+                                                                  GPtrArray *dataset);
+
+GPtrArray*          _gcr_gnupg_key_get_secret_dataset            (GcrGnupgKey *self);
+
+void                _gcr_gnupg_key_set_secret_dataset            (GcrGnupgKey *self,
                                                                   GPtrArray *dataset);
 
 const gchar*        _gcr_gnupg_key_get_keyid_for_colons          (GPtrArray *dataset);
diff --git a/gcr/tests/Makefile.am b/gcr/tests/Makefile.am
index e01cd15..bf3237e 100644
--- a/gcr/tests/Makefile.am
+++ b/gcr/tests/Makefile.am
@@ -34,6 +34,7 @@ TEST_PROGS = \
 check_PROGRAMS = $(TEST_PROGS)
 
 test: $(TEST_PROGS)
+	chmod -f 700 files/gnupg-homedir
 	gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
 
 check-local: test
diff --git a/gcr/tests/files/gnupg-homedir/pubring.gpg b/gcr/tests/files/gnupg-homedir/pubring.gpg
index a642536..10b1372 100644
Binary files a/gcr/tests/files/gnupg-homedir/pubring.gpg and b/gcr/tests/files/gnupg-homedir/pubring.gpg differ
diff --git a/gcr/tests/files/gnupg-homedir/secring.gpg b/gcr/tests/files/gnupg-homedir/secring.gpg
index e69de29..4a21e26 100644
Binary files a/gcr/tests/files/gnupg-homedir/secring.gpg and b/gcr/tests/files/gnupg-homedir/secring.gpg differ
diff --git a/gcr/tests/files/gnupg-homedir/trustdb.gpg b/gcr/tests/files/gnupg-homedir/trustdb.gpg
index 0377c97..3824098 100644
Binary files a/gcr/tests/files/gnupg-homedir/trustdb.gpg and b/gcr/tests/files/gnupg-homedir/trustdb.gpg differ
diff --git a/gcr/tests/test-gnupg-collection.c b/gcr/tests/test-gnupg-collection.c
index d156a82..0761463 100644
--- a/gcr/tests/test-gnupg-collection.c
+++ b/gcr/tests/test-gnupg-collection.c
@@ -24,6 +24,7 @@
 
 #include "gcr/gcr.h"
 #include "gcr/gcr-gnupg-collection.h"
+#include "gcr/gcr-gnupg-key.h"
 
 #include "egg/egg-testing.h"
 
@@ -32,34 +33,146 @@
 #include <errno.h>
 #include <string.h>
 
-#if 0
 typedef struct {
-
+	GcrGnupgCollection *collection;
+	GHashTable *keys;
+	GAsyncResult *result;
 } Test;
 
 static void
+on_collection_added (GcrCollection *collection, GObject *object, gpointer user_data)
+{
+	Test *test = user_data;
+	GcrGnupgKey *key;
+	const gchar *keyid;
+
+	g_assert (GCR_COLLECTION (test->collection) == collection);
+
+	g_assert (GCR_IS_GNUPG_KEY (object));
+	key = GCR_GNUPG_KEY (object);
+
+	keyid = _gcr_gnupg_key_get_keyid (key);
+	g_assert (keyid);
+	g_assert (!g_hash_table_lookup (test->keys, keyid));
+
+	g_hash_table_insert (test->keys, g_strdup (keyid), key);
+}
+
+static void
+on_collection_removed (GcrCollection *collection, GObject *object, gpointer user_data)
+{
+	Test *test = user_data;
+	GcrGnupgKey *key;
+	const gchar *keyid;
+
+	g_assert (GCR_COLLECTION (test->collection) == collection);
+	g_assert (GCR_IS_GNUPG_KEY (object));
+
+	keyid = _gcr_gnupg_key_get_keyid (GCR_GNUPG_KEY (object));
+	key = g_hash_table_lookup (test->keys, keyid);
+	g_assert (key == GCR_GNUPG_KEY (object));
+
+	if (!g_hash_table_remove (test->keys, keyid))
+		g_assert_not_reached ();
+}
+
+static void
 setup (Test *test, gconstpointer unused)
 {
+	GcrCollection *collection;
+	gchar *directory;
+	gchar *path;
+
+	directory = g_get_current_dir ();
+	path = g_build_filename (directory, "files", "gnupg-homedir", NULL);
+
+	collection = _gcr_gnupg_collection_new (path);
+	test->collection = GCR_GNUPG_COLLECTION (collection);
+
+	test->keys = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	g_signal_connect (collection, "added", G_CALLBACK (on_collection_added), test);
+	g_signal_connect (collection, "removed", G_CALLBACK (on_collection_removed), test);
 
+	g_free (path);
+	g_free (directory);
 }
 
 static void
 teardown (Test *test, gconstpointer unused)
 {
+	g_hash_table_destroy (test->keys);
 
+	if (test->result)
+		g_object_unref (test->result);
+
+	g_object_unref (test->collection);
+	g_assert (!GCR_IS_GNUPG_COLLECTION (test->collection));
 }
-#endif
 
 static void
-test_create (void)
+on_async_ready (GObject *source, GAsyncResult *res, gpointer user_data)
 {
-	GcrCollection *collection;
+	Test *test = user_data;
+	g_assert (G_OBJECT (test->collection) == source);
+	g_assert (test->result == NULL);
+	test->result = g_object_ref (res);
+}
 
-	collection = _gcr_gnupg_collection_new ("files/gnupg-homedir/");
+static void
+test_load (Test *test, gconstpointer unused)
+{
+	GError *error = NULL;
+	GcrGnupgKey *key;
+
+	_gcr_gnupg_collection_load_async (test->collection, NULL, on_async_ready, test);
+	egg_test_wait_until (500);
+
+	g_assert (test->result);
+	_gcr_gnupg_collection_load_finish (test->collection, test->result, &error);
+	g_assert_no_error (error);
+
+	/* Werner Koch (a public key) */
+	key = g_hash_table_lookup (test->keys, "5DE249965B0358A2");
+	g_assert (GCR_IS_GNUPG_KEY (key));
+	g_assert (_gcr_gnupg_key_get_secret_dataset (key) == NULL);
 
-	g_object_unref (collection);
+	/* Test Number 2 (a secret key)*/
+	key = g_hash_table_lookup (test->keys, "268FEE686262C395");
+	g_assert (GCR_IS_GNUPG_KEY (key));
+	g_assert (_gcr_gnupg_key_get_secret_dataset (key));
 }
 
+static void
+test_reload (Test *test, gconstpointer unused)
+{
+	GError *error = NULL;
+	GcrGnupgKey *key;
+
+	_gcr_gnupg_collection_load_async (test->collection, NULL, on_async_ready, test);
+	egg_test_wait_until (500);
+	g_assert (test->result);
+	_gcr_gnupg_collection_load_finish (test->collection, test->result, &error);
+	g_assert_no_error (error);
+
+	g_object_unref (test->result);
+	test->result = NULL;
+
+	_gcr_gnupg_collection_load_async (test->collection, NULL, on_async_ready, test);
+	egg_test_wait_until (500);
+	g_assert (test->result);
+	_gcr_gnupg_collection_load_finish (test->collection, test->result, &error);
+	g_assert_no_error (error);
+
+	/* Werner Koch (a public key) */
+	key = g_hash_table_lookup (test->keys, "5DE249965B0358A2");
+	g_assert (GCR_IS_GNUPG_KEY (key));
+	g_assert (_gcr_gnupg_key_get_secret_dataset (key) == NULL);
+
+	/* Test Number 2 (a secret key)*/
+	key = g_hash_table_lookup (test->keys, "268FEE686262C395");
+	g_assert (GCR_IS_GNUPG_KEY (key));
+	g_assert (_gcr_gnupg_key_get_secret_dataset (key));
+}
 
 int
 main (int argc, char **argv)
@@ -68,15 +181,14 @@ main (int argc, char **argv)
 
 	g_type_init ();
 	g_test_init (&argc, &argv, NULL);
+	g_set_prgname ("test-gnupg-collection");
 
 	srcdir = g_getenv ("SRCDIR");
 	if (srcdir && chdir (srcdir) < 0)
 		g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
 
-	g_test_add_func ("/gcr/gnupg-collection/create", test_create);
-#if 0
-	g_test_add ("/gcr/certificate/issuer_dn", Test, NULL, setup, test_issuer_dn, teardown);
-#endif
+	g_test_add ("/gcr/gnupg-collection/load", Test, NULL, setup, test_load, teardown);
+	g_test_add ("/gcr/gnupg-collection/reload", Test, NULL, setup, test_reload, teardown);
 
-	return g_test_run ();
+	return egg_tests_run_in_thread_with_loop ();
 }
diff --git a/gcr/tests/test-gnupg-key.c b/gcr/tests/test-gnupg-key.c
index 5f1efac..409a3d8 100644
--- a/gcr/tests/test-gnupg-key.c
+++ b/gcr/tests/test-gnupg-key.c
@@ -30,10 +30,13 @@
 #include <glib.h>
 
 #include <errno.h>
+#include <stdlib.h>
 #include <string.h>
 
 typedef struct {
 	GPtrArray *dataset;
+	GPtrArray *pubset;
+	GPtrArray *secset;
 	GcrGnupgKey *key;
 } Test;
 
@@ -51,16 +54,34 @@ setup (Test *test, gconstpointer unused)
 	g_ptr_array_add (dataset, _gcr_colons_parse ("fpr:::::::::CF8BCC4B18DE08FCD8A1615906AD222CADF6A6E1:\n", -1));
 	g_ptr_array_add (dataset, _gcr_colons_parse ("sub:r:1536:20:5CE086B5B5A18FF4:899817788:1025961788:::::esc:\n", -1));
 	g_ptr_array_add (dataset, _gcr_colons_parse ("fpr:::::::::AB059359A3B81F410FCFF97F5CE086B5B5A18FF4:", -1));
-
-	test->key = _gcr_gnupg_key_new (dataset);
 	test->dataset = dataset;
+
+	test->key = _gcr_gnupg_key_new (dataset, NULL);
+
+	dataset = g_ptr_array_new_with_free_func (_gcr_colons_free);
+	g_ptr_array_add (dataset, _gcr_colons_parse ("pub:u:2048:1:4842D952AFC000FD:1305189489:::u:::scESC:", -1));
+	g_ptr_array_add (dataset, _gcr_colons_parse ("uid:u::::1305189849::D0A8FA7B15DC4BE3F8F03A49C372F2718C78AFC0::Dr. Strangelove <lovingbomb@example.com>:", -1));
+	g_ptr_array_add (dataset, _gcr_colons_parse ("uid:u::::1305189489::D449F1605254754B0BBFA424FC34E50609103BBB::Test Number 1 (unlimited) <test-number-1@example.com>:", -1));
+	g_ptr_array_add (dataset, _gcr_colons_parse ("sub:u:2048:1:4852132BBED15014:1305189489::::::e:", -1));
+	test->pubset = dataset;
+
+	dataset = g_ptr_array_new_with_free_func (_gcr_colons_free);
+	g_ptr_array_add (dataset, _gcr_colons_parse ("sec::2048:1:4842D952AFC000FD:1305189489::::::::::", -1));
+	g_ptr_array_add (dataset, _gcr_colons_parse ("uid:::::::D449F1605254754B0BBFA424FC34E50609103BBB::Test Number 1 (unlimited) <test-number-1@example.com>:", -1));
+	g_ptr_array_add (dataset, _gcr_colons_parse ("uid:::::::D0A8FA7B15DC4BE3F8F03A49C372F2718C78AFC0::Dr. Strangelove <lovingbomb@example.com>:", -1));
+	g_ptr_array_add (dataset, _gcr_colons_parse ("ssb::2048:1:4852132BBED15014:1305189489::::::::::", -1));
+	test->secset = dataset;
 }
 
 static void
 teardown (Test *test, gconstpointer unused)
 {
 	g_object_unref (test->key);
+	g_assert (!GCR_IS_GNUPG_KEY (test->key));
+
 	g_ptr_array_unref (test->dataset);
+	g_ptr_array_unref (test->pubset);
+	g_ptr_array_unref (test->secset);
 }
 
 static void
@@ -101,13 +122,27 @@ test_dataset (Test *test, gconstpointer unused)
 {
 	GPtrArray *dataset;
 
-	g_object_get (test->key, "dataset", &dataset, NULL);
+	g_object_get (test->key, "public-dataset", &dataset, NULL);
 	g_assert (dataset == test->dataset);
 
+	_gcr_gnupg_key_set_public_dataset (test->key, dataset);
+	g_assert (dataset == _gcr_gnupg_key_get_public_dataset (test->key));
+
 	g_ptr_array_unref (dataset);
 }
 
 static void
+test_keyid (Test *test, gconstpointer unused)
+{
+	gchar *keyid;
+
+	g_object_get (test->key, "keyid", &keyid, NULL);
+	g_assert_cmpstr (keyid, ==, "621CC013");
+
+	g_free (keyid);
+}
+
+static void
 test_keyid_for_colons (Test *test, gconstpointer unused)
 {
 	const gchar *keyid;
@@ -116,6 +151,48 @@ test_keyid_for_colons (Test *test, gconstpointer unused)
 	g_assert_cmpstr (keyid, ==, "6C7EE1B8621CC013");
 }
 
+static void
+test_with_secret (Test *test, gconstpointer unused)
+{
+	GcrGnupgKey *key;
+	GPtrArray *secset;
+
+	key = _gcr_gnupg_key_new (test->pubset, test->secset);
+	g_assert (GCR_IS_GNUPG_KEY (key));
+
+	g_object_get (key, "secret-dataset", &secset, NULL);
+	g_assert (secset == _gcr_gnupg_key_get_secret_dataset (key));
+	g_object_set (key, "secret-dataset", secset, NULL);
+
+	g_object_unref (key);
+}
+
+static void
+test_no_change_keyid (Test *test, gconstpointer unused)
+{
+	if (g_test_trap_fork (50000, G_TEST_TRAP_SILENCE_STDERR)) {
+		/* Changing the keyid. This should fail with a warning */
+		_gcr_gnupg_key_set_public_dataset (test->key, test->pubset);
+		exit (0);
+	}
+
+	g_test_trap_assert_failed ();
+	g_test_trap_assert_stderr ("*fingerprint is no longer the same:*");
+}
+
+static void
+test_secret_mismatched_keyid (Test *test, gconstpointer unused)
+{
+	if (g_test_trap_fork (50000, G_TEST_TRAP_SILENCE_STDERR)) {
+		/* Different keyid for secret part. This should fail with a warning */
+		_gcr_gnupg_key_set_secret_dataset (test->key, test->secset);
+		exit (0);
+	}
+
+	g_test_trap_assert_failed ();
+	g_test_trap_assert_stderr ("*pub and sec parts are not the same:*");
+}
+
 int
 main (int argc, char **argv)
 {
@@ -126,7 +203,11 @@ main (int argc, char **argv)
 	g_test_add ("/gcr/gnupg-key/description", Test, NULL, setup, test_description, teardown);
 	g_test_add ("/gcr/gnupg-key/markup", Test, NULL, setup, test_markup, teardown);
 	g_test_add ("/gcr/gnupg-key/dataset", Test, NULL, setup, test_dataset, teardown);
+	g_test_add ("/gcr/gnupg-key/keyid", Test, NULL, setup, test_keyid, teardown);
 	g_test_add ("/gcr/gnupg-key/keyid_for_colons", Test, NULL, setup, test_keyid_for_colons, teardown);
+	g_test_add ("/gcr/gnupg-key/with_secret", Test, NULL, setup, test_with_secret, teardown);
+	g_test_add ("/gcr/gnupg-key/no_change_keyid", Test, NULL, setup, test_no_change_keyid, teardown);
+	g_test_add ("/gcr/gnupg-key/secret_mismatched_keyid", Test, NULL, setup, test_secret_mismatched_keyid, teardown);
 
 	return g_test_run ();
 }
diff --git a/testing/gnupg-example/pubring.gpg b/testing/gnupg-example/pubring.gpg
new file mode 100644
index 0000000..10b1372
Binary files /dev/null and b/testing/gnupg-example/pubring.gpg differ
diff --git a/testing/gnupg-example/secring.gpg b/testing/gnupg-example/secring.gpg
new file mode 100644
index 0000000..4a21e26
Binary files /dev/null and b/testing/gnupg-example/secring.gpg differ
diff --git a/testing/gnupg-example/trustdb.gpg b/testing/gnupg-example/trustdb.gpg
new file mode 100644
index 0000000..c0ba085
Binary files /dev/null and b/testing/gnupg-example/trustdb.gpg differ
