From 65db8c39dd57e691c89b491afb6aa22f6bc05eff Mon Sep 17 00:00:00 2001 From: "bear (Mike Taylor)" Date: Sat, 2 Sep 2017 13:51:42 -0400 Subject: [PATCH] Remove two-digit-year variants from certificate validity date decoding. Fixes Issue #461 --- sleekxmpp/xmlstream/cert.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sleekxmpp/xmlstream/cert.py b/sleekxmpp/xmlstream/cert.py index d357b326c..ae82cac83 100644 --- a/sleekxmpp/xmlstream/cert.py +++ b/sleekxmpp/xmlstream/cert.py @@ -108,19 +108,11 @@ def extract_dates(raw_cert): not_before = validity.getComponentByName('notBefore') not_before = str(not_before.getComponent()) + not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ') not_after = validity.getComponentByName('notAfter') not_after = str(not_after.getComponent()) - - if isinstance(not_before, GeneralizedTime): - not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ') - else: - not_before = datetime.strptime(not_before, '%y%m%d%H%M%SZ') - - if isinstance(not_after, GeneralizedTime): - not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ') - else: - not_after = datetime.strptime(not_after, '%y%m%d%H%M%SZ') + not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ') return not_before, not_after