This class is responsible for parsing X509 certificates and returning an object that represents the relevant fields. The choice of formatting was originally defined, in part, on data structures returned by the Google Certificate Transparency project. This class supports both DER an
| 39 | |
| 40 | |
| 41 | class X509Parser(object): |
| 42 | """ |
| 43 | This class is responsible for parsing X509 certificates and returning an object that represents the relevant fields. |
| 44 | The choice of formatting was originally defined, in part, on data structures returned by the Google Certificate |
| 45 | Transparency project. |
| 46 | |
| 47 | This class supports both DER and PEM certificate formats. |
| 48 | |
| 49 | Certificates can be provided as a file location |
| 50 | |
| 51 | Certificate log IDs and URLs can be found here: https://source.chromium.org/chromium/chromium/src/+/main:components/certificate_transparency/data/log_list.json |
| 52 | """ |
| 53 | |
| 54 | _logger = None |
| 55 | |
| 56 | ## Constants for CT parsing |
| 57 | SCT_VERSION_V1 = 0 |
| 58 | TLSEXT_hash_none = 0 |
| 59 | TLSEXT_hash_md5 = 1 |
| 60 | TLSEXT_hash_sha1 = 2 |
| 61 | TLSEXT_hash_sha224 = 3 |
| 62 | TLSEXT_hash_sha256 = 4 |
| 63 | TLSEXT_hash_sha384 = 5 |
| 64 | TLSEXT_hash_sha512 = 6 |
| 65 | TLSEXT_hash_gostr3411 = 237 |
| 66 | TLSEXT_hash_gostr34112012_256 = 238 |
| 67 | TLSEXT_hash_gostr34112012_512 = 239 |
| 68 | |
| 69 | TLSEXT_signature_anonymous = 0 |
| 70 | TLSEXT_signature_rsa = 1 |
| 71 | TLSEXT_signature_dsa = 2 |
| 72 | TLSEXT_signature_ecdsa = 3 |
| 73 | TLSEXT_signature_gostr34102001 = 237 |
| 74 | TLSEXT_signature_gostr34102012_256 = 238 |
| 75 | TLSEXT_signature_gostr34102012_512 = 239 |
| 76 | |
| 77 | ## This list needs to be periodically updated |
| 78 | CT_LOG_MAP = { |
| 79 | # Google - [ReadOnly] |
| 80 | "aviator": { |
| 81 | "id": "aPaY+B9kgr46jO65KB1M/HFRXWeT1ETRCmesu09P+8Q=", |
| 82 | "url": "ct.googleapis.com/aviator", |
| 83 | }, |
| 84 | |
| 85 | "icarus": { |
| 86 | "id": "KTxRllTIOWW6qlD8WAfUt2+/WHopctykwwz05UVH9Hg=", |
| 87 | "url": "ct.googleapis.com/icarus", |
| 88 | }, |
| 89 | "pilot": { |
| 90 | "id": "pLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BA=", |
| 91 | "url": "ct.googleapis.com/pilot", |
| 92 | }, |
| 93 | "rocketeer": { |
| 94 | "id": "7ku9t3XOYLrhQmkfq+GeZqMPfl+wctiDAMR7iXqo/cs=", |
| 95 | "url": "ct.googleapis.com/rocketeer", |
| 96 | }, |
| 97 | "skydiver": { |
| 98 | "id": "u9nfvB+KcbWTlCOXqpJ7RzhXlQqrUugakJZkNo4e0YU=", |
nothing calls this directly
no outgoing calls
no test coverage detected