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),
)
| 248 | |
| 249 | @staticmethod |
| 250 | def create_credentials(spec: CertificateSpec, issuer: Credentials, key_type: Any, |
| 251 | valid_from: timedelta = timedelta(days=-1), |
| 252 | valid_to: timedelta = timedelta(days=89), |
| 253 | ) -> Credentials: |
| 254 | """Create a certificate signed by this CA for the given domains. |
| 255 | :returns: the certificate and private key PEM file paths |
| 256 | """ |
| 257 | if spec.domains and len(spec.domains): |
| 258 | creds = MDTestCA._make_server_credentials(name=spec.name, domains=spec.domains, |
| 259 | issuer=issuer, valid_from=valid_from, |
| 260 | valid_to=valid_to, key_type=key_type) |
| 261 | elif spec.client: |
| 262 | creds = MDTestCA._make_client_credentials(name=spec.name, issuer=issuer, |
| 263 | email=spec.email, valid_from=valid_from, |
| 264 | valid_to=valid_to, key_type=key_type) |
| 265 | elif spec.name: |
| 266 | creds = MDTestCA._make_ca_credentials(name=spec.name, issuer=issuer, |
| 267 | valid_from=valid_from, valid_to=valid_to, |
| 268 | key_type=key_type) |
| 269 | else: |
| 270 | raise Exception(f"unrecognized certificate specification: {spec}") |
| 271 | return creds |
| 272 | |
| 273 | @staticmethod |
| 274 | def _make_x509_name(org_name: str = None, common_name: str = None, parent: x509.Name = None) -> x509.Name: |
no test coverage detected