drop redundant md5 fingerprint; more clearly indicate expired sigs
authorPaul <paul@claws-mail.org>
Wed, 7 Nov 2018 10:33:06 +0000 (10:33 +0000)
committerPaul <paul@claws-mail.org>
Wed, 7 Nov 2018 10:33:06 +0000 (10:33 +0000)
src/gtk/sslcertwindow.c

index 70cc4f9..cb3ce4c 100644 (file)
@@ -63,7 +63,7 @@ static GtkWidget *cert_presenter(SSLCertificate *cert)
        char *issuer_commonname, *issuer_location, *issuer_organization;
        char *subject_commonname, *subject_location, *subject_organization;
        char *sig_status, *exp_date;
        char *issuer_commonname, *issuer_location, *issuer_organization;
        char *subject_commonname, *subject_location, *subject_organization;
        char *sig_status, *exp_date;
-       char *md5_fingerprint, *sha1_fingerprint, *sha256_fingerprint, *fingerprint;
+       char *sha1_fingerprint, *sha256_fingerprint, *fingerprint;
        size_t n;
        char buf[100];
        unsigned char md[128];  
        size_t n;
        char buf[100];
        unsigned char md[128];  
@@ -144,12 +144,8 @@ static GtkWidget *cert_presenter(SSLCertificate *cert)
 
        /* fingerprint */
        n = 128;
 
        /* fingerprint */
        n = 128;
-       gnutls_x509_crt_get_fingerprint(cert->x509_cert, GNUTLS_DIG_MD5, md, &n);
-       md5_fingerprint = readable_fingerprint(md, (int)n);
-       n = 128;
        gnutls_x509_crt_get_fingerprint(cert->x509_cert, GNUTLS_DIG_SHA1, md, &n);
        sha1_fingerprint = readable_fingerprint(md, (int)n);
        gnutls_x509_crt_get_fingerprint(cert->x509_cert, GNUTLS_DIG_SHA1, md, &n);
        sha1_fingerprint = readable_fingerprint(md, (int)n);
-       n = 128;
        gnutls_x509_crt_get_fingerprint(cert->x509_cert, GNUTLS_DIG_SHA256, md, &n);
        sha256_fingerprint = readable_fingerprint(md, (int)n);
 
        gnutls_x509_crt_get_fingerprint(cert->x509_cert, GNUTLS_DIG_SHA256, md, &n);
        sha256_fingerprint = readable_fingerprint(md, (int)n);
 
@@ -158,7 +154,9 @@ static GtkWidget *cert_presenter(SSLCertificate *cert)
        sig_status = ssl_certificate_check_signer(cert, cert->status);
 
        if (sig_status==NULL)
        sig_status = ssl_certificate_check_signer(cert, cert->status);
 
        if (sig_status==NULL)
-               sig_status = g_strdup(_("Correct"));
+               sig_status = g_strdup_printf(_("Correct%s"),exp_time_t < time(NULL)? _(" (expired)"): "");
+       else if (exp_time_t < time(NULL))
+                         sig_status = g_strconcat(sig_status,_(" (expired)"),NULL);
 
        vbox = gtk_vbox_new(FALSE, 5);
        hbox = gtk_hbox_new(FALSE, 5);
 
        vbox = gtk_vbox_new(FALSE, 5);
        hbox = gtk_hbox_new(FALSE, 5);
@@ -222,8 +220,8 @@ static GtkWidget *cert_presenter(SSLCertificate *cert)
        label = gtk_label_new(_("Fingerprint: \n"));
        gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
        gtk_table_attach(status_table, label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
        label = gtk_label_new(_("Fingerprint: \n"));
        gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
        gtk_table_attach(status_table, label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
-       fingerprint = g_strdup_printf("MD5: %s\nSHA1: %s\nSHA256: %s",
-                       md5_fingerprint, sha1_fingerprint, sha256_fingerprint);
+       fingerprint = g_strdup_printf("SHA1: %s\nSHA256: %s",
+                                     sha1_fingerprint, sha256_fingerprint);
        label = gtk_label_new(fingerprint);
        g_free(fingerprint);
        gtk_label_set_selectable(GTK_LABEL(label), TRUE);
        label = gtk_label_new(fingerprint);
        g_free(fingerprint);
        gtk_label_set_selectable(GTK_LABEL(label), TRUE);
@@ -236,7 +234,7 @@ static GtkWidget *cert_presenter(SSLCertificate *cert)
        gtk_label_set_selectable(GTK_LABEL(label), TRUE);
        gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
        gtk_table_attach(status_table, label, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
        gtk_label_set_selectable(GTK_LABEL(label), TRUE);
        gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
        gtk_table_attach(status_table, label, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
-       label = gtk_label_new(_("Expires on: "));
+       label = gtk_label_new(exp_time_t < time(NULL)? _("Expired on: "): _("Expires on: "));
        gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
        gtk_table_attach(status_table, label, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
        label = gtk_label_new(exp_date);
        gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
        gtk_table_attach(status_table, label, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
        label = gtk_label_new(exp_date);
@@ -261,7 +259,6 @@ static GtkWidget *cert_presenter(SSLCertificate *cert)
        g_free(subject_commonname);
        g_free(subject_location);
        g_free(subject_organization);
        g_free(subject_commonname);
        g_free(subject_location);
        g_free(subject_organization);
-       g_free(md5_fingerprint);
        g_free(sha1_fingerprint);
        g_free(sha256_fingerprint);
        g_free(sig_status);
        g_free(sha1_fingerprint);
        g_free(sha256_fingerprint);
        g_free(sig_status);