Return a datetime object from SSLCert notbefore and notafter properties.
This commit is contained in:
parent
c6896d7392
commit
b9737ed89e
|
@ -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):
|
||||
|
|
|
@ -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)],
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue