PKI tools exposes a high level cryptography
API for e.g.:
- Loading certificates from PEM strings/files/cryptography object into a pydantic model including all x509 v3 extensions
- Checking revocation of certificates using OCSP with CRL fallback
Documentation is available at: https://pki-tools.fulder.dev
pip install pki-tools
from pki_tools import Certificate
cert_pem = """
-----BEGIN CERTIFICATE-----
<CERT_PEM_BYTES>
-----END CERTIFICATE-----
"""
cert = Certificate.from_pem(cert_pem)
from pki_tools import Chain
issuer_cert_pem = """
-----BEGIN CERTIFICATE-----
<ISSUER_CERT_PEM_BYTES>
-----END CERTIFICATE-----
"""
chain = Chain.from_pem(issuer_cert_pem)
The following example is using the cert
and chain
from the examples above
from pki_tools import is_revoked
if is_revoked(cert, chain):
print("Certificate Revoked!")