MCPcopy Create free account
hub / github.com/apache/httpd / save

Method save

test/pyhttpd/certs.py:205–224  ·  view source on GitHub ↗
(self, creds: Credentials, name: str = None,
             chain: List[Credentials] = None,
             single_file: bool = False)

Source from the content-addressed store, hash-verified

203 return self._store_dir
204
205 def save(self, creds: Credentials, name: str = None,
206 chain: List[Credentials] = None,
207 single_file: bool = False) -> None:
208 name = name if name is not None else creds.name
209 cert_file = self.get_cert_file(name=name, key_type=creds.key_type)
210 pkey_file = self.get_pkey_file(name=name, key_type=creds.key_type)
211 if single_file:
212 pkey_file = None
213 with open(cert_file, "wb") as fd:
214 fd.write(creds.cert_pem)
215 if chain:
216 for c in chain:
217 fd.write(c.cert_pem)
218 if pkey_file is None:
219 fd.write(creds.pkey_pem)
220 if pkey_file is not None:
221 with open(pkey_file, "wb") as fd:
222 fd.write(creds.pkey_pem)
223 creds.set_files(cert_file, pkey_file)
224 self._add_credentials(name, creds)
225
226 def save_chain(self, creds: Credentials, infix: str, with_root=False):
227 name = creds.name

Callers 3

create_rootMethod · 0.95
md_store_saveFunction · 0.45
issue_certMethod · 0.45

Calls 4

get_cert_fileMethod · 0.95
get_pkey_fileMethod · 0.95
_add_credentialsMethod · 0.95
set_filesMethod · 0.45

Tested by

no test coverage detected