(c)
| 819 | |
| 820 | |
| 821 | def 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 | |
| 846 | def split_subjectAltName_string(subjectAltName): |
no test coverage detected