Skip to content

docs: OpenPGP v6 and post-quantum keys for KyPost (spec) - #743

Queued
Yoshiofthewire wants to merge 5 commits into
mainfrom
docs/pqc-openpgp-v6-spec
Queued

Yoshiofthewire wants to merge 5 commits into
mainfrom
docs/pqc-openpgp-v6-spec

Conversation

@Yoshiofthewire

Copy link
Copy Markdown
Member

In one line: a proposed design for moving KyPost to OpenPGP v6 with post-quantum keys. Docs only; nothing is built, and twelve owner questions decide the rest.

What changed

  • New spec docs/superpowers/specs/2026-11-25-pqc-openpgp-v6-design.md.
  • An inventory of every OpenPGP use on main (928ba0be) and in the Android, Mac/iOS and Linux clients, with file and line references.
  • A two-certificate design. Each account keeps its v4 certificate as its public identity and gains a v6 certificate: ML-DSA-65+Ed25519 for signing and ML-KEM-768+X25519 for encryption (RFC 9580 and RFC 9980, both final). The v6 certificate covers mail at rest, Sent, drafts and mail between KyPost users.
  • Mixed recipients: each recipient gets the best certificate they publish, split into separate delivery groups. Classical recipients are marked "not quantum-safe".
  • Phases P0-P5. P2 moves the device-enrollment envelope from P-256 to X-Wing HPKE. That envelope carries the account private key through the server, so it is the largest harvest-now-decrypt-later exposure.

Review this

  • The "Owner questions" section, especially Q1 (recipients who can't read v6/PQC), Q3 (publishing v6 outside), Q5 (openpgp.js v7 is unreleased) and Q6 (the Linux client's GnuPG cannot read v6).
  • The "Linux gate" and "Generating and rolling out" steps. Incoming encryption switches to v6 only when every enrolled device reports it can read v6, so no device loses its own mail. If that gate is wrong, users lose mail.

Checked: these were re-read against primary sources:

  • the RFC 9980 header (Standards Track, June 2026)
  • go-crypto v1.5.2's algorithm IDs 30-36 (openpgp/packet/packet.go:520-536)
  • gopenpgp v3.5.2's PQC() profile
  • Go 1.27.4's crypto/hpke.MLKEM768X25519

Server line references were spot-checked in code: pgpClient.ts:63-68, mime.go:179, pgp_device_delivery.go:78, identity.go:103, pgp_client_keys.go:18, pgp_device_enrollment.go:53.

Not checked:

  • Client line numbers. A sub-agent reported them read-only from each client's origin/main, and they are marked "reported".
  • PQC certificate sizes. They are arithmetic estimates.
  • Apple CryptoKit PQ availability. Only the documentation page titles were read.
  • Nothing was run.

Decided for you: the spec is a new file and leaves docs/E2E_PGP.md and docs/PGP_KEY_LIFECYCLE.md untouched until the owner answers. The doc drift it found is listed under P0 and not fixed here.

You need to: answer Q1-Q12. P3-P5 change what users' keys and mail can do, so each of those phases waits for your merge approval.

Detail
  • Sources: ky-primitives/docs/superpowers/specs/2026-11-25-pqc-research.md (primary-source research) and ky-primitives/docs/superpowers/specs/2026-11-25-pqc-stack-plan.md (the suite-wide plan), both in the companion ky-primitives PR.
  • Findings that shape the design:
    • The browser is the only key generator, and openpgp.js 6.3.3 has no PQC; its pqc_* enums are pre-RFC code points 105/107.
    • The server has no algorithm allowlist on uploaded keys.
    • Signer binding parses every contact key on every bootstrap and every opened message, which PQC key sizes would turn into an 18 MB bootstrap at 1,000 contacts.
    • A PQC certificate (~13.8 KB) can never fit Autocrypt's 10 KiB header.
    • All mail stored so far stays classical unless re-encrypted client-side.
  • docs/superpowers/ is in .gitignore. The file is force-added, as the other specs are.

🤖 Generated with Claude Code

Inventory of every OpenPGP use on origin/main (928ba0b) and the three
clients, a two-certificate design (keep v4, add a v6 ML-DSA-65+Ed25519 /
ML-KEM-768+X25519 certificate under RFC 9580 and RFC 9980), phases P0-P5
and twelve owner questions. Docs only; nothing is built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Yoshiofthewire commented Nov 26, 2026 •

Copy link
Copy Markdown
Member Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪

🧪 No relevant tests

⚡ Recommended focus areas for review

Migration coverage

Selecting only messages whose PKESKs name the user's v4 key misses multi-recipient ciphertext, such as a Sent copy encrypted to both the sender and outside recipients. Those messages remain decryptable by the user but would never enter the migration, despite P6 promising to migrate Sent mail. Select messages decryptable by the account's historical keys even when other recipient PKESKs are present, and include a multi-recipient Sent fixture in the migration checks.


Advisory only: this comment never gates the pull request.
gpt-6.1-sol using pr-agent on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 26, 2026 •

Copy link
Copy Markdown
Member Author

Security review - cleared

Detail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kypost-server-743, where it is readable by the operator and expires seven days after the last post.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 26, 2026 •

Copy link
Copy Markdown
Member Author

Autonomous review - 1/1 personas cleared

  • security: cleared

Merging remains a human decision; this bot never approves.


gpt-6.1-sol using security-audit on behalf of Yoshi

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Yoshiofthewire and others added 3 commits November 25, 2026 21:23
…back, archive to v6)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire
Yoshiofthewire added this pull request to the merge queue Nov 26, 2026
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant