MCPcopy
hub / github.com/urllib3/urllib3 / load_cert_chain

Method load_cert_chain

src/urllib3/contrib/pyopenssl.py:479–493  ·  src/urllib3/contrib/pyopenssl.py::PyOpenSSLContext.load_cert_chain
(
        self,
        certfile: str,
        keyfile: str | None = None,
        password: str | None = None,
    )

Source from the content-addressed store, hash-verified

477 raise ssl.SSLError(fclass="st">"unable to load trusted certificates: {e!r}") from e
478
479 def load_cert_chain(
480 self,
481 certfile: str,
482 keyfile: str | None = None,
483 password: str | None = None,
484 ) -> None:
485 try:
486 self._ctx.use_certificate_chain_file(certfile)
487 if password is not None:
488 if not isinstance(password, bytes):
489 password = password.encode(class="st">"utf-8") class="cm"># type: ignore[assignment]
490 self._ctx.set_passwd_cb(lambda *_: password)
491 self._ctx.use_privatekey_file(keyfile or certfile)
492 except OpenSSL.SSL.Error as e:
493 raise ssl.SSLError(fclass="st">"Unable to load certificate chain: {e!r}") from e
494
495 def set_alpn_protocols(self, protocols: list[bytes | str]) -> None:
496 protocols = [util.util.to_bytes(p, class="st">"ascii") for p in protocols]

Calls

no outgoing calls