pyhanko_certvalidator.fetchers.aiohttp_fetchers package

Submodules

pyhanko_certvalidator.fetchers.aiohttp_fetchers.cert_fetch_client module

class pyhanko_certvalidator.fetchers.aiohttp_fetchers.cert_fetch_client.AIOHttpCertificateFetcher(session: ClientSession | LazySession, user_agent=None, per_request_timeout=10, permit_pem=True)

Bases: CertificateFetcher, AIOHttpMixin

async fetch_certs(url, url_origin_type)

Fetch one or more certificates from a URL.

Parameters:
  • url – URL to fetch.

  • url_origin_type – Parameter indicating where the URL came from (e.g. ‘CRL’), for error reporting purposes.

Raises:

CertificateFetchError - when a network I/O or decoding error occurs

Returns:

An iterable of asn1crypto.x509.Certificate objects.

fetch_cert_issuers(cert: Certificate | AttributeCertificateV2)

Fetches certificates from the authority information access extension of a certificate.

Parameters:

cert – A certificate

Raises:

CertificateFetchError - when a network I/O or decoding error occurs

Returns:

An asynchronous generator yielding asn1crypto.x509.Certificate objects that were fetched.

fetch_crl_issuers(certificate_list)

Fetches certificates from the authority information access extension of an asn1crypto.crl.CertificateList.

Parameters:

certificate_list – An asn1crypto.crl.CertificateList object

Raises:

CertificateFetchError - when a network I/O or decoding error occurs

Returns:

An asynchronous generator yielding asn1crypto.x509.Certificate objects that were fetched.

fetched_certs() Iterable[Certificate]

Return all certificates retrieved by this certificate fetcher.

pyhanko_certvalidator.fetchers.aiohttp_fetchers.crl_client module

class pyhanko_certvalidator.fetchers.aiohttp_fetchers.crl_client.AIOHttpCRLFetcher(session: ClientSession | LazySession, user_agent=None, per_request_timeout=10)

Bases: CRLFetcher, AIOHttpMixin

async fetch(cert: Certificate | AttributeCertificateV2, *, use_deltas=True)

Fetches the CRLs for a certificate.

Parameters:
  • cert – An asn1crypto.x509.Certificate object to get the CRL for

  • use_deltas – A boolean indicating if delta CRLs should be fetched

Raises:

CRLFetchError - when a network/IO error or decoding error occurs

Returns:

An iterable of CRLs fetched.

fetched_crls() Iterable[CertificateList]

Return all CRLs fetched by this CRL fetcher.

fetched_crls_for_cert(cert) Iterable[CertificateList]

Return all relevant fetched CRLs for the given certificate

Parameters:

cert – A certificate.

Returns:

An iterable of CRLs

Raises:

KeyError – if no fetch operations have been performed for this certificate

pyhanko_certvalidator.fetchers.aiohttp_fetchers.ocsp_client module

class pyhanko_certvalidator.fetchers.aiohttp_fetchers.ocsp_client.AIOHttpOCSPFetcher(session: ClientSession | LazySession, user_agent=None, per_request_timeout=10, certid_hash_algo='sha1', request_nonces=True)

Bases: OCSPFetcher, AIOHttpMixin

async fetch(cert: Certificate | AttributeCertificateV2, authority: Authority) OCSPResponse

Fetch an OCSP response for a certificate.

Parameters:
  • cert – The certificate for which an OCSP response has to be fetched.

  • authority – The issuing authority.

Raises:

OCSPFetchError - Raised if an OCSP response could not be obtained.

Returns:

An OCSP response.

fetched_responses() Iterable[OCSPResponse]

Return all responses fetched by this OCSP fetcher.

fetched_responses_for_cert(cert: Certificate) Iterable[OCSPResponse]

Return all responses fetched by this OCSP fetcher that are relevant to determine the revocation status of the given certificate.

pyhanko_certvalidator.fetchers.aiohttp_fetchers.util module

class pyhanko_certvalidator.fetchers.aiohttp_fetchers.util.LazySession

Bases: object

async get_session()
async close()
class pyhanko_certvalidator.fetchers.aiohttp_fetchers.util.AIOHttpMixin(session: ClientSession | LazySession, user_agent=None, per_request_timeout=10)

Bases: object

async get_session() ClientSession
get_results()
get_results_for_tag(tag)

Module contents

class pyhanko_certvalidator.fetchers.aiohttp_fetchers.AIOHttpFetcherBackend(session: ClientSession | None = None, per_request_timeout=10)

Bases: FetcherBackend

get_fetchers() Fetchers

Set up fetchers synchronously.

Note

This is a synchronous method

async close()

Clean up the resources associated with this fetcher backend, asynchronously.