adji

Adji's a Decisive and Joyful Internet browser
git clone https://noxz.tech/git/adji.git
Log | Files | Tags | LICENSE

commit: ca033900b0bd276d7c4b758b8bff5807f6af8957
parent: 43854af6415d743f4b94639ce1d58288f7f458c3
author: Chris Noxz <chris@noxz.tech>
date:   Sun, 1 Oct 2023 16:05:55 +0200
show more info on tls error page
Mbrowser.c20+++++++++++++++++++-
Mbrowser.h3++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/browser.c b/browser.c
@@ -945,7 +945,13 @@ render_tls_error(struct Client                 *c,
 {
 	GString                *m = NULL;           /* message (error) */
 	gchar                  *h = NULL,           /* html code */
+	                       *s = NULL,           /* subject name */
+	                       *i = NULL,           /* issuer name */
+	                       *b = NULL,           /* not before date */
+	                       *a = NULL,           /* not after date */
 	                       *p = NULL;           /* pem block */
+	GDateTime              *bd = NULL,          /* not before date */
+	                       *ad = NULL;          /* not after date */
 
 	m                       = g_string_new(NULL);
 	c->failed_crt           = g_object_ref(crt);
@@ -969,13 +975,25 @@ render_tls_error(struct Client                 *c,
 		g_string_append(m, MSG_TLS_CERTIFICATE_GENERIC_ERROR);
 
 	/* construct html code and load it */
+	g_object_get(crt, "subject-name", &s, NULL);
+	g_object_get(crt, "issuer-name", &i, NULL);
+	g_object_get(crt, "not-valid-before", &bd, NULL);
+	g_object_get(crt, "not-valid-after", &ad, NULL);
 	g_object_get(crt, "certificate-pem", &p, NULL);
-	h = g_strdup_printf(TLS_MSG_FORMAT, uri, m->str, p);
+	b = g_date_time_format_iso8601(bd);
+	a = g_date_time_format_iso8601(ad);
+	h = g_strdup_printf(TLS_MSG_FORMAT, uri, m->str, s, i, b, a, p);
 	webkit_web_view_load_alternate_html(WEBKIT_WEB_VIEW(c->wv), h, uri, NULL);
 
 	g_string_free(m, TRUE);
 	g_free(h);
+	g_free(s);
+	g_free(i);
+	g_free(a);
+	g_free(b);
 	g_free(p);
+	g_date_time_unref(ad);
+	g_date_time_unref(bd);
 }
 
 void
diff --git a/browser.h b/browser.h
@@ -59,7 +59,8 @@
 #define WV_GET_URI(X)       webkit_web_view_get_uri(WEBKIT_WEB_VIEW((X)))
 
 #define TLS_MSG_FORMAT      "<h2>Could not validate TLS for: %s</h2><pre>%s"   \
-                            "</pre><pre>%s</pre>"
+                            "</pre><pre>s:%s\ni:%s\nv:NotBefore:%s; NotAfter:" \
+                            "%s</pre><pre>%s</pre>"
 #define MSG_TLS_CERTIFICATE_UNKNOWN_CA                                         \
                             ">  The signing certificate authority is not known"\
                             ".<br>"