RootCertificate Validator¶
certmonitor.validators.root_certificate_validator.RootCertificateValidator ¶
Bases: BaseCertValidator
A validator for checking if the SSL certificate is issued by a trusted root CA.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the validator. |
validate ¶
validate(cert: Dict[str, Any], host: str, port: int) -> Dict[str, Any]
Validates if the SSL certificate is issued by a trusted root CA.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cert
|
dict
|
The SSL certificate. |
required |
host
|
str
|
The hostname (not used in this validator). |
required |
port
|
int
|
The port number (not used in this validator). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
A dictionary containing the validation results, including whether the certificate is valid, and any warnings or reasons for validation failure. |
Examples:
Example output (success): This example shows a certificate that is signed by a trusted root CA, so validation passes and no warnings are present.
{
"is_valid": true,
"issuer": {
"commonName": "DigiCert Global G2 TLS RSA SHA256 2020 CA1",
"organizationName": "DigiCert Inc"
},
"warnings": []
}
Example output (failure): This example shows a certificate that is not signed by a trusted root CA, so validation fails and warnings are included.
{
"is_valid": false,
"issuer": {
"commonName": "Unknown",
"organizationName": "Unknown"
},
"warnings": [
"Certificate does not provide OCSP information.",
"Certificate does not provide caIssuers information.",
"Certificate is self-signed.",
"The certificate is issued by an untrusted root CA: Unknown (Unknown)"
]
}
Source code in certmonitor/validators/root_certificate_validator.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |