This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 0c555049654f chore: Adapt camel-pqc to Bouncy Castle 1.85 algorithm
renames
0c555049654f is described below
commit 0c555049654fbea0bed8869575b7730069382260
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jul 13 11:46:54 2026 +0200
chore: Adapt camel-pqc to Bouncy Castle 1.85 algorithm renames
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.
Includes the Bouncy Castle 1.84 to 1.85 version bump.
Closes #24653
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../pqc/PQCKeyEncapsulationAlgorithms.java | 2 +-
.../component/pqc/PQCSignatureAlgorithms.java | 4 +--
.../pqc/crypto/PQCDefaultDILITHIUMMaterial.java | 5 +--
.../pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java | 4 +--
.../pqc/crypto/kem/PQCDefaultKYBERMaterial.java | 4 +--
.../AwsSecretsManagerKeyLifecycleManager.java | 14 ++++-----
.../lifecycle/FileBasedKeyLifecycleManager.java | 14 ++++-----
.../HashicorpVaultKeyLifecycleManager.java | 14 ++++-----
.../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/PQCKeyStatusEnforcementTest.java | 4 +--
.../component/pqc/PQCSignatureDILITHIUMTest.java | 4 +--
.../component/pqc/PQCSignatureSPHINCSPLUSTest.java | 4 +--
.../PQCDataFormatMultipleAlgorithmsTest.java | 4 +--
.../pqc/lifecycle/KeyRotationSchedulerTest.java | 4 +--
parent/pom.xml | 2 +-
20 files changed, 104 insertions(+), 103 deletions(-)
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..79b9a5a2b4ed 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,10 @@ package org.apache.camel.component.pqc.crypto;
import java.security.*;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+import org.apache.camel.util.SecureRandomHelper;
+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 +50,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,
SecureRandomHelper.getSecureRandom());
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 c39278c9c4f9..1b31704a6ca0 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
@@ -20,9 +20,9 @@ import java.security.*;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
import org.apache.camel.util.SecureRandomHelper;
+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;
@@ -50,7 +50,7 @@ public class PQCDefaultSPHINCSPLUSMaterial {
throws NoSuchAlgorithmException, NoSuchProviderException,
InvalidAlgorithmParameterException {
KeyPairGenerator kpGen =
KeyPairGenerator.getInstance(PQCSignatureAlgorithms.SPHINCSPLUS.getAlgorithm(),
PQCSignatureAlgorithms.SPHINCSPLUS.getBcProvider());
- kpGen.initialize(SPHINCSPlusParameterSpec.haraka_256s,
SecureRandomHelper.getSecureRandom());
+ kpGen.initialize(SLHDSAParameterSpec.slh_dsa_sha2_128s,
SecureRandomHelper.getSecureRandom());
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 cfb7f8bf4e49..a62f5bc5ff5d 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
@@ -22,9 +22,9 @@ import javax.crypto.KeyGenerator;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
import org.apache.camel.util.SecureRandomHelper;
+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 {
@@ -52,7 +52,7 @@ public class PQCDefaultKYBERMaterial {
throws NoSuchAlgorithmException, NoSuchProviderException,
InvalidAlgorithmParameterException {
KeyPairGenerator kpg =
KeyPairGenerator.getInstance(PQCKeyEncapsulationAlgorithms.KYBER.getAlgorithm(),
PQCKeyEncapsulationAlgorithms.KYBER.getBcProvider());
- kpg.initialize(KyberParameterSpec.kyber1024,
SecureRandomHelper.getSecureRandom());
+ kpg.initialize(MLKEMParameterSpec.ml_kem_1024,
SecureRandomHelper.getSecureRandom());
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 dc5cf6d9baeb..ef2acc2035b2 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.ObjectMapper;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
import org.apache.camel.util.SecureRandomHelper;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.bouncycastle.pqc.crypto.lms.LMOtsParameters;
import org.bouncycastle.pqc.crypto.lms.LMSigParameters;
import org.bouncycastle.pqc.jcajce.spec.*;
@@ -573,15 +576,13 @@ public class AwsSecretsManagerKeyLifecycleManager
implements KeyLifecycleManager
try {
switch (algorithm) {
case "DILITHIUM":
- return DilithiumParameterSpec.dilithium2;
case "MLDSA":
+ return MLDSAParameterSpec.ml_dsa_44;
case "SLHDSA":
- // These use default initialization
- return null;
+ case "SPHINCSPLUS":
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "FALCON":
return FalconParameterSpec.falcon_512;
- case "SPHINCSPLUS":
- return SPHINCSPlusParameterSpec.sha2_128s;
case "XMSS":
return new XMSSParameterSpec(
10,
@@ -595,8 +596,7 @@ public class AwsSecretsManagerKeyLifecycleManager
implements KeyLifecycleManager
LMOtsParameters.sha256_n32_w4);
case "MLKEM":
case "KYBER":
- // These use default initialization
- return null;
+ return MLKEMParameterSpec.ml_kem_768;
case "NTRU":
return 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 b93bedf9f11a..2b4cba9949c8 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
@@ -48,6 +48,9 @@ import com.fasterxml.jackson.databind.SerializationFeature;
import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
import org.apache.camel.util.SecureRandomHelper;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.bouncycastle.pqc.crypto.lms.LMOtsParameters;
import org.bouncycastle.pqc.crypto.lms.LMSigParameters;
import org.bouncycastle.pqc.jcajce.spec.*;
@@ -491,15 +494,13 @@ public class FileBasedKeyLifecycleManager implements
KeyLifecycleManager {
try {
switch (algorithm) {
case "DILITHIUM":
- return DilithiumParameterSpec.dilithium2;
case "MLDSA":
+ return MLDSAParameterSpec.ml_dsa_44;
case "SLHDSA":
- // These use default initialization
- return null;
+ case "SPHINCSPLUS":
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "FALCON":
return FalconParameterSpec.falcon_512;
- case "SPHINCSPLUS":
- return SPHINCSPlusParameterSpec.sha2_128s;
case "XMSS":
return new XMSSParameterSpec(
10,
@@ -513,8 +514,7 @@ public class FileBasedKeyLifecycleManager implements
KeyLifecycleManager {
LMOtsParameters.sha256_n32_w4);
case "MLKEM":
case "KYBER":
- // These use default initialization
- return null;
+ return MLKEMParameterSpec.ml_kem_768;
case "NTRU":
return 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 060f6c44dc6f..142dfc486877 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.apache.camel.util.SecureRandomHelper;
+import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
+import org.bouncycastle.jcajce.spec.MLKEMParameterSpec;
+import org.bouncycastle.jcajce.spec.SLHDSAParameterSpec;
import org.bouncycastle.pqc.crypto.lms.LMOtsParameters;
import org.bouncycastle.pqc.crypto.lms.LMSigParameters;
import org.bouncycastle.pqc.jcajce.spec.*;
@@ -596,15 +599,13 @@ public class HashicorpVaultKeyLifecycleManager implements
KeyLifecycleManager {
try {
switch (algorithm) {
case "DILITHIUM":
- return DilithiumParameterSpec.dilithium2;
case "MLDSA":
+ return MLDSAParameterSpec.ml_dsa_44;
case "SLHDSA":
- // These use default initialization
- return null;
+ case "SPHINCSPLUS":
+ return SLHDSAParameterSpec.slh_dsa_sha2_128s;
case "FALCON":
return FalconParameterSpec.falcon_512;
- case "SPHINCSPLUS":
- return SPHINCSPlusParameterSpec.sha2_128s;
case "XMSS":
return new XMSSParameterSpec(
10,
@@ -618,8 +619,7 @@ public class HashicorpVaultKeyLifecycleManager implements
KeyLifecycleManager {
LMOtsParameters.sha256_n32_w4);
case "MLKEM":
case "KYBER":
- // These use default initialization
- return null;
+ return MLKEMParameterSpec.ml_kem_768;
case "NTRU":
return 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 4d07bd326aa1..8942bec0c626 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
@@ -32,9 +32,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.junit6.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;
@@ -97,7 +97,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());
@@ -133,7 +133,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());
@@ -153,7 +153,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));
@@ -170,9 +170,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();
@@ -187,14 +187,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");
@@ -204,7 +204,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");
@@ -215,7 +215,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);
@@ -235,7 +235,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 c88f98d1471f..965cf7a3261b 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
@@ -32,9 +32,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.junit6.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;
@@ -91,7 +91,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());
@@ -127,7 +127,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());
@@ -147,7 +147,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));
@@ -164,9 +164,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();
@@ -181,14 +181,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");
@@ -198,7 +198,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");
@@ -209,7 +209,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);
@@ -229,7 +229,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 179a8d29ddef..e7076558c7dd 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
@@ -33,9 +33,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.junit6.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;
@@ -90,7 +90,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);
}
}
@@ -140,7 +140,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
@@ -181,7 +181,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
@@ -225,7 +225,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);
@@ -266,7 +266,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());
@@ -300,7 +300,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();
@@ -330,7 +330,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 a2f4fb4d94c6..5bdb3be518d7 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.junit6.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 43750ca4acf9..63ed838afcae 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.junit6.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 c52302d4fb93..2437a27fab88 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
@@ -29,9 +29,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;
@@ -71,7 +71,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());
@@ -107,7 +107,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);
@@ -130,7 +130,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);
@@ -148,7 +148,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
@@ -166,7 +166,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
@@ -189,7 +189,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
@@ -215,7 +215,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");
@@ -230,7 +230,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";
@@ -247,9 +247,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();
@@ -265,7 +265,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"));
@@ -281,7 +281,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));
@@ -295,7 +295,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");
@@ -317,7 +317,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());
@@ -341,7 +341,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
@@ -353,7 +353,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");
@@ -405,7 +405,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/PQCKeyStatusEnforcementTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyStatusEnforcementTest.java
index 3df374710beb..648d971d4f94 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyStatusEnforcementTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCKeyStatusEnforcementTest.java
@@ -34,9 +34,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.junit6.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.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -368,7 +368,7 @@ public class PQCKeyStatusEnforcementTest extends
CamelTestSupport {
KeyPairGenerator kpGen = KeyPairGenerator.getInstance(
PQCSignatureAlgorithms.DILITHIUM.getAlgorithm(),
PQCSignatureAlgorithms.DILITHIUM.getBcProvider());
- kpGen.initialize(DilithiumParameterSpec.dilithium2, new
SecureRandom());
+ kpGen.initialize(MLDSAParameterSpec.ml_dsa_44, new SecureRandom());
sharedKeyPair = kpGen.generateKeyPair();
// Store the key in the lifecycle manager so we can test status
enforcement
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 ed2319cfd68c..d9b02b27b5f3 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.junit6.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 ff6d2646be66..c88eac5be14d 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.junit6.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 ae85d4ceaa9b..f18552574960 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.junit6.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/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/lifecycle/KeyRotationSchedulerTest.java
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/lifecycle/KeyRotationSchedulerTest.java
index 35fb53d7d4e2..66bac3796358 100644
---
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/lifecycle/KeyRotationSchedulerTest.java
+++
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/lifecycle/KeyRotationSchedulerTest.java
@@ -27,9 +27,9 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.camel.component.pqc.PQCComponent;
import org.apache.camel.impl.DefaultCamelContext;
+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;
@@ -81,7 +81,7 @@ class KeyRotationSchedulerTest {
/** Generates a Dilithium key and drives its recorded usage count to the
given value. */
private void generateKeyWithUsage(String keyId, long usage) throws
Exception {
- keyManager.generateKeyPair("DILITHIUM", keyId,
DilithiumParameterSpec.dilithium2);
+ keyManager.generateKeyPair("DILITHIUM", keyId,
MLDSAParameterSpec.ml_dsa_44);
KeyMetadata metadata = keyManager.getKeyMetadata(keyId);
for (long i = 0; i < usage; i++) {
metadata.updateLastUsed();
diff --git a/parent/pom.xml b/parent/pom.xml
index 9a619e600798..e00ba4a35eb0 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -84,7 +84,7 @@
<azure-sdk-bom-version>1.3.3</azure-sdk-bom-version>
<azure-storage-blob-changefeed-version>12.0.0-beta.38</azure-storage-blob-changefeed-version>
<beanio-version>3.2.1</beanio-version>
- <bouncycastle-version>1.84</bouncycastle-version>
+ <bouncycastle-version>1.85</bouncycastle-version>
<box-java-sdk-version>4.16.4</box-java-sdk-version>
<braintree-gateway-version>3.51.0</braintree-gateway-version>
<build-helper-maven-plugin-version>3.6.1</build-helper-maven-plugin-version>