Create a certificate signed by this CA for the given domains. :returns: the certificate and private key PEM file paths
(spec: CertificateSpec, issuer: Credentials, key_type: Any,
valid_from: timedelta = timedelta(days=-1),
valid_to: timedelta = timedelta(days=89),
serial: Optional[int] = None,
)
| 288 | |
| 289 | @staticmethod |
| 290 | def create_credentials(spec: CertificateSpec, issuer: Credentials, key_type: Any, |
| 291 | valid_from: timedelta = timedelta(days=-1), |
| 292 | valid_to: timedelta = timedelta(days=89), |
| 293 | serial: Optional[int] = None, |
| 294 | ) -> Credentials: |
| 295 | """Create a certificate signed by this CA for the given domains. |
| 296 | :returns: the certificate and private key PEM file paths |
| 297 | """ |
| 298 | if spec.domains and len(spec.domains): |
| 299 | creds = HttpdTestCA._make_server_credentials(name=spec.name, domains=spec.domains, |
| 300 | issuer=issuer, valid_from=valid_from, |
| 301 | valid_to=valid_to, key_type=key_type, |
| 302 | serial=serial) |
| 303 | elif spec.client: |
| 304 | creds = HttpdTestCA._make_client_credentials(name=spec.name, issuer=issuer, |
| 305 | email=spec.email, valid_from=valid_from, |
| 306 | valid_to=valid_to, key_type=key_type, |
| 307 | serial=serial) |
| 308 | elif spec.name: |
| 309 | creds = HttpdTestCA._make_ca_credentials(name=spec.name, issuer=issuer, |
| 310 | valid_from=valid_from, valid_to=valid_to, |
| 311 | key_type=key_type, |
| 312 | serial=serial) |
| 313 | else: |
| 314 | raise Exception(f"unrecognized certificate specification: {spec}") |
| 315 | return creds |
| 316 | |
| 317 | @staticmethod |
| 318 | def _make_x509_name(org_name: str = None, common_name: str = None, parent: x509.Name = None) -> x509.Name: |
no test coverage detected