mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
Format certificate dates (red if invalid)
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@153 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
e96dbf3046
commit
7fdf15013f
@ -13,6 +13,7 @@ import java.security.Principal;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Accept certificate dialog
|
||||
@ -55,7 +56,7 @@ public class AcceptCertificateDialog extends JDialog {
|
||||
}
|
||||
builder.append(serial.charAt(i));
|
||||
}
|
||||
return builder.toString();
|
||||
return builder.toString().toUpperCase();
|
||||
}
|
||||
|
||||
public AcceptCertificateDialog(X509Certificate certificate) {
|
||||
@ -82,8 +83,17 @@ public class AcceptCertificateDialog extends JDialog {
|
||||
subjectPanel.setBorder(BorderFactory.createTitledBorder("Server Certificate"));
|
||||
addFieldValue(subjectPanel, "Issued to", getRDN(certificate.getSubjectDN()));
|
||||
addFieldValue(subjectPanel, "Issued by", getRDN(certificate.getIssuerDN()));
|
||||
addFieldValue(subjectPanel, "Valid from", formatter.format(certificate.getNotBefore()));
|
||||
addFieldValue(subjectPanel, "Valid until", formatter.format(certificate.getNotAfter()));
|
||||
Date now = new Date();
|
||||
String notBefore = formatter.format(certificate.getNotBefore());
|
||||
if (now.before(certificate.getNotBefore())) {
|
||||
notBefore = "<html><font color=\"#FF0000\">"+notBefore+"</font></html>";
|
||||
}
|
||||
addFieldValue(subjectPanel, "Valid from", notBefore);
|
||||
String notAfter = formatter.format(certificate.getNotAfter());
|
||||
if (now.after(certificate.getNotAfter())) {
|
||||
notAfter = "<html><font color=\"#FF0000\">"+notAfter+"</font></html>";
|
||||
}
|
||||
addFieldValue(subjectPanel, "Valid until", notAfter);
|
||||
addFieldValue(subjectPanel, "Serial", getFormattedSerial(certificate));
|
||||
addFieldValue(subjectPanel, "FingerPrint", sha1Hash);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user