diff --git a/e-util/e-source-config.c b/e-util/e-source-config.c
index aacb48d..c5585a3 100644
--- a/e-util/e-source-config.c
+++ b/e-util/e-source-config.c
@@ -1352,6 +1352,14 @@ secure_to_port_cb (GBinding *binding,
 	return TRUE;
 }
 
+static void
+webdav_unset_ssl_trust_clicked_cb (GtkWidget *button,
+				   ESourceWebdav *extension)
+{
+	gtk_widget_set_sensitive (button, FALSE);
+	e_source_webdav_set_ssl_trust (extension, NULL);
+}
+
 void
 e_source_config_add_secure_connection_for_webdav (ESourceConfig *config,
                                                   ESource *scratch_source)
@@ -1361,7 +1369,7 @@ e_source_config_add_secure_connection_for_webdav (ESourceConfig *config,
 	ESourceExtension *extension;
 	ESourceAuthentication *authentication_extension;
 	const gchar *extension_name;
-	const gchar *label;
+	const gchar *label, *ssl_trust;
 
 	g_return_if_fail (E_IS_SOURCE_CONFIG (config));
 	g_return_if_fail (E_IS_SOURCE (scratch_source));
@@ -1393,22 +1401,15 @@ e_source_config_add_secure_connection_for_webdav (ESourceConfig *config,
 	extension_name = E_SOURCE_EXTENSION_WEBDAV_BACKEND;
 	extension = e_source_get_extension (scratch_source, extension_name);
 
-	label = _("Ignore invalid SSL certificate");
-	widget2 = gtk_check_button_new_with_label (label);
+	widget2 = gtk_button_new_with_mnemonic (_("Unset _trust for SSL certificate"));
 	gtk_widget_set_margin_left (widget2, 24);
 	e_source_config_insert_widget (config, scratch_source, NULL, widget2);
 	gtk_widget_show (widget2);
 
-	g_object_bind_property (
-		widget1, "active",
-		widget2, "sensitive",
-		G_BINDING_SYNC_CREATE);
+	ssl_trust = e_source_webdav_get_ssl_trust (E_SOURCE_WEBDAV (extension));
 
-	g_object_bind_property (
-		extension, "ignore-invalid-cert",
-		widget2, "active",
-		G_BINDING_BIDIRECTIONAL |
-		G_BINDING_SYNC_CREATE);
+	gtk_widget_set_sensitive (widget2, ssl_trust && *ssl_trust);
+	g_signal_connect (widget2, "clicked", G_CALLBACK (webdav_unset_ssl_trust_clicked_cb), extension);
 }
 
 void
diff --git a/modules/cal-config-caldav/e-caldav-chooser.c b/modules/cal-config-caldav/e-caldav-chooser.c
index 8bb5fae..9674f00 100644
--- a/modules/cal-config-caldav/e-caldav-chooser.c
+++ b/modules/cal-config-caldav/e-caldav-chooser.c
@@ -337,20 +337,6 @@ static void
 caldav_chooser_configure_session (ECaldavChooser *chooser,
                                   SoupSession *session)
 {
-	ESource *source;
-	ESourceWebdav *extension;
-	const gchar *extension_name;
-
-	source = e_caldav_chooser_get_source (chooser);
-	extension_name = E_SOURCE_EXTENSION_WEBDAV_BACKEND;
-	extension = e_source_get_extension (source, extension_name);
-
-	g_object_bind_property (
-		extension, "ignore-invalid-cert",
-		session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE,
-		G_BINDING_SYNC_CREATE |
-		G_BINDING_INVERT_BOOLEAN);
-
 	if (g_getenv ("CALDAV_DEBUG") != NULL) {
 		SoupLogger *logger;
 
@@ -1306,6 +1292,35 @@ caldav_chooser_try_password_cancelled_cb (GCancellable *cancellable,
 	soup_session_abort (session);
 }
 
+static ETrustPromptResponse
+trust_prompt_sync (const ENamedParameters *parameters,
+		   GCancellable *cancellable,
+		   GError **error)
+{
+	EUserPrompter *prompter;
+	gint response;
+
+	g_return_val_if_fail (parameters != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
+
+	prompter = e_user_prompter_new ();
+	g_return_val_if_fail (prompter != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
+
+	response = e_user_prompter_extension_prompt_sync (prompter, "ETrustPrompt::trust-prompt", parameters, NULL, cancellable, error);
+
+	g_object_unref (prompter);
+
+	if (response == 0)
+		return E_TRUST_PROMPT_RESPONSE_REJECT;
+	if (response == 1)
+		return E_TRUST_PROMPT_RESPONSE_ACCEPT;
+	if (response == 2)
+		return E_TRUST_PROMPT_RESPONSE_ACCEPT_TEMPORARILY;
+	if (response == -1)
+		return E_TRUST_PROMPT_RESPONSE_REJECT_TEMPORARILY;
+
+	return E_TRUST_PROMPT_RESPONSE_UNKNOWN;
+}
+
 static ESourceAuthenticationResult
 caldav_chooser_try_password_sync (ESourceAuthenticator *auth,
                                   const GString *password,
@@ -1356,7 +1371,32 @@ caldav_chooser_try_password_sync (ESourceAuthenticator *auth,
 			g_object_ref (session),
 			(GDestroyNotify) g_object_unref);
 
-	soup_session_send_message (session, message);
+	g_object_set (session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, NULL);
+	g_object_set (chooser->priv->session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, NULL);
+
+	if (soup_session_send_message (session, message) == SOUP_STATUS_SSL_FAILED) {
+		ETrustPromptResponse response;
+		ENamedParameters *parameters;
+
+		parameters = e_named_parameters_new ();
+
+		response = e_source_webdav_prepare_ssl_trust_prompt (extension, message, parameters);
+		if (response == E_TRUST_PROMPT_RESPONSE_UNKNOWN) {
+			response = trust_prompt_sync (parameters, cancellable, NULL);
+			if (response != E_TRUST_PROMPT_RESPONSE_UNKNOWN)
+				e_source_webdav_store_ssl_trust_prompt (extension, message, response);
+		}
+
+		e_named_parameters_free (parameters);
+
+		if (response == E_TRUST_PROMPT_RESPONSE_ACCEPT ||
+		    response == E_TRUST_PROMPT_RESPONSE_ACCEPT_TEMPORARILY) {
+			g_object_set (session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, FALSE, NULL);
+			g_object_set (chooser->priv->session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, FALSE, NULL);
+			soup_session_send_message (session, message);
+		}
+	}
+	
 
 	if (cancel_id > 0)
 		g_cancellable_disconnect (cancellable, cancel_id);
