[ 
https://issues.apache.org/jira/browse/CAMEL-27960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27960:
--------------------------------
    Description: 
Found while improving the option descriptions of camel-pqc for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/b03d1ed7628336a767e986b3dc2fb603a72b0b5c,
 pull request https://github.com/apache/camel/pull/31196).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. keyStore without keyPairAlias and keyStorePassword
{{PQCComponent.createEndpoint}} skips the default key material as soon as 
keyStore is set (keyStore is autowired, so one KeyStore bean in the registry is 
enough), but {{PQCProducer.doStart}} only reads the KeyStore when keyPairAlias 
and keyStorePassword are also set. keyPair stays null and signing fails with a 
NullPointerException at initSign(keyPair.getPrivate()).
Proposed change: skip the default material only when keyStore and keyPairAlias 
are both set, and fail in doStart with a clear message when keyStore is set 
without them.

h4. 2. keyRotationMaxAge counts whole days
needsRotation of the 5 key lifecycle managers (for example 
{{FileBasedKeyLifecycleManager}}) compares metadata.getAgeInDays() > 
maxAge.toDays(): a maxAge below one day becomes 0 (rotation after the first 
full day), and 90 days rotates when the key is 91 full days old. The 
description now says whole days.
Proposed change: compare Duration.between(createdAt, now) with maxAge.

h4. 3. Smaller issues
The CamelPQCSignature header declares javaType String, but sign sets a byte[] 
and verify reads a byte[]. keyPair and classicalKeyPair are both autowired 
KeyPair, and signer and classicalSigner both autowired Signature, so one 
registry bean fills both the PQC and the classical slot. The key rotation 
scheduler only uses a keyLifecycleManager set on the component; with 
keyRotationSchedulerEnabled=true and the manager set only on endpoints the 
component fails to start. exportKey exports the key pair of the endpoint, not 
the key named by CamelPQCKeyId.


_Claude Code on behalf of davsclaus_

  was:
Found while improving the option descriptions of camel-pqc for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31196).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. keyStore without keyPairAlias and keyStorePassword
{{PQCComponent.createEndpoint}} skips the default key material as soon as 
keyStore is set (keyStore is autowired, so one KeyStore bean in the registry is 
enough), but {{PQCProducer.doStart}} only reads the KeyStore when keyPairAlias 
and keyStorePassword are also set. keyPair stays null and signing fails with a 
NullPointerException at initSign(keyPair.getPrivate()).
Proposed change: skip the default material only when keyStore and keyPairAlias 
are both set, and fail in doStart with a clear message when keyStore is set 
without them.

h4. 2. keyRotationMaxAge counts whole days
needsRotation of the 5 key lifecycle managers (for example 
{{FileBasedKeyLifecycleManager}}) compares metadata.getAgeInDays() > 
maxAge.toDays(): a maxAge below one day becomes 0 (rotation after the first 
full day), and 90 days rotates when the key is 91 full days old. The 
description now says whole days.
Proposed change: compare Duration.between(createdAt, now) with maxAge.

h4. 3. Smaller issues
The CamelPQCSignature header declares javaType String, but sign sets a byte[] 
and verify reads a byte[]. keyPair and classicalKeyPair are both autowired 
KeyPair, and signer and classicalSigner both autowired Signature, so one 
registry bean fills both the PQC and the classical slot. The key rotation 
scheduler only uses a keyLifecycleManager set on the component; with 
keyRotationSchedulerEnabled=true and the manager set only on endpoints the 
component fails to start. exportKey exports the key pair of the endpoint, not 
the key named by CamelPQCKeyId.


_Claude Code on behalf of davsclaus_


> camel-pqc: keyStore without keyPairAlias gives a NullPointerException, 
> keyRotationMaxAge in whole days
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27960
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27960
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-pqc
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-pqc for CAMEL-23832 
> (commit 
> https://github.com/apache/camel/commit/b03d1ed7628336a767e986b3dc2fb603a72b0b5c,
>  pull request https://github.com/apache/camel/pull/31196).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. keyStore without keyPairAlias and keyStorePassword
> {{PQCComponent.createEndpoint}} skips the default key material as soon as 
> keyStore is set (keyStore is autowired, so one KeyStore bean in the registry 
> is enough), but {{PQCProducer.doStart}} only reads the KeyStore when 
> keyPairAlias and keyStorePassword are also set. keyPair stays null and 
> signing fails with a NullPointerException at initSign(keyPair.getPrivate()).
> Proposed change: skip the default material only when keyStore and 
> keyPairAlias are both set, and fail in doStart with a clear message when 
> keyStore is set without them.
> h4. 2. keyRotationMaxAge counts whole days
> needsRotation of the 5 key lifecycle managers (for example 
> {{FileBasedKeyLifecycleManager}}) compares metadata.getAgeInDays() > 
> maxAge.toDays(): a maxAge below one day becomes 0 (rotation after the first 
> full day), and 90 days rotates when the key is 91 full days old. The 
> description now says whole days.
> Proposed change: compare Duration.between(createdAt, now) with maxAge.
> h4. 3. Smaller issues
> The CamelPQCSignature header declares javaType String, but sign sets a byte[] 
> and verify reads a byte[]. keyPair and classicalKeyPair are both autowired 
> KeyPair, and signer and classicalSigner both autowired Signature, so one 
> registry bean fills both the PQC and the classical slot. The key rotation 
> scheduler only uses a keyLifecycleManager set on the component; with 
> keyRotationSchedulerEnabled=true and the manager set only on endpoints the 
> component fails to start. exportKey exports the key pair of the endpoint, not 
> the key named by CamelPQCKeyId.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to