Skip to main content

Chase authority information access from a host certificate to complete the chain of trust.

Project description

AIA Chaser

Poetry License: MIT Linter: Ruff Code style: black Imports: isort pre-commit

This package provides authority information access (AIA) chasing from a host/leaf certificate to complete its chain of trust and generate an SSL context to establish a secure connection.

Overview

AIA, an extension of the X509 standard in RFC 5280, points a client towards two types of endpoints:

  • CA Issuers: To fetch the issuer certificate.
  • OSCP: To check the certificate's revocation status.

Thanks to this information, it is possible to complete the chain of trust of a certificate. Without AIA chasing, some HTTPS requests may fail if the endpoint does not provide all the certificates of its chain of trust.

You may have experienced that already when some HTTPS URL works on your browser but fail when using curl or Python + requests. Then this package could be of help to you :guide_dog:.

Examples

The following examples showcase how to use this library with some typical Python HTTP libraries.

  • Standard library's urlopen:
from urllib.request import urlopen
from aia_chaser import AiaChaser

url = "https://..."

chaser = AiaChaser()
context = chaser.make_ssl_context_for_url(url)
response = urlopen(url, context=context)
import requests
from aia_chaser import AiaChaser

chaser = AiaChaser()
url = "https://..."
context = chaser.make_ssl_context_for_url(url)

ca_data = chaser.fetch_ca_chain_for_url(url)
with tempfile.NamedTemporaryFile("wt") as pem_file:
    pem_file.write(ca_data.to_pem())
    pem_file.flush()
    response = requests.get(url, verify=pem_file.name)
import urllib3
from aia_chaser import AiaChaser

url = "https://..."

chaser = AiaChaser()
context = chaser.make_ssl_context_for_url(url)
with urllib3.PoolManager(ssl_context=context) as pool:
    respone = pool.request("GET", url)

Development

First of all, you must have the following tools installed and on your $PATH.

Then, open a terminal on the project's directory and run:

make init

Acknowledgments

  • This project is based on aia.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aia_chaser-1.1.0.tar.gz (11.6 kB view hashes)

Uploaded Source

Built Distribution

aia_chaser-1.1.0-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page