Skip to main content

PKI tools for e.g. checking certificate CRL/OCSP revocation

Project description

Python Badge

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

Docs

Documentation is available at: https://pki-tools.fulder.dev

Quickstart

Install

pip install pki-tools

Usage

Loading certificate

from pki_tools import Certificate

cert_pem = """
-----BEGIN CERTIFICATE-----
<CERT_PEM_BYTES>
-----END CERTIFICATE-----
"""

cert = Certificate.from_pem_string(cert_pem)

Loading chain

from pki_tools import Chain

issuer_cert_pem = """
-----BEGIN CERTIFICATE-----
<ISSUER_CERT_PEM_BYTES>
-----END CERTIFICATE-----
"""

chain = Chain.from_pem_string(issuer_cert_pem)

Checking revocation using OCSP with CRL fallback

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!")

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

pki_tools-0.0.24.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pki_tools-0.0.24-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file pki_tools-0.0.24.tar.gz.

File metadata

  • Download URL: pki_tools-0.0.24.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.2.0-1015-azure

File hashes

Hashes for pki_tools-0.0.24.tar.gz
Algorithm Hash digest
SHA256 d27eb1eecb792a3a74ff233b540ce636234192ec23e36fc10185af8e3e12bf47
MD5 8e378ad90b73d40542f3a9cc65e2fed3
BLAKE2b-256 82adf2817a648cc76a5c718f25c9773a4fe67836a9b3594202e6fc68f8f841e1

See more details on using hashes here.

File details

Details for the file pki_tools-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: pki_tools-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.2.0-1015-azure

File hashes

Hashes for pki_tools-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 28b88ffc47605fb460e678dfbb7761bcfbf246f63e668bceda02ae36ac5cff49
MD5 e86441008f66c3fca4e82fffa8dcec16
BLAKE2b-256 ee624e6e3a220481e1718582cc89074492ee61c6eb080426d5ccd98bd4e47e07

See more details on using hashes here.

Supported by

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