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: Success1: Validation error2: Runtime/parse error3: Partial success (--on-invalid skipwith rejected certificates)
Benchmark Script Exit Codes (scripts/benchmark_large_bundle.py)
0: Benchmark completed and all configured thresholds passed2: 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 versionwritesname.v2.ext,name.v3.ext, etc.
Project Layout
src/certificate_manipulation: package codetests/unit: fast default teststests/integration: component-level teststests/end2end: user-facing behavior testsdocs/engineering/CONTRACTS.md: frozen public CLI/API contractsdocs/engineering/RELEASE_RUNBOOK.md: hardened release processCHANGELOG.md: formal release historyskills: AI helper skills for coding workflows
Release
Follow docs/engineering/RELEASE_RUNBOOK.md.
At minimum:
- Bump version in
pyproject.tomlandsrc/certificate_manipulation/__init__.py. - Cut release notes from
CHANGELOG.md(Unreleased->X.Y.Zsection). - Build and verify artifacts (
python -m build,twine check dist/*). - Create and push git tag
vX.Y.Z. - Let GitHub Action publish.
For manual validation, use workflow dispatch with publish_target=testpypi.
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35f224c991636c410da4cdd6603385b1ce2bd17d38034cce4ef45cdce7403008
|
|
| MD5 |
6eed2d3342cfb417f05e7c81deb41d37
|
|
| BLAKE2b-256 |
8b98141a38fa26cb30cb5555e8bd14f461252e2cf5bd60cb5009bff099d2038a
|
Provenance
The following attestation bundles were made for certificate_manipulation-1.0.0.tar.gz:
Publisher:
release.yml on Guillaume-Lombardo/certificate-manipulation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
certificate_manipulation-1.0.0.tar.gz -
Subject digest:
35f224c991636c410da4cdd6603385b1ce2bd17d38034cce4ef45cdce7403008 - Sigstore transparency entry: 975818634
- Sigstore integration time:
-
Permalink:
Guillaume-Lombardo/certificate-manipulation@861c0f99991d246db434e4bdaa3b4e3e592b4702 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Guillaume-Lombardo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@861c0f99991d246db434e4bdaa3b4e3e592b4702 -
Trigger Event:
release
-
Statement type:
File details
Details for the file certificate_manipulation-1.0.0-py3-none-any.whl.
File metadata
- Download URL: certificate_manipulation-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6c837b845a43adab2988263136afd8fb874daa4da55b0ad8e3d6493cb06a429
|
|
| MD5 |
d1b6ff7aa6bb71ee01ad0c0a81740fe7
|
|
| BLAKE2b-256 |
0e3c42bea977d7f0e931361c6ef236532de12c4e303c1575f473bbc475cbfd2f
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
certificate_manipulation-1.0.0-py3-none-any.whl -
Subject digest:
d6c837b845a43adab2988263136afd8fb874daa4da55b0ad8e3d6493cb06a429 - Sigstore transparency entry: 975818635
- Sigstore integration time:
-
Permalink:
Guillaume-Lombardo/certificate-manipulation@861c0f99991d246db434e4bdaa3b4e3e592b4702 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Guillaume-Lombardo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@861c0f99991d246db434e4bdaa3b4e3e592b4702 -
Trigger Event:
release
-
Statement type: