# AIA Chaser
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-darkgoldenrod.svg)](https://opensource.org/licenses/MIT)
[![Linter: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/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](https://datatracker.ietf.org/doc/html/rfc5280),
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**:
```Python
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)
```
* Using [Requests: HTTP for Humans](https://docs.python-requests.org/en/latest/index.html):
```Python
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)
```
* Using [urllib3](https://urllib3.readthedocs.io/en/stable/):
```Python
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`.
* [Pyenv](https://github.com/pyenv/pyenv)
* [Poetry](https://python-poetry.org/docs/#installation)
* Make
Then, open a terminal on the project's directory and run:
```console
make init
```
## Acknowledgments
* This project is based on [aia](https://github.com/danilobellini/aia).
Raw data
{
"_id": null,
"home_page": "https://github.com/jponf/aia-chaser",
"name": "aia-chaser",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "AIA,SSL,TLS,X.509,Certificate Chain",
"author": "Josep Pon Farreny",
"author_email": "jponfarreny@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bb/04/e0606b02ae6ff92e9f66ae00946768e945bb3491d96ae20a614a87a448e1/aia_chaser-1.1.0.tar.gz",
"platform": null,
"description": "# AIA Chaser\n\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-darkgoldenrod.svg)](https://opensource.org/licenses/MIT)\n[![Linter: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n\n\nThis package provides authority information access (AIA) chasing\nfrom a host/leaf certificate to complete its chain of trust and\ngenerate an SSL context to establish a secure connection.\n\n## Overview\n\nAIA, an extension of the X509 standard in\n[RFC 5280](https://datatracker.ietf.org/doc/html/rfc5280),\npoints a client towards two types of endpoints:\n * CA Issuers: To fetch the *issuer* certificate.\n * OSCP: To check the certificate's revocation status.\n\nThanks to this information, it is possible to complete the chain of trust\nof a certificate. Without AIA chasing, some HTTPS requests may fail if\nthe endpoint does not provide all the certificates of its chain of trust.\n\nYou may have experienced that already when some HTTPS URL works on your\nbrowser but fail when using `curl` or `Python` + `requests`. Then this\npackage could be of help to you :guide_dog:.\n\n## Examples\n\nThe following examples showcase how to use this library with some typical\nPython HTTP libraries.\n\n * Standard library's **urlopen**:\n\n```Python\nfrom urllib.request import urlopen\nfrom aia_chaser import AiaChaser\n\nurl = \"https://...\"\n\nchaser = AiaChaser()\ncontext = chaser.make_ssl_context_for_url(url)\nresponse = urlopen(url, context=context)\n```\n\n * Using [Requests: HTTP for Humans](https://docs.python-requests.org/en/latest/index.html):\n\n```Python\nimport requests\nfrom aia_chaser import AiaChaser\n\nchaser = AiaChaser()\nurl = \"https://...\"\ncontext = chaser.make_ssl_context_for_url(url)\n\nca_data = chaser.fetch_ca_chain_for_url(url)\nwith tempfile.NamedTemporaryFile(\"wt\") as pem_file:\n pem_file.write(ca_data.to_pem())\n pem_file.flush()\n response = requests.get(url, verify=pem_file.name)\n```\n\n * Using [urllib3](https://urllib3.readthedocs.io/en/stable/):\n\n```Python\nimport urllib3\nfrom aia_chaser import AiaChaser\n\nurl = \"https://...\"\n\nchaser = AiaChaser()\ncontext = chaser.make_ssl_context_for_url(url)\nwith urllib3.PoolManager(ssl_context=context) as pool:\n respone = pool.request(\"GET\", url)\n```\n\n## Development\n\nFirst of all, you must have the following tools installed and on\nyour `$PATH`.\n\n * [Pyenv](https://github.com/pyenv/pyenv)\n * [Poetry](https://python-poetry.org/docs/#installation)\n * Make\n\nThen, open a terminal on the project's directory and run:\n\n```console\nmake init\n```\n\n## Acknowledgments\n\n* This project is based on [aia](https://github.com/danilobellini/aia).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Chase authority information access from a host certificate to complete the chain of trust.",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/jponf/aia-chaser",
"Repository": "https://github.com/jponf/aia-chaser"
},
"split_keywords": [
"aia",
"ssl",
"tls",
"x.509",
"certificate chain"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0abd221097ba20f4f0e1045da3b1c4315bde51cb9a37e6dcea7701df0a28b4b7",
"md5": "db8d60a402e15353245da446eecd5063",
"sha256": "03fb9af87e2229a6ad3beed81fdd27403ccd4daee505ccd1479f139a16411ad1"
},
"downloads": -1,
"filename": "aia_chaser-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "db8d60a402e15353245da446eecd5063",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 11306,
"upload_time": "2024-01-24T11:31:20",
"upload_time_iso_8601": "2024-01-24T11:31:20.723535Z",
"url": "https://files.pythonhosted.org/packages/0a/bd/221097ba20f4f0e1045da3b1c4315bde51cb9a37e6dcea7701df0a28b4b7/aia_chaser-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb04e0606b02ae6ff92e9f66ae00946768e945bb3491d96ae20a614a87a448e1",
"md5": "7dd9461f16f7645fadad0eeeee867df4",
"sha256": "e6ffd48b72911a6b78a96837cdeb103d615880531b6383b0389248012da1ba14"
},
"downloads": -1,
"filename": "aia_chaser-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "7dd9461f16f7645fadad0eeeee867df4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 11627,
"upload_time": "2024-01-24T11:31:21",
"upload_time_iso_8601": "2024-01-24T11:31:21.949945Z",
"url": "https://files.pythonhosted.org/packages/bb/04/e0606b02ae6ff92e9f66ae00946768e945bb3491d96ae20a614a87a448e1/aia_chaser-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-24 11:31:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jponf",
"github_project": "aia-chaser",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "aia-chaser"
}