Skip to main content

Consolidate, split, filter certificates.

Project description

certificate-manipulation

Consolidate, split, filter certificates.

Input formats currently supported:

  • PEM/CRT (.pem, .crt)
  • DER/CER (.der, .cer)
  • PKCS7 bundles (.p7b, .p7c)

Quickstart

uv sync --group dev
uv run pre-commit install
uv run ruff format .
uv run ruff check .
uv run ty check src tests
uv run pytest
uv run pre-commit run --all-files

CLI Usage

uv tool run certificate-manipulation --help
uv tool run certificate-manipulation combine --inputs ./a.crt ./b.pem --output ./bundle.pem
uv tool run certificate-manipulation combine --inputs ./a.crt ./b.der ./chain.p7b --output ./bundle.pem
uv tool run certificate-manipulation split --input ./bundle.pem --output-dir ./out --ext crt
uv tool run certificate-manipulation convert --input ./a.crt --output ./a.pem --to pem
uv tool run certificate-manipulation filter --input ./bundle.pem --output ./filtered.pem --subject-cn router
uv tool run certificate-manipulation filter --input ./bundle.pem --output ./active.pem --exclude-expired
uv tool run certificate-manipulation filter --input ./bundle.pem --output ./regex.pem --subject-cn-regex "^router-.*"
uv tool run certificate-manipulation filter --input ./bundle.pem --output ./or.pem --subject-cn router --issuer-cn corp-root --logic or
uv tool run certificate-manipulation combine --inputs ./a.crt ./b.crt --output ./bundle.pem --report-json ./combine-report.json

Benchmark

Run a basic performance check on a generated large bundle:

uv run python scripts/benchmark_large_bundle.py --cert-count 500
uv run python scripts/benchmark_large_bundle.py --cert-count 500 --clean --workdir .benchmarks/local --output-json .benchmarks/local/report.json --thresholds-file benchmarks/ci_thresholds.json

The script prints JSON timings for combine, split, and filter. If the workdir already exists, rerun with --clean.

CLI Exit Codes (certificate-manipulation)

  • 0: Success
  • 1: Validation error
  • 2: Runtime/parse error
  • 3: Partial success (--on-invalid skip with rejected certificates)

Benchmark Script Exit Codes (scripts/benchmark_large_bundle.py)

  • 0: Benchmark completed and all configured thresholds passed
  • 2: At least one benchmark timing exceeded configured thresholds

Troubleshooting

  • No PEM certificates found: ensure files contain -----BEGIN CERTIFICATE----- / -----END CERTIFICATE----- blocks.
  • Exit code 3: operation completed with --on-invalid skip, at least one invalid cert was ignored.
  • No valid certificates found: input exists but contains no parsable X.509 PEM certificates.
  • No certificates matched filter criteria: input is valid but your filter is too restrictive.
  • Existing output path collisions: default --overwrite version writes name.v2.ext, name.v3.ext, etc.

Project Layout

  • src/certificate_manipulation: package code
  • tests/unit: fast default tests
  • tests/integration: component-level tests
  • tests/end2end: user-facing behavior tests
  • docs/engineering/CONTRACTS.md: frozen public CLI/API contracts
  • docs/engineering/RELEASE_RUNBOOK.md: hardened release process
  • CHANGELOG.md: formal release history
  • skills: AI helper skills for coding workflows

Release

Follow docs/engineering/RELEASE_RUNBOOK.md.

At minimum:

  1. Bump version in pyproject.toml and src/certificate_manipulation/__init__.py.
  2. Cut release notes from CHANGELOG.md (Unreleased -> X.Y.Z section).
  3. Build and verify artifacts (python -m build, twine check dist/*).
  4. Create and push git tag vX.Y.Z.
  5. Let GitHub Action publish.

For manual validation, use workflow dispatch with publish_target=testpypi.

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

certificate_manipulation-1.0.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

certificate_manipulation-1.0.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file certificate_manipulation-1.0.0.tar.gz.

File metadata

  • Download URL: certificate_manipulation-1.0.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for certificate_manipulation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 35f224c991636c410da4cdd6603385b1ce2bd17d38034cce4ef45cdce7403008
MD5 6eed2d3342cfb417f05e7c81deb41d37
BLAKE2b-256 8b98141a38fa26cb30cb5555e8bd14f461252e2cf5bd60cb5009bff099d2038a

See more details on using hashes here.

Provenance

The following attestation bundles were made for certificate_manipulation-1.0.0.tar.gz:

Publisher: release.yml on Guillaume-Lombardo/certificate-manipulation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file certificate_manipulation-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for certificate_manipulation-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6c837b845a43adab2988263136afd8fb874daa4da55b0ad8e3d6493cb06a429
MD5 d1b6ff7aa6bb71ee01ad0c0a81740fe7
BLAKE2b-256 0e3c42bea977d7f0e931361c6ef236532de12c4e303c1575f473bbc475cbfd2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for certificate_manipulation-1.0.0-py3-none-any.whl:

Publisher: release.yml on Guillaume-Lombardo/certificate-manipulation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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