Properly handle certs with no extensions.

This commit is contained in:
Lance Stout 2012-06-11 08:28:02 -07:00
parent 4cc20fdd05
commit 534aaf2b2a

View file

@ -42,7 +42,7 @@ def extract_names(raw_cert):
cert = decoder.decode(raw_cert, asn1Spec=Certificate())[0] cert = decoder.decode(raw_cert, asn1Spec=Certificate())[0]
tbs = cert.getComponentByName('tbsCertificate') tbs = cert.getComponentByName('tbsCertificate')
subject = tbs.getComponentByName('subject') subject = tbs.getComponentByName('subject')
extensions = tbs.getComponentByName('extensions') extensions = tbs.getComponentByName('extensions') or []
# Extract the CommonName(s) from the cert. # Extract the CommonName(s) from the cert.
for rdnss in subject: for rdnss in subject: