Skip to main content

Resolve / obtain the certificate intermediates of a x509 cert

Project description

Python certificate chain resolver

Licence CI Docs Downloads Python) PyPI - Wheel PyPI

Resolve / obtain the certificate intermediates of a x509 certificate using the CLI or python API.

The CLI writes the full bundle to stdout. The Python API can be used to iterate over the certificates and get additional information on the bundle.

from cert_chain_resolver.api import resolve
with open('cert.pem', 'rb') as f:
   fb = f.read()
   chain = resolve(fb)
>>>
for cert in chain:
  print(cert)
<Cert common_name="cert-chain-resolver.remcokoopmans.com" subject="CN=cert-chain-resolver.remcokoopmans.com" issuer="CN=R3,O=Let's Encrypt,C=US">
<Cert common_name="R3" subject="CN=R3,O=Let's Encrypt,C=US" issuer="CN=DST Root CA X3,O=Digital Signature Trust Co.">
<Cert common_name="DST Root CA X3" subject="CN=DST Root CA X3,O=Digital Signature Trust Co." issuer="CN=DST Root CA X3,O=Digital Signature Trust Co.">

Support

  • PKCS7, PEM and DER formats
  • LetsEncrypt certificates

Dependencies

  • cryptography

Documentation

Read more on readthedocs

Install

Pypi

$ pip install cert-chain-resolver

Usage

Installed using PIP

$ cert_chain_resolver certificate.crt > bundle.crt

Or read from stdin

$ cat certificate.crt | cert_chain_resolver > bundle.crt

After cloning the repository

Install dependencies

$ make

from file:

$ python -m cert_chain_resolver.cli certificate.crt > bundle.crt

from stdin:

$ cat certificate.crt | python -m cert_chain_resolver.cli > bundle.crt

Print the details of each certificate in resolved chain

$ cert_chain_resolver cert.pem --info

Development

bootstrap

$ make

Testing

Unit testing

$ make tests

Re-run tests on file changes:

$ make tests TEST_ARGS="-- -f"

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

cert_chain_resolver-1.2.0a1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

cert_chain_resolver-1.2.0a1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file cert_chain_resolver-1.2.0a1.tar.gz.

File metadata

  • Download URL: cert_chain_resolver-1.2.0a1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cert_chain_resolver-1.2.0a1.tar.gz
Algorithm Hash digest
SHA256 0f8e20be2208a953938cabfe709991fa3805c0856c132f76fbed3a15235408b4
MD5 914e53709892dbf0e83ff605938b24a4
BLAKE2b-256 151be270ab7fa79e5bac711dc23f697c02029b70a54de37dd3370aa55b866f9c

See more details on using hashes here.

File details

Details for the file cert_chain_resolver-1.2.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for cert_chain_resolver-1.2.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b7a1ebdb0650a90c3779052aac30b9e5690a50c76884001965f7aee029f5b06
MD5 f106a1b552f43c0e6cc5700e8763d894
BLAKE2b-256 ccab0b088783f25b2cdcdc1c9ed7e216f7b46627ade3bb8a6ce9a55796260de7

See more details on using hashes here.

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