diff --git a/libmproxy/certutils.py b/libmproxy/certutils.py index f393648d4..95dcc0fef 100644 --- a/libmproxy/certutils.py +++ b/libmproxy/certutils.py @@ -1,4 +1,4 @@ -import os, ssl, hashlib, socket, time +import os, ssl, hashlib, socket, time, datetime from pyasn1.type import univ, constraint, char, namedtype, tag from pyasn1.codec.der.decoder import decode import OpenSSL @@ -157,11 +157,13 @@ class SSLCert: @property def notbefore(self): - return self.cert.get_notBefore() + t = self.cert.get_notBefore() + return datetime.datetime.strptime(t, "%Y%m%d%H%M%SZ") @property def notafter(self): - return self.cert.get_notAfter() + t = self.cert.get_notAfter() + return datetime.datetime.strptime(t, "%Y%m%d%H%M%SZ") @property def has_expired(self): diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py index 6c5e7fe20..e589d01df 100644 --- a/libmproxy/console/flowdetailview.py +++ b/libmproxy/console/flowdetailview.py @@ -55,8 +55,8 @@ class FlowDetailsView(urwid.ListBox): text.append(urwid.Text([("head", "Server Certificate:")])) parts = [ ["Type", "%s, %s bits"%c.keyinfo], - ["Valid to", c.notafter], - ["Valid from", c.notbefore], + ["Valid to", str(c.notafter)], + ["Valid from", str(c.notbefore)], ["Serial", str(c.serial)], ]