Attempt to load CA certs from Windows trust store.
(self, store: str)
| 336 | ) |
| 337 | |
| 338 | def _load_wincerts(self, store: str) -> None: |
| 339 | """Attempt to load CA certs from Windows trust store.""" |
| 340 | cert_store = self._ctx.get_cert_store() |
| 341 | assert cert_store is not None |
| 342 | oid = _stdlibssl.Purpose.SERVER_AUTH.oid |
| 343 | |
| 344 | for cert, encoding, trust in _stdlibssl.enum_certificates(store): # type: ignore |
| 345 | if encoding == "x509_asn": |
| 346 | if trust is True or oid in trust: |
| 347 | cert_store.add_cert( |
| 348 | _crypto.X509.from_cryptography(x509.load_der_x509_certificate(cert)) |
| 349 | ) |
| 350 | |
| 351 | def load_default_certs(self) -> None: |
| 352 | """A PyOpenSSL version of load_default_certs from CPython.""" |