Browse Source

x509: show cert expiration date in error

related #5292
regtest_lnd
SomberNight 6 years ago
parent
commit
7bea1cce1f
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 4
      electrum/x509.py

4
electrum/x509.py

@ -25,6 +25,7 @@
import hashlib
import time
from datetime import datetime
import ecdsa
@ -304,7 +305,8 @@ class X509(object):
if self.notBefore > now:
raise CertificateError('Certificate has not entered its valid date range. (%s)' % self.get_common_name())
if self.notAfter <= now:
raise CertificateError('Certificate has expired. (%s)' % self.get_common_name())
dt = datetime.utcfromtimestamp(time.mktime(self.notAfter))
raise CertificateError(f'Certificate ({self.get_common_name()}) has expired (at {dt} UTC).')
def getFingerprint(self):
return hashlib.sha1(self.bytes).digest()

Loading…
Cancel
Save