Commit 373c90f
v1.1: switch hybrid KEM combiner from pqf1-bind-extract-v1 to X-Wing
Drops PQF's last in-house cryptographic construction and replaces it with
the standardized X-Wing combiner (draft-connolly-cfrg-xwing-kem) — the
fix two external reviewers (ChatGPT, Grok) flagged as F2 in their
preprint reviews. Wire-incompatible break from spec v0.5; the file
format version byte stays v1 (0x0001) but the alg-map exact-match values
and recipient byte-string sizes change, so v0.5 and v1.1 readers
mutually refuse at the algorithm-identifier check.
Why X-Wing, why now:
- External IND-CCA proofs in ROM and QROM (Barbosa, Boyen, Connolly,
Schwabe, Stehle, Strub, 2024). PQF's pqf1-bind-extract-v1 combiner
had no formal model end-to-end; deleting it removes that ask from
every future reviewer.
- The SHA3-256 combiner binds both ct_X and pk_X explicitly into the
KEM transcript by spec, not by PQF-author judgment.
- ML-KEM-768 is required by the X-Wing parameter set. Trading the
Category 5 -> Category 3 margin for the elimination of a bespoke
combiner is the right call for a file format whose realistic threat
is harvest-now/decrypt-later (the symmetric layer is AES-256-GCM).
Combiner (spec v1.1 §2.4):
KEK = SHA3-256( "\.//^\" || ss_M || ss_X || ct_X || pk_X )
where the label is the 6-byte literal ASCII art 5C 2E 2F 2F 5E 5C (NOT
the string "X-Wing"), ss_M is the ML-KEM-768 shared secret, ss_X is the
X25519 shared secret, ct_X is the X25519 ephemeral public key, pk_X is
the recipient's X25519 long-term public key.
Wire deltas vs v0.5:
- alg.combiner: pqf1-bind-extract-v1 -> x-wing
- alg.kem: x25519+ml-kem-1024 -> x25519+ml-kem-768
- recipients[i].pqc_ct: 1568 -> 1088 bytes (ML-KEM-768 ciphertext)
- canonical encryption public key: 1601 -> 1217 bytes
(1 + 32 X25519 + 1184 ML-KEM-768)
- DEK-wrap AEAD AAD: file_id (16) -> file_id (16) || recipient_index
(u32 BE). X-Wing's combiner has no salt slot so per-file and
per-recipient binding moves to the AEAD layer; cross-recipient
isolation properties (spec sec.8.5, sec.8.7) preserved.
Preserved from the 13 upstream commits this merges on top of:
- HybridSigner domain separation ("PQF1-header-sig-v1",
"PQF1-file-sig-v1") and all its call sites in PqfFileWriter,
AuthenticatedModeDecryptor, StreamingModeDecryptor, and the Rust
reader+writer.
- PqfFileWriter.ReadAtLeastAsync chunk-fill fix (F5).
- TV-NEG-023..033 header-schema refusal vectors (47 total).
- docs/SECURITY-OVERVIEW.md, docs/REVIEWER-PACKET.md,
docs/REVIEW-REQUEST.md.
- Bindings .gitignores, pyo3 gil-refs feature flag.
Code:
- New src/PostQuantum.FileFormat/Crypto/XWingKem.cs implementing the
draft byte-for-byte.
- Rewritten HybridKem.cs as a thin shim over XWingKem.
- HkdfCombiner.cs reduced to per-chunk HKDF expansion only
(DeriveKek deleted).
- DekWrapper.cs takes recipient_index, AAD = file_id || idx_be4.
- ICryptoProvider/BouncyCastle/BCL providers switched to MlKem768*
(BCL reflection bridge probes MLKemAlgorithm.MLKem768).
- PqfPublicKey CanonicalByteLength 1601 -> 1217; PqfIdentity stores
the ML-KEM-768 secret key.
- Rust pqf-reader and pqf-writer: ml-kem-768 in the same crate,
added sha3 dep, X-Wing combiner inline. Reader's Header carries
an Alg struct so bindings expose the validated alg-map values.
Verified locally:
- dotnet test PostQuantum.FileFormat.sln: 145 passed / 3 skipped / 0
failed, plus CLI 6/6.
- Rust pqf-conformance: 47/47 (14 positive + 33 negative) against the
regenerated .NET-produced vectors.
- Rust pqf-writer roundtrip: 6/6 (4 cross-impl roundtrips + 2 unit,
including a byte-pin test of the 6-byte X-Wing label).
- Bindings: bindings/python and bindings/wasm both cargo-check clean.
Caveat:
- XWingKemTests pins the byte-correct label and exercises encap/decap
+ ct_X/pk_X binding tampering, but is still self-consistency only.
Running draft-connolly-cfrg-xwing-kem reference vectors through both
impls is the highest-value follow-up before 1.0.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1f759c5 commit 373c90f
122 files changed
Lines changed: 1228 additions & 1053 deletions
File tree
- .github/workflows
- bindings
- python
- src
- wasm/src
- cli/PostQuantum.FileFormat.Cli
- docs
- internal
- impl/rust
- pqf-reader
- src
- bin
- pqf-writer
- src
- tests/fixtures
- man
- scripts
- spec
- ietf
- symbolic
- src/PostQuantum.FileFormat
- Crypto
- File
- Keys
- test-vectors
- nist-kat
- v1
- cases
- tests
- PostQuantum.FileFormat.Differential
- PostQuantum.FileFormat.Kat
- PostQuantum.FileFormat.TestVectors
- PostQuantum.FileFormat.Tests
- Armor
- Crypto
- File
- Fingerprint
- Integration
- Keys
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
67 | | - | |
| 67 | + | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | | - | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
42 | 39 | | |
43 | 40 | | |
44 | 41 | | |
| |||
117 | 114 | | |
118 | 115 | | |
119 | 116 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 117 | | |
143 | 118 | | |
144 | 119 | | |
| |||
147 | 122 | | |
148 | 123 | | |
149 | 124 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 125 | + | |
| 126 | + | |
155 | 127 | | |
156 | 128 | | |
157 | 129 | | |
| |||
176 | 148 | | |
177 | 149 | | |
178 | 150 | | |
179 | | - | |
180 | | - | |
| 151 | + | |
181 | 152 | | |
182 | 153 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments