Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit 65db8c3

Browse files
committed
Remove two-digit-year variants from certificate validity date decoding. Fixes Issue #461
1 parent 285495d commit 65db8c3

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

sleekxmpp/xmlstream/cert.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,11 @@ def extract_dates(raw_cert):
108108

109109
not_before = validity.getComponentByName('notBefore')
110110
not_before = str(not_before.getComponent())
111+
not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
111112

112113
not_after = validity.getComponentByName('notAfter')
113114
not_after = str(not_after.getComponent())
114-
115-
if isinstance(not_before, GeneralizedTime):
116-
not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
117-
else:
118-
not_before = datetime.strptime(not_before, '%y%m%d%H%M%SZ')
119-
120-
if isinstance(not_after, GeneralizedTime):
121-
not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
122-
else:
123-
not_after = datetime.strptime(not_after, '%y%m%d%H%M%SZ')
115+
not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
124116

125117
return not_before, not_after
126118

0 commit comments

Comments
 (0)