| 530 | |
| 531 | @classmethod |
| 532 | def from_files( |
| 533 | cls, ca_file: Path, dhparam_file: Path, passphrase: bytes | None = None |
| 534 | ) -> "CertStore": |
| 535 | raw = ca_file.read_bytes() |
| 536 | key = load_pem_private_key(raw, passphrase) |
| 537 | dh = cls.load_dhparam(dhparam_file) |
| 538 | certs = x509.load_pem_x509_certificates(raw) |
| 539 | ca = Cert(certs[0]) |
| 540 | crl = dummy_crl(key, ca._cert) |
| 541 | if len(certs) > 1: |
| 542 | chain_file: Path | None = ca_file |
| 543 | else: |
| 544 | chain_file = None |
| 545 | return cls(key, ca, chain_file, crl, dh) |
| 546 | |
| 547 | @staticmethod |
| 548 | @contextlib.contextmanager |