
pqc-anything
io.github.TANTIRA/pqc-anything
Referee for post-quantum cryptography migrations: scan, probe, plan, check, gate and fix
Documentation
PQC Anything
A referee for post-quantum cryptography migrations done by coding agents.
Your agent (Claude Code, Codex) writes the migration. PQC Anything measures what the change actually did and returns a verdict: allow, ask a human, or deny. When it cannot judge at all, it returns an error, never a silent pass.
Status: 0.1.3. The CLI commands
scan,probe,pcap,plan,check,fix,gate,mcpandsetupare built.scan,probe,plan,check,gateandfixare also MCP tools. Read the design in docs/superpowers/specs.
Quick start
Install the binary
cargo install --locked --git https://github.com/TANTIRA/pqc-anything pqc-anything
This builds the tool from source and puts pqc-anything in ~/.cargo/bin.
It needs no account and no key. It needs two things:
- Rust 1.90 or newer. rustup installs it.
- A C compiler, because the TLS library
aws-lc-rsbuilds C code.- Linux:
gccorclang. On Debian and Ubuntu, install thebuild-essentialpackage. - macOS: the Xcode Command Line Tools. Run
xcode-select --install. - Windows: the Microsoft C++ Build Tools, which rustup offers to install.
We have not yet confirmed whether
aws-lc-rsalso needs NASM or CMake on Windows.
- Linux:
Check that the binary runs:
pqc-anything --version
Scan a directory
scan reads a directory and lists the cryptography in it. Run it in your
project. The output below comes from the small example in
tests/fixtures/readme of this repository: a Python file that makes an RSA
key, an nginx file, and a shell script.
$ pqc-anything scan .
as of 2026-12-04
Findings
tier 1 stage 2 legacy-use RSA 2048 app/keys.py:3 unclassified product rsa.generate_private_key 3593d493982f
tier 1 stage 2 capability classical-only deploy/nginx.conf:4 unclassified product ssl_ecdh_curve 4cd9a84a5565
tier 1 stage 2 legacy-use RSA scripts/new-key.sh:2 unclassified product RSA 0dcfc3e0374b
Stages
stage 1: 3 finding(s) need an asset
stage 2: none
stage 3: none
stage 4: scattered: none; selections with an unknown algorithm: 0
Agility
none
Not assessed
only screened: no syntax or configuration rules for this file type
scripts/new-key.sh
closes with: a review by hand, or a witness or probe that observes the running service
Each line under Findings is one finding. From left to right:
tier: how urgent the finding is, from 1 (most urgent) to 5. Key exchange is tier 1, because traffic recorded today can be decrypted later.-means the finding is not debt, for example code that picks an algorithm at run time.stage: the step of the migration flow that fixes it. 2 is the wire, 3 is stored data, 4 is crypto agility.- The kind of finding.
legacy-useis a quantum-vulnerable algorithm in use, here RSA.capabilityis a setting that decides what a connection can negotiate;classical-onlymeans the nginx curve list offers no post-quantum group. Other kinds arepqc-use,selection,dependencyandtrust-store. - The algorithm, the file and line, and the asset.
unclassifiedmeans no asset in.pqc-anything/config.yamlcovers the file. Stage 1, mapping, counts these findings. - The path class (
product,test,vendorordoc), the text that the rule matched, and the finding id.plan,checkandfixtake that id.
Not assessed lists what the tool could not judge, and why. Here the scan
found the name RSA in the shell script, but it has no rules that read shell,
so it cannot say more. Read this list: a file in it is not a pass.
--json prints the same report as JSON:
pqc-anything scan . --json
Every JSON output starts with schema_version.
docs/json-output.md describes the JSON of each
command.
Probe an endpoint
probe connects to a TLS or SSH endpoint and reports what it really
negotiates. It contacts only the endpoints you name. Put your own host in
place of example.com:
pqc-anything probe example.com:443
The output below comes from a test server on this machine that offers
X25519MLKEM768 and X25519. You cannot run this command as it is: it needs a
server on port 8443 and its CA certificate in ca.pem. The test of this
README starts one.
$ pqc-anything probe 127.0.0.1:8443 --ca ca.pem
probe as of 2026-12-04, policy nist
127.0.0.1:8443 tls key_exchange pq-preferred signature classical lowest TLSv1.3
key_exchange negotiated X25519MLKEM768 (X25519MLKEM768) category 3
key_exchange offered X25519MLKEM768, SecP256r1MLKEM768, MLKEM768, MLKEM1024, x25519, secp256r1, secp384r1
key_exchange handshakes pqc, classical, pqc, pqc
signature negotiated ecdsa_secp256r1_sha256 (ECDSA) category -
signature offered mldsa44, mldsa65, mldsa87, ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, ecdsa_secp521r1_sha512, ed25519, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512, rsa_pkcs1_sha256, rsa_pkcs1_sha384, rsa_pkcs1_sha512
signature handshakes refused, classical, classical, classical
chain ECDSA
note: versions below TLS 1.2 are not tested
time 2026-12-04T10:08:53Z
key_exchange pq-preferred means the server chose the post-quantum group
when the client offered both kinds. signature classical means the
certificate is ECDSA. What the output means lists
every posture.
Install
The quick start installs the binary. To let your coding agents call it, register its MCP server with them:
pqc-anything setup
setup adds one MCP server entry, named pqc-anything, to each agent whose
configuration directory exists: Claude Code (through claude mcp add),
Codex, Cursor, Gemini CLI and OpenCode. Name agents to choose them, as in
pqc-anything setup cursor codex. --dry-run shows each file and the
change and writes nothing. --remove takes the entry out again. Every other
setting in the file stays, and a changed file keeps its old copy as
<file>.pqc-anything.bak. A later change that finds other content keeps
that copy too, as .bak.2, .bak.3 and so on. setup contacts no network.
To see the change for Cursor before you make it:
pqc-anything setup cursor --dry-run
Download a release
The releases page has one archive for each of these platforms:
| Target | Platform |
|---|---|
x86_64-unknown-linux-gnu | Linux on x86-64, built on Ubuntu 22.04, needs glibc 2.35 or newer |
aarch64-unknown-linux-gnu | Linux on ARM64, built on Ubuntu 22.04, needs glibc 2.35 or newer |
aarch64-apple-darwin | macOS on Apple silicon |
x86_64-apple-darwin | macOS on Intel |
x86_64-pc-windows-msvc | Windows on x86-64 |
The archive is pqc-anything-<version>-<target>.tar.gz, or .zip for
Windows. It holds the binary, LICENSE, README.md and CHANGELOG.md. One
file, SHA256SUMS, lists the checksum of each archive. Download your archive
and SHA256SUMS into one directory, and check the archive before you unpack
it:
- Linux:
sha256sum -c --ignore-missing SHA256SUMS - macOS:
shasum -a 256 -c --ignore-missing SHA256SUMS - Windows:
Get-FileHash <archive>in PowerShell, and compare the hash with the line for that archive inSHA256SUMS.Get-FileHashprints the hash in capital letters andSHA256SUMSin small letters; the case does not matter.
Then unpack it and put the pqc-anything binary on your PATH. The
release workflow also publishes the package to crates.io and npm. Once the
package is there, cargo install --locked pqc-anything and
npm install -g pqc-anything install it too, and npx pqc-anything mcp
runs the MCP server with no install.
On macOS the binary is not signed with an Apple Developer ID and not
notarized, so Gatekeeper blocks an archive that a browser downloaded. After
you check the archive and unpack it, remove the quarantine mark from the
binary: xattr -d com.apple.quarantine pqc-anything. An archive that curl
or gh release download fetched has no such mark.
Why
In December 2026 the NSA was reported to have urged faster migration to post-quantum cryptography, and eight technology companies backed US government guidance to adopt the NIST standards and to speed up the switch. Traffic captured today can be decrypted later, so the clock is already running.
Tools that inventory cryptography in code already exist. None tells you whether a migration really happened, or whether the old cryptography only became harder to see. That judgement is what this project is for.
The migration flow
Three targets: ML-KEM (FIPS 203) for key exchange, ML-DSA (FIPS 204) for signatures, AES-256 for stored data.
- Map every place that uses RSA or another quantum-vulnerable algorithm: code, web server and SSH configuration, certificates, code signing, deployed websites and servers.
- Move the wire to TLS 1.3 with the hybrid group X25519MLKEM768 (OpenSSL 3.5 or newer, or another stack that offers it), or with the group your policy requires where its minimum is higher.
- Protect stored data with AES-256.
- Build crypto agility, so the next change of algorithm is a configuration change.
The agent skill teaches this flow, so an agent works the same way in any repository.
How it is meant to work
scan inventory the cryptography in a repository or any directory, ranked by urgency
probe observe what listed endpoints really negotiate, and check it against what you expect
pcap read what the TLS and SSH handshakes in a packet capture negotiated
plan for one finding: can an agent do this, with what, and what must a human decide?
check fast, partial feedback while the agent works
fix for one finding: one small edit that adds the post-quantum kind, judged before it is written
gate compare a change with its base commit: allow / ask / deny
scan reads Go, Python, JavaScript and TypeScript, Rust, Java, C and C++, and C# source, plus
configuration, certificates and manifests; scan --list-rules prints every rule it applies.
On the labelled corpus it finds 257 of the 258 uses that its rules cover (99.6%): see docs/recall.md.
One Rust binary, usable as a CLI, as an MCP server, and through an agent skill that teaches the loop.
Install the agent skill
The skill teaches an agent the migration flow and the rules it must keep.
The MCP server offers scan, probe, plan, check, gate and fix as
tools.
Any agent that the skills CLI supports (Claude Code, Codex, Cursor, GitHub Copilot, Gemini and others):
npx skills add TANTIRA/pqc-anything
Claude Code, as a plugin:
claude plugin marketplace add TANTIRA/pqc-anything
claude plugin install pqc-anything@pqc-anything
The plugin also starts the MCP server as pqc-anything mcp in the project
that Claude Code has open, so the tools work on that project. The plugin
does not install the binary: install it first, as the
quick start says.
With the plugin installed, pqc-anything setup claude adds a second
server to Claude Code, so use one or the other.
To start the server yourself, run pqc-anything mcp in the repository to
scan. It reads requests on stdin and writes replies on stdout.
The MCP tools
| Tool | Arguments | What it returns |
|---|---|---|
scan | path (optional), a directory inside the project | the report of scan --json |
probe | none | the rows of probe --json for the endpoints in config.yaml |
plan | id, a finding id from scan | the advice of plan --json |
check | id | the answer of check --json |
gate | none | the report of gate --json for HEAD, as of today, with no approval |
fix | id | the report of fix, with the patch; it never writes |
Every tool reads the control files under .pqc-anything/ at the merge base
of HEAD and the default branch (git merge-base HEAD <default branch>).
The default branch is origin/HEAD, then main, then master. When HEAD
is on the default branch, the merge base is HEAD itself. So a change on a
work branch cannot change the configuration that the tools use. No tool lets
the caller set the base, the head, the date, the configuration file, an
endpoint or an approver. No tool writes to the project: fix returns the
patch, and the agent applies it.
Every result is marked untrusted, with a note: the paths, matched text,
reasons and network texts in it come from the repository or the network.
The agent must treat them as data, not as instructions. A gate on a
working tree that is not clean returns an error report with reason E2.
A fix that is rejected is a normal result, with the reasons. A fix that
is refused is an error result whose refused message says why; it is marked
untrusted too, because the message can name a path from the repository.
The structuredContent of a result starts with schema_version;
docs/json-output.md links its schema.
Scan a repository
scan [PATH] inventories the cryptography in a directory or, with
--commit REV, in one commit. It prints text, or JSON with --json.
Every JSON output starts with schema_version.
docs/json-output.md lists the JSON of each command
and links its schema.
--cbom <file>also writes a CycloneDX 1.7 CBOM.--sarif <file>also writes a SARIF 2.1.0 log for GitHub code scanning. It has one result for each finding. A legacy use in a product path is awarning, and an overdue finding in a product path is anerror. A waived finding, and every finding in a test, vendor or doc path, is anote, as is every other kind of finding. What the scan could not assess appears as a tool notification. Paths in the file are relative to the scanned directory, so scan the repository root for code scanning.
Both files must lie outside the scanned directory, because the tool never
writes into the directory it reads. --as-of YYYY-MM-DD sets the date.
Plan a finding
plan <ID> [PATH] gives advice for one finding. The id comes from scan.
The answer says who may make the change (eligibility):
agent: an agent may make it.agent-side-by-side: an agent may add the new algorithm beside the old one, and must not remove the old one in the same change.manual-only: only a human can do it.needs-classification: a human must first say what the asset is.no-change: the finding is already post-quantum.
It also lists the steps, the libraries to use, the files not to touch, what
blocks the work, and the expectation to raise. plan writes nothing. With
--probe, and only for key exchange in an asset that is not persisted, it
contacts the endpoints that config.yaml lists for that asset.
Check a finding
check <ID> compares one finding in the working tree with the merge base
of HEAD and the default branch. It uses the control files of the merge
base. It answers with the state of the finding and the rules that apply.
The state is one of unchanged, new, gone, moved, changed,
pqc-added, pqc-removed, removed, raised, lowered, other or
reclassified. No witness runs, so the answer is partial: only gate gives
a verdict.
plan and check exit with 0 when they answer and with 3 on an error. An
unknown id is an error.
Fix a finding
fix <ID> [PATH] makes one small edit for one finding. It adds the
post-quantum kind beside the classical one, and never removes or reorders
text. Before it writes anything, it judges the edit the way check judges a
change. If the judgment rejects the edit, nothing is written.
The patch goes to stdout as a git-style diff, which git apply reads.
--out FILE writes the patch to a file outside the tree instead. --write
edits the file in place. You cannot give both. Every message goes to stderr.
There are five codemods:
| Codemod | Finding | What it adds |
|---|---|---|
nginx-groups | ssl_ecdh_curve, or ssl_conf_command Groups or Curves, in an nginx file | X25519MLKEM768: at the start of the list |
nginx-protocols | ssl_protocols without TLSv1.3 in an nginx file | TLSv1.3 after the last protocol |
sshd-kex | KexAlgorithms in an sshd file | mlkem768x25519-sha256, at the start of the list |
go-curve-preferences | CurvePreferences in Go | tls.X25519MLKEM768, before the first element, with the package name the first element uses (tls or an alias); when the first element starts its own line, tls.X25519MLKEM768, on a line of its own with the same indentation |
node-ecdh-curve | ecdhCurve in JavaScript or TypeScript | X25519MLKEM768: at the start of the string |
When the policy's minimum category is higher, the nginx and Node codemods
add MLKEM1024 instead, and the sshd and Go codemods refuse. Line ends,
indentation and the end of the file stay as they were.
fix changes only a finding that plan lets an agent change, in a product
path that no protected glob matches. It refuses, with exit 3, when:
- the finding has no codemod, such as an RSA call in code:
plansays what to do; - the project does not show a toolchain that knows the group: Go 1.24 or
newer in
go.mod, or Node 22.20 or 24.5 or newer; - the list uses a form the codemod cannot extend safely, such as an sshd
value that starts with
+,-or^, or the OpenSSL 3.5 tuple syntax; - more than one place on the line matches the finding;
- the path is vendored, a test or doc path, a control file, or reached through a symbolic link;
- with
--write, the file changed afterfixread it.
A list that already offers a post-quantum group that the policy counts
needs nothing: fix prints
nothing to fix: the list already offers X25519MLKEM768 and exits 0. So a
second fix of the same id changes nothing. The exception is
nginx-protocols: its fix removes the finding, so a second run reports an
unknown id.
A policy counts a hybrid group such as X25519MLKEM768 only when it says
hybrid: allow. The shipped policies nist and cnsa-2.0 never reach
the cases below, but a policy of your own can:
- Under
hybrid: ask, adding a hybrid group is a human's decision.fixrejects with exit 1 when the codemod would add one, when the list holds only a hybrid post-quantum group, and when the codemod refuses for another reason, such as an unknown toolchain. - Under
hybrid: deny, a list that holds only a hybrid post-quantum group is refused with exit 3. For a classical list, the codemod still adds the hybrid group, and the judgment rejects the edit with exit 1, because the policy does not allow the new use.
Each fix prints warnings where they apply:
- nginx and sshd: run
nginx -torsshd -tbefore a reload. An older OpenSSL, nginx or OpenSSH refuses a name it does not know, andfixcannot see the version on the server. nginx-protocols: the finding is removed, sogatestill asks a human.- When the judgment says
askfor a new post-quantum use: the tool names no library for that use, sogatestill asks a human. Today this is the case for the Go and Node codemods.
fix also prints the result of its judgment: allow for nginx-groups
and sshd-kex, ask for the other three. This is not the verdict on your
change. Every accepted fix ends with
partial: no witness ran; only gate gives a verdict. Commit the fix, then
run gate.
| Exit code | Meaning |
|---|---|
| 0 | a fix was made, or there is nothing to fix |
| 1 | the judgment rejected the fix; nothing was written |
| 3 | error: an unknown id, no codemod, a refusal, or a wrong option |
An example on the sshd file of the test fixture
tests/fixtures/fix/sshd-kex. The diff is on stdout, the last four lines
are on stderr:
$ pqc-anything fix ef2450498563
--- a/etc/ssh/sshd_config
+++ b/etc/ssh/sshd_config
@@ -1,3 +1,3 @@
# KexAlgorithms is set below
Port 22
-KexAlgorithms curve25519-sha256,ecdh-sha2-nistp256
+KexAlgorithms mlkem768x25519-sha256,curve25519-sha256,ecdh-sha2-nistp256
fix ef2450498563: sshd-kex etc/ssh/sshd_config:3 adds mlkem768x25519-sha256
run `sshd -t` before a reload: an older OpenSSH refuses a name it does not know
judged as check judges a change: allow
partial: no witness ran; only gate gives a verdict
Not yet:
- codemods for Python, rustls, Java, C and C++, C#, Kubernetes Ingress, cert-manager and Terraform;
- a codemod that moves a post-quantum group to the front of a list, or that removes a pin to an old TLS version;
- code changes for stored formats and signature checks: the agent makes them by hand;
fix --all, and--jsonon the CLI (the MCP tool returns JSON).
--write is not tested on Windows.
Gate a change
gate compares a head commit with a base commit and gives a verdict. Run
it in the repository.
| Verdict | Exit code | Meaning |
|---|---|---|
| allow | 0 | the change can go to human review |
| deny | 1 | a new legacy use in a product path, a witness below its asset's expectation, or a new PQC use the policy does not allow |
| ask | 2 | a human must look; an approval can turn it into allow |
| error | 3 | nothing was judged; the reasons say why |
--base REV: the base commit. The default is the merge base ofHEADand the default branch.--head REV: the head commit. The default isHEAD, which needs a clean working tree.--as-of YYYY-MM-DD: the date of the verdict. The default is today (UTC).--approved-by NAME@COMMIT: an approval by a name listed inapproversin the baseconfig.yaml, of the last commit of the change. Give it once for each approval.--json: print JSON.
The gate reads the control files of the base commit. A change that edits
them gets a verdict no better than ask. There is no --config.
Witnesses
A witness observes what the build of the head really does. The gate runs
each witness in an exported copy of the head, with a clean environment and
a time limit (timeout_seconds, 120 by default). The script in start
must be a file under a protected path, and it comes from the base
config.yaml. The witness reading is compared with the asset's expect.
An expectation above classical needs a witness that can read it. Set
witnesses: touched at the top of config.yaml to run the witnesses only
when the change touches an asset, a dependency manifest or lock file, a
build file or the control files.
There are four kinds. Each example is one asset under assets:, in a
config.yaml that also has protected: ["scripts/pqc/**"].
handshake: the script starts your server. The gate waits until
address accepts connections, then connects as probe does and trusts
ca. The address must be 127.0.0.1, [::1] or localhost. It reads key
exchange and signature, up to pq-required.
- name: api
paths: ["server/**"]
witness:
kind: handshake
start: "scripts/pqc/run-test-server.sh"
address: "127.0.0.1:8443"
ca: "testdata/ca.pem"
expect:
key_exchange: pq-preferred
client: the script runs your client against a test server built into
the tool. It binds 127.0.0.1:0 and makes its keys in memory. The script
gets the address in PQC_ANYTHING_WITNESS_ADDRESS and the CA certificate
file in PQC_ANYTHING_WITNESS_CA. It runs three times for each dimension:
against a PQC-only server, a classical-only server, and a server that
follows the client's order. Only the handshakes that the server completed
count, not the exit code of the script. It reads key exchange and
signature, up to pq-required.
- name: billing-client
paths: ["client/**"]
witness:
kind: client
start: "scripts/pqc/call-test-server.sh"
expect:
key_exchange: pq-preferred
file: the script runs your build, which must write the certificate
file. The gate reads it: the signature must be ML-DSA at the minimum
category, and it must verify with the key of the issuer certificate ca.
ca is optional: without it, the certificate is read as self-signed and
must verify with its own key. It reads signature only, up to
pq-preferred.
- name: release
paths: ["release/**"]
witness:
kind: file
start: "scripts/pqc/build-cert.sh"
file: "out/leaf.pem"
ca: "out/ca.pem"
expect:
signature: pq-preferred
command: the script checks something the tool cannot read itself,
such as records written with AES-256. Exit 0 reads pq-preferred for its
dimension. Any other exit reads classical. Its reading is capped at
pq-preferred, the same as file, so it cannot meet a pq-required
expectation.
- name: store
paths: ["store/**"]
persisted: true
witness:
kind: command
start: "scripts/pqc/check-records.sh"
dimension: stored_data
expect:
stored_data: pq-preferred
Use in CI
The gate
The gate is authoritative only in a job that the change cannot edit. The
workflow .github/workflows/pqc-gate.yml in this repository is the tested
setup. Every action in it is pinned to a full commit SHA. It works as
follows:
- It runs on
pull_request_targetformain, and every night (17 3 * * *). It haspermissions: {contents: read, pull-requests: read}and no secrets. - It checks out the merge of the pull request (
refs/pull/<n>/merge,fetch-depth: 0,persist-credentials: false) intorepo/. The first parent of that merge is the base commit. - It checks out the base commit into
tool/(persist-credentials: false) and builds the binary there withcargo build --release --locked. So the binary comes from the base commit, never from the change. - It reads the approving reviews with
gh api --paginate repos/<repo>/pulls/<n>/reviews. Only this step has the token in its environment. The checkout steps also receive it, through the defaulttokeninput ofactions/checkout. It reads all pages with onejq -s. For each reviewer it keeps only the latest review that is not a comment, as GitHub does, so an approval that the same reviewer later replaced with "changes requested" or that was dismissed does not count. It keeps that review if its state isAPPROVEDand itscommit_idis the head commit of the pull request, and turns it into--approved-by <login>@<commit_id>. - Last, in
repo/, it runsgate --base "$BASE" --head HEADwith those approvals, piped throughtee -a "$GITHUB_STEP_SUMMARY"so the report goes to the job summary. The step setsset -o pipefail, so the exit code ofgateis the exit code of the step, not that oftee. The job fails ondeny,askanderror. - The nightly job checks out
main, builds it, and runsgate --base HEAD, so the witnesses check the recorded postures every night.
A reviewer approves the last commit of the change. An approval is tied to
the head commit of the pull request, so a new commit voids every earlier
approval. A submitted review does not start a pull_request_target run. After
the approval, re-run the pqc-gate job: the re-run reads the reviews again.
A witness runs code from the pull request inside this job: its script runs in
a copy of the change, so the server, client, build or check that it starts is
the change's own code. That code runs on the same machine as the gate. On a
GitHub-hosted runner it can read the job's token (read access to the contents
and pull requests of this repository) from the runner, and it can reach the
network. It can also write to the Actions cache of main, which matters as
soon as any workflow restores a cache. The workflow has no secrets. A
repository with witnesses should accept that, or run its witnesses somewhere
else.
The job judges nothing unless the branch rules for main make it count. Set
these rules:
- Require the
pqc-gatecheck to pass before merging. GitHub matches a required status check by its name, and a pull request can add its own workflow with a job namedpqc-gate. So prefer a ruleset rule that requires this workflow file,.github/workflows/pqc-gate.ymlonmain("Require workflows to pass before merging"), to a bare check name. It is not yet confirmed on GitHub that this rule stops a job with the same name from passing in place of the real one. - Require branches to be up to date before merging. The job judges the merge
of the pull request with
mainas it was when the job ran. Ifmainmoves, the pull request must be updated and judged again. - Require an approving review from someone other than the author, and list
that person in
approversin.pqc-anything/config.yaml.
The workflow has no merge_group trigger, so it does not work with a merge
queue: the queue waits for a pqc-gate result on its own merge commit, and
this workflow never reports one there. Use the up-to-date rule instead.
GitHub does not let the author approve their own pull request. A team of one
can only use the gate as a checklist: it shows each ask, but no approval
can turn it into allow.
Code scanning
This workflow scans the repository on every push to main and on every pull
request, and uploads the result to GitHub code scanning. Save it as
.github/workflows/code-scanning.yml. Replace the uses: pins with current
full commit SHAs of the actions, and build or install pqc-anything as your
project needs. The workflow in this repository builds it from source. It
keeps its SARIF file as a build artifact and does not upload it: this
repository's rule files and tests name every algorithm, so its own alerts
are not findings.
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
security-events: write
actions: read # private repositories only
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: cargo build --release --locked
- run: target/release/pqc-anything scan . --as-of "$(date -u +%F)" --sarif "$RUNNER_TEMP/pqc-anything.sarif"
- uses: github/codeql-action/upload-sarif@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
with:
sarif_file: ${{ runner.temp }}/pqc-anything.sarif
category: pqc-anything
To read the alerts, open the Security tab of the repository and choose
Code scanning. Filter by the tool pqc-anything. An alert with severity
error is an overdue finding in a product path. A warning is a legacy
use in a product path. A note is a waived finding, a finding in a test,
vendor or doc path, or another kind of finding. What the scan could not assess
is not an alert. It is listed in the details of the workflow run. Code
scanning on a private repository needs GitHub Code Security.
Probe endpoints
probe connects to TLS or SSH endpoints and reports what they really
negotiate. It does not read your code. Run it in the project directory.
Which endpoints
Type each endpoint as host:port. Write an IPv6 address in brackets, as
[v6]:port, in quotes so that the shell does not read the brackets:
pqc-anything probe api.example.com:443 '[2001:db8::1]:8443'
To probe a longer list, give --targets <file>. The file has one address
per line. A # starts a comment. The tool refuses ranges, CIDR blocks and
wildcards, in the file and on the command line: you name every endpoint.
Plain pqc-anything probe, with no endpoint and no --targets, probes the
endpoints listed under the assets in .pqc-anything/config.yaml:
assets:
- name: api-tls
endpoints:
- address: "api.example.com:443"
server_name: "api.example.com" # optional
ca: "certs/internal-root.pem" # optional
expect: { key_exchange: pq-preferred }
If no endpoint is typed, given in a file or listed in the config, the command stops with exit code 3 and says where to list them.
Options
--sshreads the SSH key-exchange offer instead of TLS. It needs typed endpoints or--targets, and you cannot use it with--expector--ca.--jobs Nprobes N endpoints at once, from 1 to 64. The default is 4.--timeout MSis the time limit for each connection step, in milliseconds, from 100 to 120000. The default is 5000. A step is the name lookup plus the connection, or one handshake. A lookup that takes longer stops with an error that names the host.--ca <file>is a PEM file of CA certificates to trust for endpoints that are not inconfig.yaml. An endpoint inconfig.yamluses its owncafile, if it has one. Otherwise the tool trusts the bundled web roots.--cbom <file>also writes a CycloneDX 1.7 CBOM. The file must lie outside the current directory.--jsonprints JSON instead of text.--config <file>reads aconfig.yamlkept outside the directory, and--as-of YYYY-MM-DDsets the date for the expectations.
For example, to probe the endpoints listed in endpoints.txt, eight at a
time, with a limit of two seconds for each step:
pqc-anything probe --targets endpoints.txt --jobs 8 --timeout 2000
What the output means
A TLS endpoint gets a posture for each of two dimensions: key_exchange
and signature. An SSH endpoint gets one, for key exchange. A posture is
one of four values, from weakest to strongest:
| Posture | Meaning |
|---|---|
classical | The endpoint does not accept post-quantum cryptography. |
pq-offered | It accepts post-quantum cryptography, but prefers the classical kind when the client offers both. |
pq-preferred | It accepts both kinds and chooses post-quantum cryptography when the client offers both. |
pq-required | It accepts only post-quantum cryptography. |
The tool reads each posture from separate handshakes: one that offers only
post-quantum algorithms, one that offers only classical ones, and one that
offers both. An SSH server only lists what it accepts, so an SSH reading
is never pq-preferred.
An example against a test server on this machine that offers
X25519MLKEM768 and X25519. It is listed in .pqc-anything/config.yaml with
the CA of that server:
assets:
- name: api-tls
endpoints:
- address: "127.0.0.1:8443"
ca: "ca.pem"
expect: { key_exchange: pq-preferred }
$ pqc-anything probe --expect
probe as of 2026-12-04, policy nist
127.0.0.1:8443 tls key_exchange pq-preferred signature classical lowest TLSv1.3
asset api-tls
key_exchange negotiated X25519MLKEM768 (X25519MLKEM768) category 3
key_exchange offered X25519MLKEM768, SecP256r1MLKEM768, MLKEM768, MLKEM1024, x25519, secp256r1, secp384r1
key_exchange handshakes pqc, classical, pqc, pqc
signature negotiated ecdsa_secp256r1_sha256 (ECDSA) category -
signature offered mldsa44, mldsa65, mldsa87, ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, ecdsa_secp521r1_sha512, ed25519, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512, rsa_pkcs1_sha256, rsa_pkcs1_sha384, rsa_pkcs1_sha512
signature handshakes refused, classical, classical, classical
chain ECDSA
note: versions below TLS 1.2 are not tested
expectation key_exchange pq-preferred: met
expectation signature classical: met
time 2026-12-04T10:09:19Z
Expectations and exit codes
--expect compares each TLS endpoint with the expectations in
config.yaml. The exit codes are:
- 0: every endpoint was read, and, with
--expect, every expectation is met. - 1: with
--expect, an endpoint is below its expectation. - 3: an endpoint could not be read, or the command could not run.
When both 1 and 3 apply, the exit code is 1: a missed expectation is the more important result.
The MCP tool
The MCP tool probe takes no arguments, so the agent cannot choose what to
contact. It reads the endpoints from config.yaml at the merge base (see
The MCP tools), so a change on a work branch cannot add
endpoints to the list.
Read a packet capture
pcap <FILE> reads the TLS and SSH handshakes in a capture file and
reports what each connection negotiated. It reads classic pcap and pcapng
files, for example from tcpdump -w or Wireshark. It finds TLS and SSH on
any port, by their first bytes. It never connects to anything and writes a
file only with --cbom. It uses the built-in algorithm list, so --config does not
apply.
pqc-anything pcap capture.pcapng
--cbom FILE also writes a CycloneDX 1.7 CBOM of the algorithms the
connections negotiated, with the session and packet of each. FILE must not be
the capture itself. The capture has no date, so the BOM has no timestamp.
Sessions and counts that could not be read go into metadata.properties.
Each session gets a block. The first line is the number of its first
packet, the client and the server, the protocol and, for TLS, the version
and the server name. Then come two lines, key_exchange and signature,
each with the negotiated name and its kind: classical, hybrid, pqc,
pre-standard or unknown. When a value cannot be read, the line says
not-assessed and why. offered lists what the client offered. At the end
come the counts that are not zero, one line each: the number of packets read,
then what the tool did not read, for example connections that were not
handshakes, or connections whose first bytes are missing from the capture.
An example with the capture in this repository:
$ pqc-anything pcap tests/fixtures/pcap/three-sessions.pcap
pcap tests/fixtures/pcap/three-sessions.pcap: 3 sessions
#1 10.0.0.1:40001 -> 10.0.0.2:443 tls 1.3 server_name example.test
key_exchange X25519MLKEM768 (hybrid)
signature not-assessed: TLS 1.3 encrypts the certificate
offered X25519MLKEM768, X25519
#2 10.0.0.3:40002 -> 10.0.0.4:8443 tls 1.2 server_name example.test
key_exchange P-256 (classical)
signature ECDSA (classical)
offered P-256
#3 10.0.0.5:40003 -> 10.0.0.6:22 ssh
key_exchange mlkem768x25519-sha256 (hybrid)
signature ssh-ed25519 (classical)
offered mlkem768x25519-sha256, curve25519-sha256
23 packets were read
--json prints the same as JSON: schema_version, file, sessions,
counts and, when the file could not be read to its end, error.
What it cannot read:
- The signature of a TLS 1.3 session. TLS 1.3 encrypts the certificate.
- A resumed TLS 1.2 session. It has no key exchange of its own.
- QUIC and HTTP/3. Their handshake is encrypted.
- STARTTLS, where TLS starts inside another protocol. Such a connection is counted as not a handshake.
- A connection whose start is not in the capture. When the capture shows that its first bytes are missing (a lost packet, a cut packet or the buffer limit), it is counted as a connection that could not be read. Otherwise, for example when the capture began mid-stream, it is counted as not a handshake.
- A capture of one direction only. A session needs both directions of its connection; with only the client's packets it is listed as not assessed. Each such connection also stays open to the end of the file and keeps its buffer, so past about 4 000 of them later connections are counted as not read because of the buffer limit.
The exit codes are:
- 0: the file was read to its end. Sessions that could not be assessed are listed and do not change the exit code.
- 3: the file cannot be opened, is not pcap or pcapng, is damaged, or ends inside a packet, or reading it fails part of the way. The sessions read before the problem are still printed, followed by the error.
Exit codes
Each command exits with one of these codes. A wrong option, and a bug the tool catches, are exit 3 for every command.
| Command | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
scan | the scan ran | with --check-targets, a target date passed and its target is missed | - | error |
probe | every endpoint was read and, with --expect, every expectation is met | with --expect, an endpoint is below its expectation | - | an endpoint could not be read, or error |
pcap | the file was read to its end | - | - | the file could not be read to its end, or error |
plan, check | an answer | - | - | error, such as an unknown id |
fix | a fix was made, or there is nothing to fix | the judgment rejected the fix; nothing was written | - | error or refusal |
gate | allow | deny | ask | error: nothing was judged |
setup | every agent was set up | - | - | error |
mcp | the client closed the connection | - | - | error |
Principles
- A ratchet, not a wall. New legacy cryptography and regressions are blocked. What was already there is reported as debt and never blocks a change. You can set target dates, which a scheduled check enforces.
- Only what is observed counts. New post-quantum code in the source is not a migration, and legacy code that is gone from the source is not a fix. A posture counts where a check observes it.
- Two moments of judgement. Before merge, the gate runs a check on the build and says it is capable. After deployment, the probe says the real endpoint does it. The tool never claims the second from the first.
- Nothing is skipped silently. What the tool could not assess is listed in every verdict, and leads to "ask" where it touches cryptography.
- Old and new side by side is valid for key exchange during a transition. For signatures it is progress but still debt, until the verifier refuses the old kind.
- A human approves every step. The agent does the work. A named approver confirms each raised expectation and each legacy use that leaves the code. After that the tool holds the recorded posture without help. In CI, a change that loses it is denied. On a deployed endpoint, the scheduled probe fails.
- All five NIST security categories. Every algorithm carries its NIST category (1 to 5). You set the minimum you require, up to category 5 (ML-KEM-1024, ML-DSA-87), per repository or per asset.
- No home-made cryptography. The tool recommends only libraries that implement published standards: FIPS 203, 204 and 205, the stateful hash signatures of NIST SP 800-208, and the IETF hybrid groups. Its own checks use such a library. Where that library cannot check an algorithm (SLH-DSA, LMS and XMSS today), the tool says so and runs a command you supply instead, which counts for less than its own check.
- It edits your code only when you ask.
fix --writeis the only command that changes a file in the scanned tree, and only after its judgment accepts the edit. Options such as--out,--cbomand--sarifwrite only the files you name, outside the tree. No MCP tool writes.
Limits you should know
- The gate is authoritative only in a CI job that the change cannot edit. Anywhere else its verdict is advice.
- The tool sees only the files, endpoints and exports it is given.
- A posture is protected from the moment it is recorded, not before.
pcapreads only what is in the capture. It cannot read encrypted handshakes, such as TLS 1.3 certificates and QUIC.- A witness runs code from the pull request inside the gate's CI job. On a GitHub-hosted runner that code can read the job's read-only token. Accept that, or run the witnesses somewhere else.
- Witnesses do not run on Windows. There a
gatewith witnesses is an error (E4) that says to rungatein a Linux CI job.gatewithout witnesses,checkandplanwork on Windows.fix --writeis not tested on Windows. - An nginx
ssl_conf_commandline withMaxProtocol,MinProtocolorProtocolgives no finding. A change that caps TLS below 1.3 this way passes a gate that only scans. An asset with a witness is covered. - The tool opens a
--cbom,--sariforfix --outfile once and does not follow a link at its name. It does not guard against a change to the directories above that file while it runs. Do not write a report into a directory that other users can change, or below one. On Windows the check for a link is made by name just before the file is opened, and a second name for the same file (a hard link) is not found. - There is no release archive for musl Linux or for Windows on ARM. Build from source on those, as the quick start says.
pcapreads a capture of one direction only badly when it has more than about 4 000 connections. It keeps up to 64 KiB for each open direction, and a direction that never answers stays open to the end of the file. Past the 256 MiB buffer limit, later connections are not read. They are counted as connections that could not be read, and that count line names the buffer limit. Thestreams_refusedcount is only for a stream that kept some bytes and was then refused.
Security, changes and review
- To report a vulnerability, follow SECURITY.md.
- CHANGELOG.md lists the changes. Each release gets its own part, starting with the first.
- docs/review/cheat-the-gate.md is the brief for a reviewer who tries to cheat the gate.
Not affiliated
This project is not part of, or endorsed by, the Post-Quantum Cryptography Alliance (PQCA) of the Linux Foundation.
Support the project
Donations are welcome and optional. Send SOL or USDC only, on the Solana network, to:
GPf6gMQWDxPwADKdAbz39JV2owoz3ZyjnamMCEKmENSx
Check every character of the address before you send. A transfer cannot be undone.
License
Apache-2.0. See LICENSE.
pqc-anythingnpm install pqc-anything