Merge pull request #2 from kevgliss/hotfix/CertName

Fixes issue where the issuer has special chars in the name.
This commit is contained in:
kevgliss 2015-06-25 13:56:37 -07:00
commit 51c83abc34
1 changed files with 3 additions and 1 deletions

View File

@ -116,8 +116,10 @@ def cert_get_issuer(cert):
:param cert:
:return: Issuer
"""
delchars = ''.join(c for c in map(chr, range(256)) if not c.isalnum())
try:
return cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATION_NAME)[0].value
issuer = str(cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATION_NAME)[0].value)
return issuer.translate(None, delchars)
except Exception as e:
current_app.logger.error("Unable to get issuer! {0}".format(e))