Resolve / obtain the certificate intermediates of a x509 cert
Project description
Python certificate chain resolver
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
$ 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
Release history Release notifications | RSS feed
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.1.1.tar.gz
(11.5 kB
view details)
Built Distribution
File details
Details for the file cert_chain_resolver-1.1.1.tar.gz
.
File metadata
- Download URL: cert_chain_resolver-1.1.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24d891ef3293aa3a7b2ee437fc923ede1fff8179a49c4dc813fa52dc45ad5674 |
|
MD5 | adac5bcfbe38396621785f2b4b76ba40 |
|
BLAKE2b-256 | e10a6bbd21b7db0989ff0a1404446451e516164506f1fc53619903ce7866237d |
File details
Details for the file cert_chain_resolver-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: cert_chain_resolver-1.1.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b19f224502fec578cc97ecbc1ba0128353587646c0607185302eba6aa4a8cb24 |
|
MD5 | 02cea379b58bcdb02f0d290404612abc |
|
BLAKE2b-256 | e7110f8b10cb9f43535f40f93a78575363ff5f608e3b289647fe5c1f2d750272 |