gnodet commented on PR #31032: URL: https://github.com/apache/camel/pull/31032#issuecomment-7224863390
Thank you @davsclaus for the thorough review! All points have been addressed in the latest commit: **1. Header values aligned with shared v2 format** Updated to `WIRE_VERSION = 0x02` and `FORMAT_TYPE_KEM = 0x03` (matching the table in `pqc-hybrid.adoc`, which already had the `0x03` row for KEM data encryption added in this PR). **2. Header authentication (AAD)** The 8-byte header is now bound as AAD on both the marshal side (`cipher.updateAAD(header)`) and the unmarshal side (`cipher.updateAAD(headerBytes)`). Additionally, when an algorithm ID in the header is known and differs from the configured algorithm, an `IOException` is thrown with a message like "encrypted with KEM algorithm X but the configured algorithm is Y" — no need to guess the algorithm from a generic tag failure. **3. Docs updated** Both `pqc-dataformat.adoc` and `pqc-hybrid.adoc` are updated. The stale NOTE about retaining v1 is removed from `pqc-hybrid.adoc`. The `pqc-dataformat.adoc` now shows the full v2 layout including the header. The catalog copies under `catalog/camel-catalog/` are regenerated. **4. Upgrade guide** Scoped to 4.22 and 4.23 (the authenticated v1 format only exists since 4.22 — data from earlier versions used unauthenticated ECB and cannot be read by 4.22+). The rolling-upgrade advice (readers first, then writers) is included, positioned next to the existing "Hybrid wire format v2" entry. **Smaller items** - `readNBytes(2)` with `unread(peek)` already in place — no partial-read risk. - `DSTU7624` and `GOST3412-2015` now have entries in `PQCAlgorithmId` (`0x050C` and `0x050D`), so the header carries a valid ID for them. - Tests for truncated header (1, 2, 7 bytes), unsupported version byte, unsupported format-type byte, and algorithm mismatch are all added in `PQCDataFormatWireFormatTest`. A tampered-header test (bit flip in KEM alg ID field) confirms the AAD binding rejects the modified message. - `fmt.stop()` is in `finally` blocks in all test methods. _Claude Code on behalf of gnodet_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
