This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.18.x by this push:
new 1d3cbbe523f8 [4.18.x] CAMEL-25894: Adapt camel-pqc to Bouncy Castle
1.85 algorithm renames (#26519)
1d3cbbe523f8 is described below
commit 1d3cbbe523f81a8556bd94e3133dc6ca41683ef5
Author: Roman Stepaniuk <[email protected]>
AuthorDate: Wed Oct 21 11:37:59 2026 +0200
[4.18.x] CAMEL-25894: Adapt camel-pqc to Bouncy Castle 1.85 algorithm
renames (#26519)
Bouncy Castle 1.85 removed pre-standardization PQC algorithm names
(DILITHIUM, KYBER, SPHINCSPLUS) from the BCPQC provider. Update
camel-pqc to use the NIST standardized names (ML-DSA, ML-KEM, SLH-DSA)
while preserving the existing Camel enum constants for backward
compatibility.
For camel-4.18.x, bumps Bouncy Castle 1.83 to 1.85.
Closes #24653
(cherry picked from commit 0c555049654fbea0bed8869575b7730069382260)
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Codex <[email protected]>
---
.../camel-pqc/src/main/docs/pqc-component.adoc | 36 +++++++++++-----------
.../pqc/PQCKeyEncapsulationAlgorithms.java | 2 +-
.../component/pqc/PQCSignatureAlgorithms.java | 4 +--
.../pqc/crypto/PQCDefaultDILITHIUMMaterial.java | 4 +--
.../pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java | 4 +--
.../pqc/crypto/kem/PQCDefaultKYBERMaterial.java | 4 +--
.../AwsSecretsManagerKeyLifecycleManager.java | 13 ++++----
.../lifecycle/FileBasedKeyLifecycleManager.java | 13 ++++----
.../HashicorpVaultKeyLifecycleManager.java | 13 ++++----
.../pqc/AwsSecretsManagerKeyLifecycleIT.java | 22 ++++++-------
.../pqc/HashicorpVaultKeyLifecycleIT.java | 22 ++++++-------
.../component/pqc/PQCEndToEndIntegrationTest.java | 16 +++++-----
.../pqc/PQCKYBERGenerateEncapsulationAESTest.java | 4 +--
.../pqc/PQCKeyLifecycleIntegrationTest.java | 24 +++++++--------
.../camel/component/pqc/PQCKeyLifecycleTest.java | 36 +++++++++++-----------
.../component/pqc/PQCSignatureDILITHIUMTest.java | 4 +--
.../component/pqc/PQCSignatureSPHINCSPLUSTest.java | 4 +--
.../PQCDataFormatMultipleAlgorithmsTest.java | 4 +--
parent/pom.xml | 2 +-
19 files changed, 117 insertions(+), 114 deletions(-)
diff --git a/components/camel-pqc/src/main/docs/pqc-component.adoc
b/components/camel-pqc/src/main/docs/pqc-component.adoc
index 1e51e985c4df..db4056014ec6 100644
--- a/components/camel-pqc/src/main/docs/pqc-component.adoc
+++ b/components/camel-pqc/src/main/docs/pqc-component.adoc
@@ -431,7 +431,7 @@ KeyLifecycleManager keyManager = new
FileBasedKeyLifecycleManager("/secure/keys"
// Generate a new Dilithium key
KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", "app-signing-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
// Use the key
KeyMetadata metadata = keyManager.getKeyMetadata("app-signing-key");
@@ -551,7 +551,7 @@ public HashicorpVaultKeyLifecycleManager createKeyManager()
{
// Generate a Dilithium key stored in Vault
KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", "app-signing-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
// Key is stored in Vault at: secret/data/pqc/keys/app-signing-key
--------------------------------------------------------------------------------
@@ -573,7 +573,7 @@ HashicorpVaultKeyLifecycleManager keyManager =
// Generate and store key in Vault
KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", "vault-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
--------------------------------------------------------------------------------
**Example with HashiCorp Cloud Platform (HCP) Vault:**
@@ -595,7 +595,7 @@ HashicorpVaultKeyLifecycleManager keyManager =
// Generate and store key in HCP Vault
KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", "hcp-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
// Key is stored in HCP Vault at: admin/secret/data/pqc/keys/hcp-key
--------------------------------------------------------------------------------
@@ -970,7 +970,7 @@ public AwsSecretsManagerKeyLifecycleManager
createKeyManager() {
// Generate a Dilithium key stored in AWS Secrets Manager
KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", "app-signing-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
// Keys are stored as: pqc/keys/app-signing-key/private, /public, /metadata
--------------------------------------------------------------------------------
@@ -990,7 +990,7 @@ AwsSecretsManagerKeyLifecycleManager keyManager =
// Generate and store key in AWS Secrets Manager
KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", "aws-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
--------------------------------------------------------------------------------
**Example with LocalStack (Testing):**
@@ -1009,7 +1009,7 @@ AwsSecretsManagerKeyLifecycleManager keyManager =
// Generate and store key in LocalStack
KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", "test-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
--------------------------------------------------------------------------------
**YAML Configuration:**
@@ -1400,7 +1400,7 @@ KeyPair mldsaKey = keyManager.generateKeyPair("MLDSA",
"mldsa-key");
// Dilithium with specific parameter
KeyPair dilithiumKey = keyManager.generateKeyPair("DILITHIUM", "dilithium-key",
- DilithiumParameterSpec.dilithium3);
+ MLDSAParameterSpec.ml_dsa_65);
// Falcon (uses default Falcon-512)
KeyPair falconKey = keyManager.generateKeyPair("FALCON", "falcon-key");
@@ -1605,7 +1605,7 @@ public KeyLifecycleManager createKeyManager() throws
IOException {
public KeyPair createSigningKey() throws Exception {
KeyLifecycleManager manager = createKeyManager();
return manager.generateKeyPair("DILITHIUM", "route-signing-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
}
----
@@ -1626,7 +1626,7 @@ camel:
scriptLanguage: groovy
script: |
def manager = new
org.apache.camel.component.pqc.lifecycle.FileBasedKeyLifecycleManager('/secure/keys')
- def spec =
org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec.dilithium2
+ def spec = org.bouncycastle.jcajce.spec.MLDSAParameterSpec.ml_dsa_44
manager.generateKeyPair('DILITHIUM', 'route-signing-key', spec)
----
====
@@ -1688,9 +1688,9 @@ The lifecycle manager provides sensible defaults for all
algorithms:
|===
|Algorithm |Default Parameter Spec
-|DILITHIUM |dilithium2
+|DILITHIUM |ml_dsa_44
|FALCON |falcon_512
-|SPHINCSPLUS |sha2_128s
+|SPHINCSPLUS |slh_dsa_sha2_128s
|XMSS |10-tree height with SHA-256
|XMSSMT |XMSSMT-SHA2-20d2-256
|LMS/HSS |LMS-SHA256-N32-H10 with SHA256-N32-W4
@@ -1794,7 +1794,7 @@ for (int i = 0; i < 100; i++) {
executor.submit(() -> {
try {
keyManager.generateKeyPair("DILITHIUM", "key-" + index,
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
} catch (Exception e) {
logger.error("Key generation failed", e);
}
@@ -1963,7 +1963,7 @@ The DataFormat requires a KeyPair to be available either:
--------------------------------------------------------------------------------
@BindToRegistry("pqcKeyPair")
public KeyPair createMLKEMKeyPair() throws Exception {
- KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-KEM", "BCPQC");
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-KEM", "BC");
kpg.initialize(MLKEMParameterSpec.ml_kem_768, new SecureRandom());
return kpg.generateKeyPair();
}
@@ -1978,7 +1978,7 @@ pqcFormat.setSymmetricKeyAlgorithm("AES");
[source,java]
--------------------------------------------------------------------------------
-KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-KEM", "BCPQC");
+KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-KEM", "BC");
kpg.initialize(MLKEMParameterSpec.ml_kem_768, new SecureRandom());
KeyPair keyPair = kpg.generateKeyPair();
@@ -2016,7 +2016,7 @@ from("direct:encrypt")
* NTRU - NTRU Encrypt
* NTRULPRime - NTRU LPRime
* SNTRUPrime - Streamlined NTRU Prime
-* KYBER - Kyber (pre-standardization version)
+* KYBER - Compatibility alias for ML-KEM
==== Symmetric Encryption Algorithms
@@ -2221,7 +2221,7 @@ Configure a KeyGenerator once to avoid repeated
initialization:
--------------------------------------------------------------------------------
@BindToRegistry("kemKeyGenerator")
public KeyGenerator createKeyGenerator() throws Exception {
- return KeyGenerator.getInstance("ML-KEM", "BCPQC");
+ return KeyGenerator.getInstance("ML-KEM", "BC");
}
PQCDataFormat pqcFormat = new PQCDataFormat();
@@ -2252,7 +2252,7 @@ void testPQCDataFormatRoundTrip() throws Exception {
Security.addProvider(new BouncyCastleProvider());
Security.addProvider(new BouncyCastlePQCProvider());
- KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-KEM", "BCPQC");
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-KEM", "BC");
kpg.initialize(MLKEMParameterSpec.ml_kem_512, new SecureRandom());
KeyPair keyPair = kpg.generateKeyPair();
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCKeyEncapsulationAlgorithms.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCKeyEncapsulationAlgorithms.java
index f84d0580e97e..6e060311713c 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCKeyEncapsulationAlgorithms.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCKeyEncapsulationAlgorithms.java
@@ -30,7 +30,7 @@ public enum PQCKeyEncapsulationAlgorithms {
NTRU("NTRU", "BCPQC"),
NTRULPRime("NTRULPRime", "BCPQC"),
SNTRUPrime("SNTRUPrime", "BCPQC"),
- KYBER("KYBER", "BCPQC");
+ KYBER("ML-KEM", "BC");
private final String algorithm;
private final String bcProvider;
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCSignatureAlgorithms.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCSignatureAlgorithms.java
index 234460e1b5f3..a528ecf01c86 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCSignatureAlgorithms.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCSignatureAlgorithms.java
@@ -25,14 +25,14 @@ public enum PQCSignatureAlgorithms {
HSS("LMS", "BC"),
XMSS("XMSS", "BCPQC"),
XMSSMT("XMSSMT", "BCPQC"),
- DILITHIUM("DILITHIUM", "BCPQC"),
+ DILITHIUM("ML-DSA", "BC"),
// Experimental and non-standardized
FALCON("FALCON", "BCPQC"),
PICNIC("PICNIC", "BCPQC"),
SNOVA("Snova", "BCPQC"),
MAYO("Mayo", "BCPQC"),
- SPHINCSPLUS("SPHINCSPLUS", "BCPQC");
+ SPHINCSPLUS("SLH-DSA", "BC");
private final String algorithm;
private final String bcProvider;
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultDILITHIUMMaterial.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultDILITHIUMMaterial.java
index 91d4e61a6093..f1fe1df1ceae 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultDILITHIUMMaterial.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultDILITHIUMMaterial.java
@@ -19,9 +19,9 @@ package org.apache.camel.component.pqc.crypto;
import java.security.*;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
public class PQCDefaultDILITHIUMMaterial {
public static final KeyPair keyPair;
@@ -49,7 +49,7 @@ public class PQCDefaultDILITHIUMMaterial {
throws NoSuchAlgorithmException, NoSuchProviderException,
InvalidAlgorithmParameterException {
KeyPairGenerator kpGen =
KeyPairGenerator.getInstance(PQCSignatureAlgorithms.DILITHIUM.getAlgorithm(),
PQCSignatureAlgorithms.DILITHIUM.getBcProvider());
- kpGen.initialize(DilithiumParameterSpec.dilithium5);
+ kpGen.initialize(MLDSAParameterSpec.ml_dsa_87, new SecureRandom());
return kpGen;
}
}
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java
index 01506ff5a885..38c2a6623d18 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java
@@ -19,9 +19,9 @@ package org.apache.camel.component.pqc.crypto;
import java.security.*;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec;
public class PQCDefaultSPHINCSPLUSMaterial {
public static final KeyPair keyPair;
@@ -49,7 +49,7 @@ public class PQCDefaultSPHINCSPLUSMaterial {
throws NoSuchAlgorithmException, NoSuchProviderException,
InvalidAlgorithmParameterException {
KeyPairGenerator kpGen =
KeyPairGenerator.getInstance(PQCSignatureAlgorithms.SPHINCSPLUS.getAlgorithm(),
PQCSignatureAlgorithms.SPHINCSPLUS.getBcProvider());
- kpGen.initialize(SPHINCSPlusParameterSpec.haraka_256s, new
SecureRandom());
+ kpGen.initialize(SLHDSAParameterSpec.slh_dsa_sha2_128s, new
SecureRandom());
return kpGen;
}
}
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/kem/PQCDefaultKYBERMaterial.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/kem/PQCDefaultKYBERMaterial.java
index aabd580a30aa..c599f72e62de 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/kem/PQCDefaultKYBERMaterial.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/kem/PQCDefaultKYBERMaterial.java
@@ -21,9 +21,9 @@ import java.security.*;
import javax.crypto.KeyGenerator;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.KyberParameterSpec;
public class PQCDefaultKYBERMaterial {
@@ -51,7 +51,7 @@ public class PQCDefaultKYBERMaterial {
throws NoSuchAlgorithmException, NoSuchProviderException,
InvalidAlgorithmParameterException {
KeyPairGenerator kpg =
KeyPairGenerator.getInstance(PQCKeyEncapsulationAlgorithms.KYBER.getAlgorithm(),
PQCKeyEncapsulationAlgorithms.KYBER.getBcProvider());
- kpg.initialize(KyberParameterSpec.kyber1024, new SecureRandom());
+ kpg.initialize(MLKEMParameterSpec.ml_kem_1024, new SecureRandom());
return kpg;
}
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java
index e8d5218efc05..ad17081d8677 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/AwsSecretsManagerKeyLifecycleManager.java
@@ -36,6 +36,9 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
@@ -570,15 +573,14 @@ public class AwsSecretsManagerKeyLifecycleManager
implements KeyLifecycleManager
try {
switch (algorithm) {
case "DILITHIUM":
- return
org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec.dilithium2;
case "MLDSA":
+ return MLDSAParameterSpec.ml_dsa_44;
case "SLHDSA":
- // These use default initialization
- return null;
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "FALCON":
return
org.bouncycastle.pqc.jcajce.spec.FalconParameterSpec.falcon_512;
case "SPHINCSPLUS":
- return
org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec.sha2_128s;
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "XMSS":
return new
org.bouncycastle.pqc.jcajce.spec.XMSSParameterSpec(
10,
@@ -592,8 +594,7 @@ public class AwsSecretsManagerKeyLifecycleManager
implements KeyLifecycleManager
org.bouncycastle.pqc.crypto.lms.LMOtsParameters.sha256_n32_w4);
case "MLKEM":
case "KYBER":
- // These use default initialization
- return null;
+ return MLKEMParameterSpec.ml_kem_768;
case "NTRU":
return
org.bouncycastle.pqc.jcajce.spec.NTRUParameterSpec.ntruhps2048509;
case "NTRULPRime":
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java
index 3f7473c16367..b82de7b880fb 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/FileBasedKeyLifecycleManager.java
@@ -51,6 +51,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -531,15 +534,14 @@ public class FileBasedKeyLifecycleManager implements
KeyLifecycleManager {
try {
switch (algorithm) {
case "DILITHIUM":
- return
org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec.dilithium2;
case "MLDSA":
+ return MLDSAParameterSpec.ml_dsa_44;
case "SLHDSA":
- // These use default initialization
- return null;
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "FALCON":
return
org.bouncycastle.pqc.jcajce.spec.FalconParameterSpec.falcon_512;
case "SPHINCSPLUS":
- return
org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec.sha2_128s;
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "XMSS":
return new
org.bouncycastle.pqc.jcajce.spec.XMSSParameterSpec(
10,
@@ -553,8 +555,7 @@ public class FileBasedKeyLifecycleManager implements
KeyLifecycleManager {
org.bouncycastle.pqc.crypto.lms.LMOtsParameters.sha256_n32_w4);
case "MLKEM":
case "KYBER":
- // These use default initialization
- return null;
+ return MLKEMParameterSpec.ml_kem_768;
case "NTRU":
return
org.bouncycastle.pqc.jcajce.spec.NTRUParameterSpec.ntruhps2048509;
case "NTRULPRime":
diff --git
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java
index 648c66b022fc..c99c6389c3a5 100644
---
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java
+++
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/HashicorpVaultKeyLifecycleManager.java
@@ -35,6 +35,9 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.vault.authentication.TokenAuthentication;
@@ -593,15 +596,14 @@ public class HashicorpVaultKeyLifecycleManager implements
KeyLifecycleManager {
try {
switch (algorithm) {
case "DILITHIUM":
- return
org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec.dilithium2;
case "MLDSA":
+ return MLDSAParameterSpec.ml_dsa_44;
case "SLHDSA":
- // These use default initialization
- return null;
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "FALCON":
return
org.bouncycastle.pqc.jcajce.spec.FalconParameterSpec.falcon_512;
case "SPHINCSPLUS":
- return
org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec.sha2_128s;
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "XMSS":
return new
org.bouncycastle.pqc.jcajce.spec.XMSSParameterSpec(
10,
@@ -615,8 +617,7 @@ public class HashicorpVaultKeyLifecycleManager implements
KeyLifecycleManager {
org.bouncycastle.pqc.crypto.lms.LMOtsParameters.sha256_n32_w4);
case "MLKEM":
case "KYBER":
- // These use default initialization
- return null;
+ return MLKEMParameterSpec.ml_kem_768;
case "NTRU":
return
org.bouncycastle.pqc.jcajce.spec.NTRUParameterSpec.ntruhps2048509;
case "NTRULPRime":
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/AwsSecretsManagerKeyLifecycleIT.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/AwsSecretsManagerKeyLifecycleIT.java
index 5aab9f12ee04..e049c26bb804 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/AwsSecretsManagerKeyLifecycleIT.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/AwsSecretsManagerKeyLifecycleIT.java
@@ -31,9 +31,9 @@ import org.apache.camel.component.pqc.lifecycle.KeyMetadata;
import org.apache.camel.test.infra.aws.common.services.AWSService;
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.FalconParameterSpec;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -96,7 +96,7 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testGenerateAndStoreKeyInSecretsManager() throws Exception {
// Generate a Dilithium key
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"test-dilithium-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"test-dilithium-key", MLDSAParameterSpec.ml_dsa_44);
assertNotNull(keyPair);
assertNotNull(keyPair.getPublic());
@@ -132,7 +132,7 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testKeyRotation() throws Exception {
// Generate initial key
- keyManager.generateKeyPair("DILITHIUM", "rotation-key-old",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "rotation-key-old",
MLDSAParameterSpec.ml_dsa_44);
KeyMetadata oldMetadata =
keyManager.getKeyMetadata("rotation-key-old");
assertEquals(KeyMetadata.KeyStatus.ACTIVE, oldMetadata.getStatus());
@@ -152,7 +152,7 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testNeedsRotation() throws Exception {
- keyManager.generateKeyPair("DILITHIUM", "rotation-check-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "rotation-check-key",
MLDSAParameterSpec.ml_dsa_44);
// New key should not need rotation
assertFalse(keyManager.needsRotation("rotation-check-key",
Duration.ofDays(90), 10000));
@@ -169,9 +169,9 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testListKeys() throws Exception {
// Generate multiple keys
- keyManager.generateKeyPair("DILITHIUM", "list-key-1",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "list-key-1",
MLDSAParameterSpec.ml_dsa_44);
keyManager.generateKeyPair("FALCON", "list-key-2",
FalconParameterSpec.falcon_512);
- keyManager.generateKeyPair("DILITHIUM", "list-key-3",
DilithiumParameterSpec.dilithium3);
+ keyManager.generateKeyPair("DILITHIUM", "list-key-3",
MLDSAParameterSpec.ml_dsa_65);
// List all keys
List<KeyMetadata> keys = keyManager.listKeys();
@@ -186,14 +186,14 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testExpireAndRevokeKey() throws Exception {
// Test expiration
- keyManager.generateKeyPair("DILITHIUM", "expire-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "expire-key",
MLDSAParameterSpec.ml_dsa_44);
keyManager.expireKey("expire-key");
KeyMetadata expiredMetadata = keyManager.getKeyMetadata("expire-key");
assertEquals(KeyMetadata.KeyStatus.EXPIRED,
expiredMetadata.getStatus());
// Test revocation
- keyManager.generateKeyPair("DILITHIUM", "revoke-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "revoke-key",
MLDSAParameterSpec.ml_dsa_44);
keyManager.revokeKey("revoke-key", "Key compromised in test");
KeyMetadata revokedMetadata = keyManager.getKeyMetadata("revoke-key");
@@ -203,7 +203,7 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testDeleteKey() throws Exception {
- keyManager.generateKeyPair("DILITHIUM", "delete-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "delete-key",
MLDSAParameterSpec.ml_dsa_44);
assertNotNull(keyManager.getKey("delete-key"));
keyManager.deleteKey("delete-key");
@@ -214,7 +214,7 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testExportAndImportKey() throws Exception {
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-key", MLDSAParameterSpec.ml_dsa_44);
// Export public key as PEM
byte[] exported = keyManager.exportPublicKey(keyPair,
KeyLifecycleManager.KeyFormat.PEM);
@@ -234,7 +234,7 @@ public class AwsSecretsManagerKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testMetadataTracking() throws Exception {
// Generate key
- keyManager.generateKeyPair("DILITHIUM", "tracking-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "tracking-key",
MLDSAParameterSpec.ml_dsa_44);
// Get initial metadata
KeyMetadata metadata = keyManager.getKeyMetadata("tracking-key");
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java
index 58592fceee56..4555107c887d 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java
@@ -31,9 +31,9 @@ import org.apache.camel.component.pqc.lifecycle.KeyMetadata;
import
org.apache.camel.test.infra.hashicorp.vault.services.HashicorpServiceFactory;
import
org.apache.camel.test.infra.hashicorp.vault.services.HashicorpVaultService;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.FalconParameterSpec;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -90,7 +90,7 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testGenerateAndStoreKeyInVault() throws Exception {
// Generate a Dilithium key
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"test-dilithium-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"test-dilithium-key", MLDSAParameterSpec.ml_dsa_44);
assertNotNull(keyPair);
assertNotNull(keyPair.getPublic());
@@ -126,7 +126,7 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testKeyRotation() throws Exception {
// Generate initial key
- keyManager.generateKeyPair("DILITHIUM", "rotation-key-old",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "rotation-key-old",
MLDSAParameterSpec.ml_dsa_44);
KeyMetadata oldMetadata =
keyManager.getKeyMetadata("rotation-key-old");
assertEquals(KeyMetadata.KeyStatus.ACTIVE, oldMetadata.getStatus());
@@ -146,7 +146,7 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testNeedsRotation() throws Exception {
- keyManager.generateKeyPair("DILITHIUM", "rotation-check-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "rotation-check-key",
MLDSAParameterSpec.ml_dsa_44);
// New key should not need rotation
assertFalse(keyManager.needsRotation("rotation-check-key",
Duration.ofDays(90), 10000));
@@ -163,9 +163,9 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testListKeys() throws Exception {
// Generate multiple keys
- keyManager.generateKeyPair("DILITHIUM", "list-key-1",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "list-key-1",
MLDSAParameterSpec.ml_dsa_44);
keyManager.generateKeyPair("FALCON", "list-key-2",
FalconParameterSpec.falcon_512);
- keyManager.generateKeyPair("DILITHIUM", "list-key-3",
DilithiumParameterSpec.dilithium3);
+ keyManager.generateKeyPair("DILITHIUM", "list-key-3",
MLDSAParameterSpec.ml_dsa_65);
// List all keys
List<KeyMetadata> keys = keyManager.listKeys();
@@ -180,14 +180,14 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testExpireAndRevokeKey() throws Exception {
// Test expiration
- keyManager.generateKeyPair("DILITHIUM", "expire-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "expire-key",
MLDSAParameterSpec.ml_dsa_44);
keyManager.expireKey("expire-key");
KeyMetadata expiredMetadata = keyManager.getKeyMetadata("expire-key");
assertEquals(KeyMetadata.KeyStatus.EXPIRED,
expiredMetadata.getStatus());
// Test revocation
- keyManager.generateKeyPair("DILITHIUM", "revoke-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "revoke-key",
MLDSAParameterSpec.ml_dsa_44);
keyManager.revokeKey("revoke-key", "Key compromised in test");
KeyMetadata revokedMetadata = keyManager.getKeyMetadata("revoke-key");
@@ -197,7 +197,7 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testDeleteKey() throws Exception {
- keyManager.generateKeyPair("DILITHIUM", "delete-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "delete-key",
MLDSAParameterSpec.ml_dsa_44);
assertNotNull(keyManager.getKey("delete-key"));
keyManager.deleteKey("delete-key");
@@ -208,7 +208,7 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testExportAndImportKey() throws Exception {
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-key", MLDSAParameterSpec.ml_dsa_44);
// Export public key as PEM
byte[] exported = keyManager.exportPublicKey(keyPair,
KeyLifecycleManager.KeyFormat.PEM);
@@ -228,7 +228,7 @@ public class HashicorpVaultKeyLifecycleIT extends
CamelTestSupport {
@Test
public void testMetadataTracking() throws Exception {
// Generate key
- keyManager.generateKeyPair("DILITHIUM", "tracking-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "tracking-key",
MLDSAParameterSpec.ml_dsa_44);
// Get initial metadata
KeyMetadata metadata = keyManager.getKeyMetadata("tracking-key");
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCEndToEndIntegrationTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCEndToEndIntegrationTest.java
index 2c34ab2cb51b..3295c5827937 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCEndToEndIntegrationTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCEndToEndIntegrationTest.java
@@ -31,9 +31,9 @@ import
org.apache.camel.component.pqc.lifecycle.FileBasedKeyLifecycleManager;
import org.apache.camel.component.pqc.lifecycle.KeyLifecycleManager;
import org.apache.camel.component.pqc.lifecycle.KeyMetadata;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.NTRUParameterSpec;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
@@ -88,7 +88,7 @@ public class PQCEndToEndIntegrationTest extends
CamelTestSupport {
if (keyManager == null && tempDir != null) {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
// Pre-generate keys needed for binding
- dilithiumKeyPair = keyManager.generateKeyPair("DILITHIUM",
"setup-dilithium", DilithiumParameterSpec.dilithium2);
+ dilithiumKeyPair = keyManager.generateKeyPair("DILITHIUM",
"setup-dilithium", MLDSAParameterSpec.ml_dsa_44);
ntruKeyPair = keyManager.generateKeyPair("NTRU", "setup-ntru",
NTRUParameterSpec.ntruhps2048509);
}
}
@@ -138,7 +138,7 @@ public class PQCEndToEndIntegrationTest extends
CamelTestSupport {
void testEndToEndSignatureWithGeneratedKey() throws Exception {
// Step 1: Generate a Dilithium key pair using lifecycle manager
dilithiumKeyPair = keyManager.generateKeyPair("DILITHIUM",
"e2e-dilithium-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
assertNotNull(dilithiumKeyPair);
// Verify metadata was created
@@ -179,7 +179,7 @@ public class PQCEndToEndIntegrationTest extends
CamelTestSupport {
@Test
void testEndToEndKeyRotationWithSigning() throws Exception {
// Step 1: Generate initial key
- KeyPair oldKeyPair = keyManager.generateKeyPair("DILITHIUM",
"e2e-old-key", DilithiumParameterSpec.dilithium2);
+ KeyPair oldKeyPair = keyManager.generateKeyPair("DILITHIUM",
"e2e-old-key", MLDSAParameterSpec.ml_dsa_44);
assertNotNull(oldKeyPair);
// Step 2: Use old key for signing
@@ -223,7 +223,7 @@ public class PQCEndToEndIntegrationTest extends
CamelTestSupport {
void testEndToEndKeyExportImportAndUse() throws Exception {
// Step 1: Generate a key
KeyPair originalKeyPair = keyManager.generateKeyPair("DILITHIUM",
"e2e-export-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
// Step 2: Export the key to PEM format
byte[] exportedPublicKey = keyManager.exportPublicKey(originalKeyPair,
KeyLifecycleManager.KeyFormat.PEM);
@@ -264,7 +264,7 @@ public class PQCEndToEndIntegrationTest extends
CamelTestSupport {
void testEndToEndMultipleSignaturesWithMetadataTracking() throws Exception
{
// Step 1: Generate a key
dilithiumKeyPair = keyManager.generateKeyPair("DILITHIUM",
"e2e-multi-sig-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
KeyMetadata metadata = keyManager.getKeyMetadata("e2e-multi-sig-key");
assertEquals(0, metadata.getUsageCount());
@@ -298,7 +298,7 @@ public class PQCEndToEndIntegrationTest extends
CamelTestSupport {
@Test
void testEndToEndKeyExpirationPreventsUsage() throws Exception {
// Step 1: Generate a key
- dilithiumKeyPair = keyManager.generateKeyPair("DILITHIUM",
"e2e-expire-key", DilithiumParameterSpec.dilithium2);
+ dilithiumKeyPair = keyManager.generateKeyPair("DILITHIUM",
"e2e-expire-key", MLDSAParameterSpec.ml_dsa_44);
// Step 2: Use the key successfully
mockSigned.reset();
@@ -328,7 +328,7 @@ public class PQCEndToEndIntegrationTest extends
CamelTestSupport {
String keyId = "e2e-complete-lifecycle-key";
// Phase 1: Creation
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", keyId,
DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM", keyId,
MLDSAParameterSpec.ml_dsa_44);
assertNotNull(keyPair);
KeyMetadata metadata = keyManager.getKeyMetadata(keyId);
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKYBERGenerateEncapsulationAESTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKYBERGenerateEncapsulationAESTest.java
index 4c9fd972c3ee..adfb3c0418b0 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKYBERGenerateEncapsulationAESTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKYBERGenerateEncapsulationAESTest.java
@@ -28,9 +28,9 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.bouncycastle.jcajce.SecretKeyWithEncapsulation;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.KyberParameterSpec;
import org.bouncycastle.util.Arrays;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -92,7 +92,7 @@ public class PQCKYBERGenerateEncapsulationAESTest extends
CamelTestSupport {
public KeyPair setKeyPair() throws NoSuchAlgorithmException,
NoSuchProviderException, InvalidAlgorithmParameterException {
KeyPairGenerator kpg =
KeyPairGenerator.getInstance(PQCKeyEncapsulationAlgorithms.KYBER.getAlgorithm(),
PQCKeyEncapsulationAlgorithms.KYBER.getBcProvider());
- kpg.initialize(KyberParameterSpec.kyber1024, new SecureRandom());
+ kpg.initialize(MLKEMParameterSpec.ml_kem_1024, new SecureRandom());
KeyPair kp = kpg.generateKeyPair();
return kp;
}
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleIntegrationTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleIntegrationTest.java
index a39c9e1f1bd3..e1b2fe640c01 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleIntegrationTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleIntegrationTest.java
@@ -31,9 +31,9 @@ import
org.apache.camel.component.pqc.lifecycle.FileBasedKeyLifecycleManager;
import org.apache.camel.component.pqc.lifecycle.KeyLifecycleManager;
import org.apache.camel.component.pqc.lifecycle.KeyMetadata;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -157,7 +157,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testGenerateKeyThroughRoute() throws Exception {
// First manually generate a key to test the operation
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"route-test-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"route-test-key", MLDSAParameterSpec.ml_dsa_44);
assertNotNull(keyPair);
// Verify metadata
@@ -170,7 +170,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testExportKeyThroughManager() throws Exception {
// Generate a key first
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-route-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-route-key", MLDSAParameterSpec.ml_dsa_44);
// Export the key
byte[] exportedKey = keyManager.exportPublicKey(keyPair,
KeyLifecycleManager.KeyFormat.PEM);
@@ -184,7 +184,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testGetMetadataThroughManager() throws Exception {
// Generate a key
- keyManager.generateKeyPair("DILITHIUM", "metadata-route-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "metadata-route-key",
MLDSAParameterSpec.ml_dsa_44);
// Get metadata
KeyMetadata metadata = keyManager.getKeyMetadata("metadata-route-key");
@@ -198,9 +198,9 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testListKeysThroughManager() throws Exception {
// Generate multiple keys
- keyManager.generateKeyPair("DILITHIUM", "list-key-1",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "list-key-1",
MLDSAParameterSpec.ml_dsa_44);
keyManager.generateKeyPair("FALCON", "list-key-2");
- keyManager.generateKeyPair("DILITHIUM", "list-key-3",
DilithiumParameterSpec.dilithium3);
+ keyManager.generateKeyPair("DILITHIUM", "list-key-3",
MLDSAParameterSpec.ml_dsa_65);
// List all keys
List<KeyMetadata> keys = keyManager.listKeys();
@@ -215,7 +215,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testKeyRotationThroughManager() throws Exception {
// Generate initial key
- keyManager.generateKeyPair("DILITHIUM", "rotate-old-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "rotate-old-key",
MLDSAParameterSpec.ml_dsa_44);
// Rotate the key
KeyPair newKeyPair = keyManager.rotateKey("rotate-old-key",
"rotate-new-key", "DILITHIUM");
@@ -234,7 +234,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testExpireKeyThroughManager() throws Exception {
// Generate a key
- keyManager.generateKeyPair("DILITHIUM", "expire-route-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "expire-route-key",
MLDSAParameterSpec.ml_dsa_44);
// Expire the key
keyManager.expireKey("expire-route-key");
@@ -248,7 +248,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testRevokeKeyThroughManager() throws Exception {
// Generate a key
- keyManager.generateKeyPair("DILITHIUM", "revoke-route-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "revoke-route-key",
MLDSAParameterSpec.ml_dsa_44);
// Revoke the key
String reason = "Security breach detected";
@@ -264,7 +264,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
void testKeyPersistenceAcrossManagers() throws Exception {
// Generate key with first manager
KeyPair originalKeyPair = keyManager.generateKeyPair("DILITHIUM",
"persistence-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
// Create new manager instance
KeyLifecycleManager newManager = new
FileBasedKeyLifecycleManager(tempDir.toString());
@@ -280,7 +280,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testKeyMetadataUpdates() throws Exception {
// Generate a key
- keyManager.generateKeyPair("DILITHIUM", "update-test-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "update-test-key",
MLDSAParameterSpec.ml_dsa_44);
// Get and update metadata
KeyMetadata metadata = keyManager.getKeyMetadata("update-test-key");
@@ -300,7 +300,7 @@ public class PQCKeyLifecycleIntegrationTest extends
CamelTestSupport {
@Test
void testKeyDeletion() throws Exception {
// Generate a key
- keyManager.generateKeyPair("DILITHIUM", "delete-test-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "delete-test-key",
MLDSAParameterSpec.ml_dsa_44);
// Verify it exists
assertNotNull(keyManager.getKeyMetadata("delete-test-key"));
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleTest.java
index b86c15cbf136..3bac8b9c608a 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyLifecycleTest.java
@@ -28,9 +28,9 @@ import java.util.List;
import org.apache.camel.component.pqc.lifecycle.FileBasedKeyLifecycleManager;
import org.apache.camel.component.pqc.lifecycle.KeyLifecycleManager;
import org.apache.camel.component.pqc.lifecycle.KeyMetadata;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -70,7 +70,7 @@ public class PQCKeyLifecycleTest {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
// Generate a Dilithium key pair
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"test-dilithium-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"test-dilithium-key", MLDSAParameterSpec.ml_dsa_44);
assertNotNull(keyPair);
assertNotNull(keyPair.getPublic());
@@ -106,7 +106,7 @@ public class PQCKeyLifecycleTest {
void testExportKeyToPEM() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-test-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"export-test-key", MLDSAParameterSpec.ml_dsa_44);
// Export public key to PEM
byte[] publicKeyPEM = keyManager.exportPublicKey(keyPair,
KeyLifecycleManager.KeyFormat.PEM);
@@ -129,7 +129,7 @@ public class PQCKeyLifecycleTest {
void testExportKeyToDER() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"der-test-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"der-test-key", MLDSAParameterSpec.ml_dsa_44);
// Export to DER format
byte[] publicKeyDER = keyManager.exportPublicKey(keyPair,
KeyLifecycleManager.KeyFormat.DER);
@@ -147,7 +147,7 @@ public class PQCKeyLifecycleTest {
// Generate and export a key
KeyPair originalKeyPair = keyManager.generateKeyPair("DILITHIUM",
"import-test-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
byte[] exportedKey = keyManager.exportPublicKey(originalKeyPair,
KeyLifecycleManager.KeyFormat.PEM);
// Import the key
@@ -165,7 +165,7 @@ public class PQCKeyLifecycleTest {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
// Generate initial key
- KeyPair oldKeyPair = keyManager.generateKeyPair("DILITHIUM",
"old-key", DilithiumParameterSpec.dilithium2);
+ KeyPair oldKeyPair = keyManager.generateKeyPair("DILITHIUM",
"old-key", MLDSAParameterSpec.ml_dsa_44);
assertNotNull(oldKeyPair);
// Rotate the key
@@ -188,7 +188,7 @@ public class PQCKeyLifecycleTest {
void testKeyMetadataTracking() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"metadata-test-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"metadata-test-key", MLDSAParameterSpec.ml_dsa_44);
KeyMetadata metadata = keyManager.getKeyMetadata("metadata-test-key");
// Initial state
@@ -214,7 +214,7 @@ public class PQCKeyLifecycleTest {
void testExpireKey() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- keyManager.generateKeyPair("DILITHIUM", "expire-test-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "expire-test-key",
MLDSAParameterSpec.ml_dsa_44);
// Expire the key
keyManager.expireKey("expire-test-key");
@@ -229,7 +229,7 @@ public class PQCKeyLifecycleTest {
void testRevokeKey() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- keyManager.generateKeyPair("DILITHIUM", "revoke-test-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "revoke-test-key",
MLDSAParameterSpec.ml_dsa_44);
// Revoke the key
String reason = "Compromised key";
@@ -246,9 +246,9 @@ public class PQCKeyLifecycleTest {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
// Generate multiple keys
- keyManager.generateKeyPair("DILITHIUM", "key1",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "key1",
MLDSAParameterSpec.ml_dsa_44);
keyManager.generateKeyPair("FALCON", "key2");
- keyManager.generateKeyPair("DILITHIUM", "key3",
DilithiumParameterSpec.dilithium3);
+ keyManager.generateKeyPair("DILITHIUM", "key3",
MLDSAParameterSpec.ml_dsa_65);
// List all keys
List<KeyMetadata> keys = keyManager.listKeys();
@@ -264,7 +264,7 @@ public class PQCKeyLifecycleTest {
void testDeleteKey() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- keyManager.generateKeyPair("DILITHIUM", "delete-test-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "delete-test-key",
MLDSAParameterSpec.ml_dsa_44);
// Verify key exists
assertNotNull(keyManager.getKeyMetadata("delete-test-key"));
@@ -280,7 +280,7 @@ public class PQCKeyLifecycleTest {
void testNeedsRotationByAge() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- keyManager.generateKeyPair("DILITHIUM", "age-test-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "age-test-key",
MLDSAParameterSpec.ml_dsa_44);
// Should not need rotation for young key
assertFalse(keyManager.needsRotation("age-test-key",
Duration.ofDays(365), 0));
@@ -294,7 +294,7 @@ public class PQCKeyLifecycleTest {
void testNeedsRotationByUsage() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- keyManager.generateKeyPair("DILITHIUM", "usage-test-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "usage-test-key",
MLDSAParameterSpec.ml_dsa_44);
// Update usage count
KeyMetadata metadata = keyManager.getKeyMetadata("usage-test-key");
@@ -316,7 +316,7 @@ public class PQCKeyLifecycleTest {
// Generate and store a key
KeyPair originalKeyPair = keyManager.generateKeyPair("DILITHIUM",
"persistence-test-key",
- DilithiumParameterSpec.dilithium2);
+ MLDSAParameterSpec.ml_dsa_44);
// Create a new manager instance (simulating restart)
KeyLifecycleManager newManager = new
FileBasedKeyLifecycleManager(tempDir.toString());
@@ -340,7 +340,7 @@ public class PQCKeyLifecycleTest {
void testKeyMetadataAge() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- keyManager.generateKeyPair("DILITHIUM", "age-calculation-key",
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", "age-calculation-key",
MLDSAParameterSpec.ml_dsa_44);
KeyMetadata metadata =
keyManager.getKeyMetadata("age-calculation-key");
// Age should be 0 days for just created key
@@ -352,7 +352,7 @@ public class PQCKeyLifecycleTest {
void testLegacyKeyPairMigration() throws Exception {
// Seed a real PQC key pair via the manager
FileBasedKeyLifecycleManager seedManager = new
FileBasedKeyLifecycleManager(tempDir.toString());
- KeyPair original = seedManager.generateKeyPair("DILITHIUM",
"seed-key", DilithiumParameterSpec.dilithium2);
+ KeyPair original = seedManager.generateKeyPair("DILITHIUM",
"seed-key", MLDSAParameterSpec.ml_dsa_44);
// Write it out in the legacy Java-serialized ".key" format under a
fresh keyId
Path legacyKeyFile = tempDir.resolve("legacy-key.key");
@@ -404,7 +404,7 @@ public class PQCKeyLifecycleTest {
void testMultipleKeyFormats() throws Exception {
keyManager = new FileBasedKeyLifecycleManager(tempDir.toString());
- KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"format-test-key", DilithiumParameterSpec.dilithium2);
+ KeyPair keyPair = keyManager.generateKeyPair("DILITHIUM",
"format-test-key", MLDSAParameterSpec.ml_dsa_44);
// Test all export formats
byte[] pemPublic = keyManager.exportPublicKey(keyPair,
KeyLifecycleManager.KeyFormat.PEM);
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureDILITHIUMTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureDILITHIUMTest.java
index 0c9f074c4129..8e7f17dfc551 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureDILITHIUMTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureDILITHIUMTest.java
@@ -25,9 +25,9 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -78,7 +78,7 @@ public class PQCSignatureDILITHIUMTest extends
CamelTestSupport {
public KeyPair setKeyPair() throws NoSuchAlgorithmException,
NoSuchProviderException, InvalidAlgorithmParameterException {
KeyPairGenerator kpGen =
KeyPairGenerator.getInstance(PQCSignatureAlgorithms.DILITHIUM.getAlgorithm(),
PQCSignatureAlgorithms.DILITHIUM.getBcProvider());
- kpGen.initialize(DilithiumParameterSpec.dilithium5);
+ kpGen.initialize(MLDSAParameterSpec.ml_dsa_87);
KeyPair kp = kpGen.generateKeyPair();
return kp;
}
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSTest.java
index be9ba45f9e3e..490db3345129 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSTest.java
@@ -25,9 +25,9 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -78,7 +78,7 @@ public class PQCSignatureSPHINCSPLUSTest extends
CamelTestSupport {
public KeyPair setKeyPair() throws NoSuchAlgorithmException,
NoSuchProviderException, InvalidAlgorithmParameterException {
KeyPairGenerator kpGen =
KeyPairGenerator.getInstance(PQCSignatureAlgorithms.SPHINCSPLUS.getAlgorithm(),
PQCSignatureAlgorithms.SPHINCSPLUS.getBcProvider());
- kpGen.initialize(SPHINCSPlusParameterSpec.haraka_256s, new
SecureRandom());
+ kpGen.initialize(SLHDSAParameterSpec.slh_dsa_sha2_128s, new
SecureRandom());
KeyPair kp = kpGen.generateKeyPair();
return kp;
}
diff --git
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/dataformat/PQCDataFormatMultipleAlgorithmsTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/dataformat/PQCDataFormatMultipleAlgorithmsTest.java
index 481c4cbc2c2a..7ebcc5bcfff4 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/dataformat/PQCDataFormatMultipleAlgorithmsTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/dataformat/PQCDataFormatMultipleAlgorithmsTest.java
@@ -32,9 +32,9 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
-import org.bouncycastle.pqc.jcajce.spec.KyberParameterSpec;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -98,7 +98,7 @@ public class PQCDataFormatMultipleAlgorithmsTest extends
CamelTestSupport {
KeyPairGenerator kpg = KeyPairGenerator.getInstance(
PQCKeyEncapsulationAlgorithms.KYBER.getAlgorithm(),
PQCKeyEncapsulationAlgorithms.KYBER.getBcProvider());
- kpg.initialize(KyberParameterSpec.kyber512, new SecureRandom());
+ kpg.initialize(MLKEMParameterSpec.ml_kem_512, new SecureRandom());
return kpg.generateKeyPair();
}
}
diff --git a/parent/pom.xml b/parent/pom.xml
index 136af740df2d..e9e33f539816 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -83,7 +83,7 @@
<azure-sdk-bom-version>1.3.3</azure-sdk-bom-version>
<azure-storage-blob-changefeed-version>12.0.0-beta.34</azure-storage-blob-changefeed-version>
<beanio-version>3.2.1</beanio-version>
- <bouncycastle-version>1.83</bouncycastle-version>
+ <bouncycastle-version>1.85</bouncycastle-version>
<box-java-sdk-version>4.16.3</box-java-sdk-version>
<braintree-gateway-version>3.48.0</braintree-gateway-version>
<build-helper-maven-plugin-version>3.6.1</build-helper-maven-plugin-version>