ammachado opened a new pull request, #31302:
URL: https://github.com/apache/camel/pull/31302

   # Description
   
   Fixes [CAMEL-27960](https://issues.apache.org/jira/browse/CAMEL-27960): the 
camel-pqc defects found while improving the option descriptions for CAMEL-23832 
(#31196).
   
   **1. keyStore without keyPairAlias gave a NullPointerException.** `keyStore` 
is autowired, so one KeyStore bean in the registry made the component skip the 
default key material, while the producer only read the KeyStore with 
`keyPairAlias` and `keyStorePassword` set. Now:
   - the default material is skipped only when `keyStore` and `keyPairAlias` 
are both set; an autowired `keyStore` without an alias is ignored;
   - a `keyStore` or `keyStorePassword` on the endpoint URI without 
`keyPairAlias` fails the endpoint;
   - with `keyPairAlias`, the producer fails at start when `keyStore`, 
`keyStorePassword` or the private key entry is missing, the password is wrong, 
or the alias is a secret key;
   - sign, verify and the KEM operations fail at start when no key pair is 
configured (an autowired `signer` or `keyGenerator` also skips the default key 
pair), instead of a NullPointerException on the first exchange.
   
   **2. keyRotationMaxAge counted whole days.** The five key lifecycle managers 
now compare `KeyMetadata.getAge()` (new) with `maxAge`, so a max age below one 
day works and `90d` rotates at 90 days, not 91.
   
   **3. Smaller issues.**
   - `CamelPQCSignature` is declared as `byte[]`, the type sign sets and verify 
reads.
   - `classicalKeyPair` and `classicalSigner` are no longer autowired: one 
`KeyPair` or `Signature` bean filled both the PQC and the classical slot.
   - With `keyRotationSchedulerEnabled=true`, a `keyLifecycleManager` set only 
on endpoints gets its own scheduler (one per manager, kept across a component 
restart); the component no longer fails to start without a component-level 
manager and logs a warning instead.
   - `exportKey` exports the key named in `CamelPQCKeyId` when the header is 
set; a blank header, or no header and no endpoint key pair, fails. 
`CamelPQCKeyId` and `CamelPQCIncludePrivate` are documented as control headers 
that must not be set from untrusted input (they are in the filtered `Camel*` 
namespace, see the security model).
   
   All behavior changes are in the 4.25 upgrade guide. 
`PQCKeyLifecycleTest#testNeedsRotationByAge` asserted the old whole-day 
truncation and was updated.
   
   **Tests:** new `PQCKeyStoreWithoutAliasTest`, `KeyRotationMaxAgeTest` (all 
five managers; AWS, Azure and Vault with mocked clients), 
`PQCHybridClassicalNotAutowiredTest`, plus scheduler and exportKey cases in 
`KeyRotationSchedulerTest` and `PQCKeyLifecycleIntegrationTest`. The new tests 
fail against the code before the fix. `mvn install` of `components/camel-pqc`: 
525 tests, 0 failures, 0 skipped. The Vault and AWS ITs (containers) were not 
run.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   Built `components/camel-pqc` only (not the root), committed its generated 
files, and synced the identical catalog copies (`components/pqc.json`, 
`docs/pqc-component.adoc`, `docs/pqc-key-lifecycle.adoc`) by hand instead of 
building `catalog/camel-catalog` with `-pl`.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
Adriano Machado (@ammachado)
   
   _This was generated by an AI agent and may contain inaccuracies. Please 
verify before relying on it._


-- 
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]

Reply via email to