PQDrill
Practice cryptographic algorithm retirement before you need it.
PQDrill is an experimental, local-first toolkit for cryptographic inventory, migration triage and controlled algorithm retirement drills. It exercises established OpenSSL implementations rather than inventing cryptography. It is designed for developers, security engineers and infrastructure teams evaluating post-quantum migration.
Alpha software. Not a cryptographic library, production protection, compliance certification, complete inventory or proof that any algorithm has been broken. The drill policy is scoped to synthetic test adapters and explicitly instrumented application calls, not a global OpenSSL or application policy.
Quick start
Python 3.10+ is required; the inventory, migration plan and policy commands have no runtime Python dependencies. Runtime PQC tests and hybrid TLS need OpenSSL 3.5+ with compatible provider support. Use a trusted OpenSSL executable. On macOS, install OpenSSL 3 via Homebrew if needed and use its executable explicitly (Apple's system openssl may be LibreSSL).
python3 -m venv .venv
source .venv/bin/activate
python -m pip install .
pqdrill --help
pqdrill capabilities
# macOS with Homebrew OpenSSL:
pqdrill --openssl "$(brew --prefix openssl@3)/bin/openssl" capabilities
This source distribution is not yet published to PyPI. Do not install an unrelated package by name.
Inventory and migration triage
pqdrill scan examples/ai-infrastructure
pqdrill scan examples/ai-infrastructure --format cbom > inventory.cdx.json
pqdrill plan examples/ai-infrastructure
pqdrill verify examples/ai-infrastructure --profile pqc
The scanner reports algorithm candidates, paths, line numbers, purpose, risk category and replacement guidance. It never emits matched source lines. It skips hidden files/directories, vendor directories, private key PEM content and binary/oversize files. It is deliberately bounded. It does not resolve dependencies, parse certificates or binaries, understand runtime reachability, or identify every use. Comments, test code and configuration strings can be false positives. Review all findings and protect reports: filenames may be sensitive. The optional CycloneDX 1.6-shaped CBOM lists heuristic algorithm components and candidate locations; it is not a complete cryptographic bill of materials.
Retirement drills
pqdrill drill --profile ai-infrastructure --retire RSA
pqdrill drill --profile ai-infrastructure --retire ECC
pqdrill drill --profile ai-infrastructure --retire ML-KEM --retire ML-DSA
pqdrill drill --manifest examples/ai-infrastructure/workflows.json --retire RSA
Each declared workflow first runs a baseline using disposable keys and synthetic messages. The harness then denies the selected family before invoking the affected adapter and reruns permitted operations. Signature workflows verify a valid signature and reject an altered message; KEM workflows check matching encapsulated and decapsulated shared secrets. Reports distinguish baseline failure, policy denial, survived fixture and inconclusive results. No user secrets or artifacts are processed. No shell commands from a manifest are executed.
The sample AI profile models isolated signing/key-establishment operations relevant to AI infrastructure. It does not run a real model registry, JWT service or distributed training system. Ed25519 survives an RSA-only retirement but remains quantum-vulnerable. Surviving a drill is not equivalent to PQ readiness. See design and limitations.
Custom manifests declare 1–32 synthetic operation adapters with unique IDs, an operation (signature or kem) and supported algorithm. Supported signature algorithms: RSA (2048-bit fixture), ECDSA (P-256 fixture), Ed25519, ML-DSA-44/65/87 and SLH-DSA-SHA2-128s. KEM: ML-KEM-512/768/1024. These are test selections, not production algorithm recommendations.
TLS key-establishment check
# Replace with a server you own or are explicitly authorized to test.
pqdrill tls localhost --port 443 --ca-file /path/to/trusted-ca.pem
The probe offers a single TLS 1.3 group (default X25519MLKEM768), validates the certificate chain and hostname/IP, and reports a verified connection or an inconclusive result. --group X25519 tests classical compatibility. No endpoint discovery, retries or bulk scanning. A hybrid handshake does not prove PQ certificate authentication. The integration tests provide a reproducible local server with a disposable certificate.
Automation
Commands emit JSON to stdout except the HTML report command. Diagnostics are sent to stderr. Exit codes: 0 command completed (for verify, no candidates found; for drill, no blocked or inconclusive fixtures); 1 review-required candidates or policy-blocked fixtures; 2 incomplete scan, inconclusive result or execution error. A zero is not a compliance guarantee. An RSA retirement drill intentionally returns 1 when it finds the synthetic legacy workflow.
python -m pip install -e '.[test]'
python -m pytest -q
PQDRILL_REQUIRE_PQC=1 python -m pytest -q
The second test command requires compatible PQC support rather than skipping those integration tests. The repository includes a GitHub Actions workflow and a Dockerfile. To build the image (requires Docker):
docker build -t pqdrill:local .
docker run --rm pqdrill:local capabilities
docker run --rm --network none pqdrill:local drill --profile ai-infrastructure --retire RSA
Hosted CI has passed on Linux and macOS with Python 3.10 and 3.13, including a dedicated post-quantum cryptography test environment. The Docker configuration has not yet been independently validated. Container base tags and dependencies should be pinned by digest/hash for controlled deployments.
Standards and references
- NIST PQC program, FIPS 203, FIPS 204, FIPS 205.
- NCCoE migration project.
- OpenSSL 3.5 TLS groups.
- CycloneDX specification.
NIST standardization does not mean every implementation is FIPS-validated. ML-KEM is a KEM, not a general-purpose encryption or signature algorithm. No claim of NIST endorsement is made.
Contributing
See CONTRIBUTING.md, SECURITY.md and roadmap. Contributions should include test fixtures, explicit evidence categories and documented limitations. Never submit private keys, real customer data or proprietary code. Apache-2.0 licensed.
Opt-in application drills (0.2.0)
In a trusted test checkout, use from pqdrill.application import guarded_call and wrap each relevant cryptographic operation: guarded_call("workflow-id", "RSA", existing_callable, *args, **kwargs). The label must accurately describe the operation. The wrapper records completion, failure or policy denial, without recording arguments. It raises AlgorithmRetired before running denied operations. It does not intercept uninstrumented crypto or verify that a callable uses its declared algorithm. Run only trusted commands in disposable staging, with no production credentials; the command runs twice, without a shell, and must clean up its children before returning. A missing event stream, failed baseline, or unmatched observed coverage is inconclusive. A nonzero retirement exit with denials is not proof of exclusive causation.
pqdrill init
pqdrill drill --retire RSA --run "python -m pytest -q examples/application/test_artifact.py"
pqdrill report --format html > pqdrill-report.html
The sample actually signs and verifies a disposable model artifact with OpenSSL, and rejects altered content. It requires OpenSSL 3.5+ for ML-DSA. --openssl selects the fixture backend, not the executable used by your application. Configure your application's PATH separately. --run executes an explicit trusted command; it never reads commands from a manifest. Exit 1 indicates observed denial; exit 2 indicates incomplete evidence. The latest drill is saved in .pqdrill/last-report.json; reports may contain workflow names and should be kept private. The inventory scanner skips recognized generated PQDrill JSON reports and counts them separately. Test code and source references still remain heuristic candidates. No compliance or production-security claim is made.
Operation timing and evidence dashboard (v0.3.0)
pqdrill benchmark --iterations 5 > benchmark.json
pqdrill report --input benchmark.json --format html > benchmark.html
pqdrill scan examples > inventory.json
pqdrill report --input inventory.json --format html > inventory.html
The benchmark generates disposable keys, performs verified signing or KEM operations, and records wall-clock subprocess latency by phase (key generation, public-key export, signing/verification or encapsulation/decapsulation). Median and nearest-rank P95 are descriptive, not primitive-only performance: they include process startup and file I/O. The default exercises five algorithms; repeat --algorithm to select specific ones. Any failed trial makes the benchmark inconclusive (exit 2). No memory or production throughput measurements are provided.
HTML dashboards summarize outcomes, incomplete evidence, benchmark timing and file-to-algorithm reference counts with full raw JSON and limitations retained. Inventory findings include heuristic context labels (test-file, comment-only-line, configuration, example-file, source-reference). They are not AST-resolved API calls and do not exclude tests or comments from the policy gate. A file-to-algorithm reference map is not a runtime service dependency graph. Partial retirement denials are inconclusive when the denial count does not match the baseline count.
Metadata
Release files for pqdrill 0.3.1
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 |
|---|---|---|---|---|
| pqdrill-0.3.1.tar.gz | 38.1 kB | With provenance | Details for pqdrill-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pqdrill-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for pqdrill-0.3.1-py3-none-any.whl |
Total release size: 65.6 kB
Release files / pqdrill-0.3.1.tar.gz
| Download URL | pqdrill-0.3.1.tar.gz |
|---|---|
| Size | 38.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed23f97114023ee68952465ad83b88313a3b143e2efb13734e137f49b7c6dc7d
|
|
BLAKE2b-256 checksum How to use checksums |
3fce74be43e6e83a020cf044c6fed04795bba10b650eace00a97a9e54ad404b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / pqdrill-0.3.1-py3-none-any.whl
| Download URL | pqdrill-0.3.1-py3-none-any.whl |
|---|---|
| Size | 27.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df95d4452231d46faf952575df99fb9d11a83432d3bcf181727f8d2dca32c74c
|
|
BLAKE2b-256 checksum How to use checksums |
1da74dafbe9a448d80d22101214d0e6b8f089a701aebb0f5ca5a6d325b8c81f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logSecurity for pqdrill 0.3.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pqdrill-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logA 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.