(self, spec: CertificateSpec, chain: List['Credentials'] = None)
| 159 | return [self.issue_cert(spec=spec, chain=chain) for spec in specs] |
| 160 | |
| 161 | def issue_cert(self, spec: CertificateSpec, chain: List['Credentials'] = None) -> 'Credentials': |
| 162 | key_type = spec.key_type if spec.key_type else self.key_type |
| 163 | creds = None |
| 164 | if self._store: |
| 165 | creds = self._store.load_credentials( |
| 166 | name=spec.name, key_type=key_type, single_file=spec.single_file, issuer=self) |
| 167 | if creds is None: |
| 168 | creds = HttpdTestCA.create_credentials(spec=spec, issuer=self, key_type=key_type, |
| 169 | valid_from=spec.valid_from, valid_to=spec.valid_to) |
| 170 | if self._store: |
| 171 | self._store.save(creds, single_file=spec.single_file) |
| 172 | if spec.type == "ca": |
| 173 | self._store.save_chain(creds, "ca", with_root=True) |
| 174 | |
| 175 | if spec.sub_specs: |
| 176 | if self._store: |
| 177 | sub_store = CertStore(fpath=os.path.join(self._store.path, creds.name)) |
| 178 | creds.set_store(sub_store) |
| 179 | subchain = chain.copy() if chain else [] |
| 180 | subchain.append(self) |
| 181 | creds.issue_certs(spec.sub_specs, chain=subchain) |
| 182 | return creds |
| 183 | |
| 184 | def save_cert_pem(self, fpath): |
| 185 | with open(fpath, "wb") as fd: |
no test coverage detected