Index: smime/lib/e-cert-db.c
===================================================================
--- smime/lib/e-cert-db.c	(revision 37529)
+++ smime/lib/e-cert-db.c	(working copy)
@@ -156,7 +156,7 @@
 static void
 initialize_nss (void)
 {
-	char *evolution_dir_path;
+	char *evolution_dir_path, *nss_configstr;
 	gboolean success;
 
 #ifdef G_OS_WIN32
@@ -166,18 +166,39 @@
 	evolution_dir_path = g_strdup (e_get_user_data_dir ());
 #endif
 
+#if NSS_VMAJOR > 3 || (NSS_VMAJOR == 3 && NSS_VMINOR >= 12)
+	nss_configstr = g_strconcat("sql:", evolution_dir_path, NULL);
+
 	/* we initialize NSS here to make sure it only happens once */
-	success = (SECSuccess == NSS_InitReadWrite (evolution_dir_path));
+        /* See: https://wiki.mozilla.org/NSS_Shared_DB 
+         * particularly "Mode 3A" */
+	success = (
+		NSS_InitWithMerge ( nss_configstr, /* Dest dir */
+                                        "", "", /* NEw DB key and cert name prefixes */
+                                        "secmod.db", /* Secmod name */
+                                        evolution_dir_path, /* Old DB dir */
+                                        "", "", /* Old DB key and cert db name prefixes */
+                                        evolution_dir_path, /* Unique ID for old DB */
+                                        "Evolution S/MIME", /* UI name for old DB */
+                                        0 /* Flags */
+                                        ) == SECSuccess
+		);
+
+#else
+	nss_configstr = g_strdup(evolution_dir_path);
+	success = (SECSuccess == NSS_InitReadWrite (nss_configstr));
+#endif
 	if (!success) {
-		success = (SECSuccess == NSS_Init (evolution_dir_path));
+		success = (SECSuccess == NSS_Init (nss_configstr));
 		if (success)
 			g_warning ("opening cert databases read-only");
 	}
 	if (!success) {
-		success = (SECSuccess == NSS_NoDB_Init (evolution_dir_path));
+		success = (SECSuccess == NSS_NoDB_Init (nss_configstr));
 		if (success)
 			g_warning ("initializing security library without cert databases.");
 	}
+	g_free(nss_configstr);
 	g_free (evolution_dir_path);
 
 	if (!success) {
