MCPcopy Index your code
hub / github.com/USArmyResearchLab/Dshell / openSSL_cert_to_info_dictionary

Function openSSL_cert_to_info_dictionary

dshell/plugins/ssl/tls.py:821–843  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

819
820
821def openSSL_cert_to_info_dictionary(c):
822 d = {'fingerprints': {}}
823 for h in ('md5', 'sha1', 'sha256'):
824 d['fingerprints'][h] = c.digest(h).decode('utf-8')
825
826 d['subject'] = render_x509_object(c.get_subject())
827 d['subject_cn'] = c.get_subject().CN
828 d['issuer'] = render_x509_object(c.get_issuer())
829 d['notAfter'] = parse_x509_dtm(c.get_notAfter())
830 d['notBefore'] = parse_x509_dtm(c.get_notBefore())
831 #
832 # Look for subjectAltName
833 #
834 for i in range(0, c.get_extension_count()):
835 ext = c.get_extension(i)
836 if ext.get_short_name() == b'subjectAltName':
837 d['subjectAltName'] = str(ext)
838 public_key = c.get_pubkey()
839 d['pubkey_bits'] = public_key.bits()
840 d['pubkey_type'] = keyTypeToString(public_key.type())
841 d['pubkey_sha1'] = hashlib.sha1(OpenSSL.crypto.dump_publickey(
842 OpenSSL.crypto.FILETYPE_ASN1, public_key)).hexdigest()
843 return d
844
845
846def split_subjectAltName_string(subjectAltName):

Callers 1

connection_handlerMethod · 0.85

Calls 3

render_x509_objectFunction · 0.85
parse_x509_dtmFunction · 0.85
keyTypeToStringFunction · 0.85

Tested by

no test coverage detected