tx509: show cert expiration date in error - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 7bea1cce1fbb0e0a502288b381ce12fbc1e93dd7 DIR parent 7584cebbe32055a2455d448b436c7af470428e2a HTML Author: SomberNight <somber.night@protonmail.com> Date: Fri, 26 Apr 2019 01:55:58 +0200 x509: show cert expiration date in error related #5292 Diffstat: M electrum/x509.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/x509.py b/electrum/x509.py t@@ -25,6 +25,7 @@ import hashlib import time +from datetime import datetime import ecdsa t@@ -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()