ramu11 commented on PR #30945: URL: https://github.com/apache/camel/pull/30945#issuecomment-7276666227
> Thanks, this round closes the fail-open: `getStatefulKeyRemaining` / `getStatefulKeyIndex` now throw for LMS/HSS/XMSS/XMSSMT keys when neither API layout links, and `unavailableStatefulApiFailsClosedForStatefulKeys` locks it in through the new `StatefulApi` seam. The duplicate ML-DSA/ML-KEM/CMCE sets are gone, KYBER now resolves to a `NamedParameterSpec` like MLKEM (the names accepted are a superset of what `MLKEMParameterSpec.fromName` took on main), and `Bc187Access` imports the 1.87 types. CI is green, including the compatibility job. > > Two optional robustness points (both raised by oscerd as well), not blocking: > > * `ApiHolder.detectApi` (`BouncyCastlePqcCompatibility.java` ~81-90) catches only `LinkageError`, but `verifyAvailable()` builds real specs. An `IllegalArgumentException` from a future BC would escape the static initializer (every later access gets `NoClassDefFoundError`) and skip the 1.86 tier; `catch (LinkageError | RuntimeException e)` per tier would fall back to the next tier or `UNAVAILABLE` instead. > * `Bc187Access` / `Bc186Access.getStatefulKeyRemaining` still return `-1` for a key whose algorithm is LMS/XMSS but that matches no `instanceof`, which skips the claim and exhaustion checks. main did the same and BC keys always match today, but this PR exists for a future BC that changes its types; throwing there when `isStatefulKey(...)` is true would match the `UNAVAILABLE` branch. > > Cosmetic: `components/camel-pqc/pom.xml` has extra blank lines after the Micrometer dependency and before `</dependencies>`, and the PR description still lists removing the `camel-pqc-bc-compat-*` modules and the ServiceLoader discovery, which never existed on main. > > As said earlier, the merge waits until 4.24.0 is out. > > _Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying._ Thanks for the follow-up review. I've addressed both optional robustness points in commit `29f5830d6ef2`. 1. **Capability detection:** `ApiHolder.detectApi()` now catches both `LinkageError` and `RuntimeException` for each API probe. If the BC 1.87 probe fails at runtime, the BC 1.86 fallback is still attempted. If both probes fail, compatibility resolves to `UNAVAILABLE` rather than leaving the holder's class initialization in an erroneous state. 2. **Stateful-key type validation:** Both `Bc187Access` and `Bc186Access` now fail explicitly when a key reports LMS, HSS, XMSS, or XMSSMT but does not implement the expected Bouncy Castle private-key interface. They no longer return `-1` or `0` for these stateful algorithms. Added regression coverage for all four algorithms. Also addressed the remaining observations: - Removed the extra blank lines in `components/camel-pqc/pom.xml`. - Corrected the PR description to reflect the actual changes against `main`, removing historical claims about adapter-module removals and `ServiceLoader` discovery. - The KEM metadata change to `javax.crypto.SecretKey` is already documented in the Camel 4.24 upgrade guide. **Validation passed:** - PQC test suite: **477 tests, 0 failures, 0 errors, 0 skipped**. - Bouncy Castle compatibility check: `CAMEL-PQC BOUNCY CASTLE COMPATIBILITY CHECK PASSED`. The changes are pushed to the existing PR branch in commit `29f5830d6ef2`. Thanks for the thorough review. I understand the merge timing noted in your review. -- 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]
