swarmauri_certs_ocspverify
OCSP-based certificate verification service for the Swarmauri SDK.
This package provides an implementation of an ICertService that checks
certificate revocation status using the Online Certificate Status Protocol
(OCSP) defined in RFC 6960 while
remaining compatible with X.509 certificate guidelines from
RFC 5280.
Features
- Parse PEM certificates to extract subject, issuer and OCSP responder URLs.
- Verify certificate status via OCSP responders advertised in the certificate's Authority Information Access extension.
Prerequisites
- Python 3.10 or newer.
- Leaf certificate PEM to inspect and validate.
- Issuer (intermediate) certificate PEM required to build the OCSP request.
- Network access to the OCSP responder URLs exposed in the certificate's Authority Information Access extension.
- Optional: trust root bundle if performing additional validation on issuer metadata alongside OCSP results.
Installation
# pip
pip install swarmauri_certs_ocspverify
# poetry
poetry add swarmauri_certs_ocspverify
# uv (pyproject-based projects)
uv add swarmauri_certs_ocspverify
Usage
Perform an OCSP status check for a leaf certificate using its issuer certificate:
import asyncio
from pathlib import Path
from swarmauri_certs_ocspverify import OcspVerifyService
async def main() -> None:
service = OcspVerifyService()
leaf_cert = Path("leaf.pem").read_bytes()
issuer_cert = Path("issuer.pem").read_bytes()
verification = await service.verify_cert(
cert=leaf_cert,
intermediates=[issuer_cert],
check_revocation=True,
)
if verification["valid"]:
print("Certificate status: GOOD")
else:
print("Certificate status:", verification["reason"])
print("Next update:", verification.get("next_update"))
if __name__ == "__main__":
asyncio.run(main())
Parsing OCSP Metadata
Use parse_cert to confirm which OCSP responder URLs are embedded and to inspect the validity window:
import asyncio
from pathlib import Path
from swarmauri_certs_ocspverify import OcspVerifyService
async def describe() -> None:
service = OcspVerifyService()
leaf_cert = Path("leaf.pem").read_bytes()
metadata = await service.parse_cert(leaf_cert)
print("Subject:", metadata["subject"])
print("Issuer:", metadata["issuer"])
print("OCSP URLs:", metadata.get("ocsp_urls", []))
if __name__ == "__main__":
asyncio.run(describe())
Best Practices
- Cache issuer certificates alongside leaf certificates so OCSP requests can be constructed quickly.
- Respect OCSP responder rate limits; consider backoff and caching GOOD responses until
next_update. - Combine OCSP checks with CRL fallbacks for authorities that support multiple revocation mechanisms.
- Log
reasonand timestamp fields from the verification output to aid in incident response and compliance reporting.
Metadata
Release files for swarmauri_certs_ocspverify 0.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_certs_ocspverify-0.9.3.tar.gz | 8.2 kB | Without provenance | Details for swarmauri_certs_ocspverify-0.9.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_certs_ocspverify-0.9.3-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_certs_ocspverify-0.9.3-py3-none-any.whl |
Total release size: 17.5 kB
Release files / swarmauri_certs_ocspverify-0.9.3.tar.gz
| Download URL | swarmauri_certs_ocspverify-0.9.3.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d7e6a356cf11e1e0384ecd6413dfa1e720130eece0d3c064ef28412f900ecbe
|
|
BLAKE2b-256 checksum How to use checksums |
b6fdc05499d0c5611c18090f60f1a7acf7f78ab4e8c128e4319fd5f81ffa9a8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / swarmauri_certs_ocspverify-0.9.3-py3-none-any.whl
| Download URL | swarmauri_certs_ocspverify-0.9.3-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6bba27feb190a4ed83f1343b1bd90fe48cbdd7d81d40ba267577199a66bcee5
|
|
BLAKE2b-256 checksum How to use checksums |
a3217ec0870992a144edde6fe11f901f504e948f2896b6a8458e0826472e27e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Security for swarmauri_certs_ocspverify 0.9.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.