CRL-based Swarmauri certificate verification service for RFC 5280 revocation checks and X.509 metadata parsing.
Project description
Swarmauri CRL Verify Service
swarmauri_certs_crlverifyservice provides CrlVerifyService, a Swarmauri certificate service for Certificate Revocation List based X.509 verification. It validates certificate validity windows, compares CRL issuers with certificate issuers, detects revoked serial numbers, and parses certificate metadata for audit and observability workflows.
Why Swarmauri CRL Verify Service?
Use this package when Swarmauri applications need a lightweight revocation-aware certificate verifier without delegating to an external OCSP responder or CA API. It gives PKI monitoring, certificate deployment checks, and compliance workflows a direct Swarmauri interface for CRL-based RFC 5280 verification.
FAQ
Q: Does this package issue or sign certificates?
A: No. CSR creation, self-signed certificate creation, and certificate signing are intentionally outside this service. Use Swarmauri certificate packages such as swarmauri_certs_x509, swarmauri_certs_local_ca, swarmauri_certs_acme, or swarmauri_certs_cfssl for issuance workflows.
Q: What encodings does it accept?
A: The implemented certificate path expects PEM-encoded certificates. CRLs may be PEM or DER because verify_cert() falls back to DER CRL loading when PEM CRL parsing fails.
Q: What does verification return?
A: verify_cert() returns validity, reason, subject, issuer, not-before, not-after, and revoked fields. Revoked certificates return valid=False, revoked=True, and reason="revoked".
Q: What metadata does parsing return?
A: parse_cert() returns serial number, subject, issuer, validity timestamps, signature algorithm, and selected extensions such as basic constraints and key usage when present.
Features
CrlVerifyServiceadapter dedicated to revocation-aware verification and parsing.- Certificate validity-window checks using caller-provided
check_timeor current UTC time. - CRL issuer matching before revoked serial lookup.
- PEM certificate parsing and PEM/DER CRL parsing through
cryptography. - Structured validity metadata, revocation flags, issuers, and extension details.
- Verification-only design that delegates CSR and signing flows to other Swarmauri services.
- Python 3.10, 3.11, 3.12, 3.13, and 3.14 support.
Prerequisites
- Access to current CRLs for the certificate authorities being checked.
- PEM-encoded leaf certificates.
- PEM or DER CRLs.
- Optional trusted root or intermediate certificates when the caller wants to record issuer context alongside revocation checks.
Installation
Install with uv:
uv add swarmauri_certs_crlverifyservice
Install with pip:
pip install swarmauri_certs_crlverifyservice
Usage
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()
verification = await service.verify_cert(
cert=Path("leaf.pem").read_bytes(),
crls=[Path("issuer.crl").read_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"])
asyncio.run(main())
Parse certificate metadata for logging, auditing, or dashboards:
import asyncio
from pathlib import Path
from swarmauri_certs_crlverifyservice import CrlVerifyService
async def main() -> None:
service = CrlVerifyService()
metadata = await service.parse_cert(Path("leaf.pem").read_bytes())
print("Subject:", metadata["subject"])
print("Valid until:", metadata["not_after"])
print("Key usage:", metadata.get("key_usage"))
asyncio.run(main())
Related Packages
Certificate service packages:
- swarmauri_certs_ocspverify
- swarmauri_certs_x509
- swarmauri_certs_local_ca
- swarmauri_certs_self_signed
- swarmauri_certs_acme
- swarmauri_certs_cfssl
Foundational packages:
- swarmauri_core defines certificate-service interfaces.
- swarmauri_base provides certificate service base behavior.
- swarmauri provides namespace imports and plugin discovery.
Best Practices
- Refresh CRLs frequently; RFC 5280
nextUpdatedictates how long a CRL should be considered valid. - Combine this service with Swarmauri signing services to perform a full lifecycle check from issue to deploy to monitor.
- Cache CRLs in memory or a fast datastore to avoid repeatedly loading or downloading them when calling
verify_cert. - Log verification outputs, especially
reasonandrevoked, to your observability pipeline to catch trust issues early.
License
Apache-2.0
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_certs_crlverifyservice-0.11.0.dev1.tar.gz.
File metadata
- Download URL: swarmauri_certs_crlverifyservice-0.11.0.dev1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b3e1582cb67361d68f34e06ca313fcde8460b2260d1d9093bada8b61bbc723a
|
|
| MD5 |
98f4b6ea83fb2599eb214b52d86e8615
|
|
| BLAKE2b-256 |
5e3ade1a54562962b5cdc83c986ec179f2cc1c79f5215b1715d6e882260b6ca7
|
File details
Details for the file swarmauri_certs_crlverifyservice-0.11.0.dev1-py3-none-any.whl.
File metadata
- Download URL: swarmauri_certs_crlverifyservice-0.11.0.dev1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23bc83636650da7e354f2db36a0ac756daea2eb963e35c010e83fafc3974820b
|
|
| MD5 |
9424f48f950e0e63c3c80c8bf5dac805
|
|
| BLAKE2b-256 |
282994d5b10e92eb16e26aecf8830004b04cb2830be50740592beb52fa6d2049
|