Skip to main content

Certificate verification against CRLs

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_certs_crlverifyservice


swarmauri_certs_crlverifyservice

CRL-based certificate verification service for the Swarmauri SDK.

This package implements an ICertService that checks X.509 certificates against Certificate Revocation Lists as described in RFC 5280. It validates the certificate's validity period, issuer, and revocation status.

Features

  • CrlVerifyService adapter dedicated to revocation-aware verification and parsing.
  • Accepts PEM or DER certificates/CRLs and normalizes them with cryptography.
  • Returns structured validity metadata, revocation flags, issuers, and extension details.
  • Focuses purely on verification; CSR and signing flows stay delegated to other Swarmauri services.

Prerequisites

  • Python 3.10 or newer.
  • Access to up-to-date CRLs for the certificate authorities you care about.
  • Certificates and CRLs stored in PEM (Base64) or DER; the service can decode either.
  • Optional: trusted root/intermediate certificates if you plan to record issuer context alongside revocation checks.

Installation

# pip
pip install swarmauri_certs_crlverifyservice

# poetry
poetry add swarmauri_certs_crlverifyservice

# uv (pyproject-based projects)
uv add swarmauri_certs_crlverifyservice

Quickstart: Revocation Check

Load a certificate and its corresponding CRL, then validate the revocation status and validity window:

import asyncio
from pathlib import Path

from swarmauri_certs_crlverifyservice import CrlVerifyService


async def main() -> None:
    service = CrlVerifyService()

    cert_bytes = Path("leaf.pem").read_bytes()
    crl_bytes = Path("issuer.crl").read_bytes()

    verification = await service.verify_cert(
        cert=cert_bytes,
        crls=[crl_bytes],
        check_revocation=True,
    )

    if verification["valid"]:
        print("Certificate is valid.")
    elif verification.get("revoked"):
        print("Certificate was revoked:", verification["reason"])
    else:
        print("Certificate failed validation:", verification["reason"])


if __name__ == "__main__":
    asyncio.run(main())

Parsing Metadata

Use parse_cert to surface fields needed for logging, auditing, or dashboards:

import asyncio
from pathlib import Path

from swarmauri_certs_crlverifyservice import CrlVerifyService


async def describe() -> None:
    service = CrlVerifyService()
    cert_bytes = Path("leaf.pem").read_bytes()

    metadata = await service.parse_cert(cert_bytes)
    print("Subject:", metadata["subject"])
    print("Valid until:", metadata["not_after"])
    print("Key usage:", metadata.get("key_usage"))


if __name__ == "__main__":
    asyncio.run(describe())

Best Practices

  • Refresh CRLs frequently; RFC 5280 nextUpdate dictates how long a CRL should be considered valid.
  • Combine this service with Swarmauri signing services to perform a full lifecycle check (issue → deploy → monitor).
  • Cache CRLs in memory or a fast datastore to avoid repeatedly downloading them when calling verify_cert.
  • Log verification outputs (especially reason and revoked) to your observability pipeline to catch trust issues early.

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

Built Distribution

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

File details

Details for the file swarmauri_certs_crlverifyservice-0.1.3.dev5.tar.gz.

File metadata

  • Download URL: swarmauri_certs_crlverifyservice-0.1.3.dev5.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_certs_crlverifyservice-0.1.3.dev5.tar.gz
Algorithm Hash digest
SHA256 66abf9432d9d38e0909e5cb891445af3d53a5da214d8a582628db561a031ff11
MD5 7052cf35148ab43e0000a3aecbb33e15
BLAKE2b-256 24e68c4825d7e4576158702f70c3a3fbea5b1506ca2867e4d2437c8fa21ca9e7

See more details on using hashes here.

File details

Details for the file swarmauri_certs_crlverifyservice-0.1.3.dev5-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_certs_crlverifyservice-0.1.3.dev5-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_certs_crlverifyservice-0.1.3.dev5-py3-none-any.whl
Algorithm Hash digest
SHA256 3a59998b7aead127b7e9643ee86781c667d8a5ca7d05e9ff7f662f3b00c6919c
MD5 d4b74b172bf092d6c867b57cbd4e409e
BLAKE2b-256 67886ae6e97e165907f31c5a4ab8d5c2df3be651a86d45ce120dcdb6bded8449

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