This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-22230-Sphincs
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2f9a964eee70a2828e98be42b0ae5bed9c549770
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Jul 11 15:36:09 2025 +0200

    CAMEL-22230 - Camel-PQC: Support more signature and KEM algorithms - 
SPHINCSPlus Signature Algorithm
    
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../org/apache/camel/catalog/components/pqc.json   |  4 +-
 .../org/apache/camel/component/pqc/pqc.json        |  4 +-
 .../apache/camel/component/pqc/PQCComponent.java   |  4 +
 .../camel/component/pqc/PQCConfiguration.java      |  2 +-
 .../component/pqc/PQCSignatureAlgorithms.java      |  3 +-
 .../pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java  | 54 +++++++++++++
 .../PQCSignatureSPHINCSPLUSNoAutowiredTest.java    | 76 ++++++++++++++++++
 .../component/pqc/PQCSignatureSPHINCSPLUSTest.java | 91 ++++++++++++++++++++++
 8 files changed, 232 insertions(+), 6 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json
index 21e401ec69b..0f824890beb 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json
@@ -34,7 +34,7 @@
     "keyPairAlias": { "index": 7, "kind": "property", "displayName": "Key Pair 
Alias", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "A KeyPair alias to use 
in combination with KeyStore parameter" },
     "keyStore": { "index": 8, "kind": "property", "displayName": "Key Store", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.KeyStore", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "A KeyStore where we could get Cryptographic 
material" },
     "keyStorePassword": { "index": 9, "kind": "property", "displayName": "Key 
Store Password", "group": "advanced", "label": "advanced", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": true, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "The KeyStore password to 
use in combination with KeyStore Parameter" },
-    "signatureAlgorithm": { "index": 10, "kind": "property", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM" ], "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": [...]
+    "signatureAlgorithm": { "index": 10, "kind": "property", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM", "SPHINCSPLUS" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "confi [...]
     "signer": { "index": 11, "kind": "property", "displayName": "Signer", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.Signature", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "The Signer to be used" },
     "storeExtractedSecretKeyAsHeader": { "index": 12, "kind": "property", 
"displayName": "Store Extracted Secret Key As Header", "group": "advanced", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "In the context of extractSec [...]
     "symmetricKeyAlgorithm": { "index": 13, "kind": "property", "displayName": 
"Symmetric Key Algorithm", "group": "advanced", "label": "advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", "enum": [ 
"AES", "ARIA", "RC2", "RC5", "CAMELLIA", "CAST5", "CAST6", "CHACHA7539", 
"DSTU7624", "GOST28147", "GOST3412_2015", "GRAIN128", "HC128", "HC256", 
"SALSA20", "SEED", "SM4", "DESEDE" ], "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, " [...]
@@ -58,7 +58,7 @@
     "keyPairAlias": { "index": 6, "kind": "parameter", "displayName": "Key 
Pair Alias", "group": "advanced", "label": "advanced", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "A KeyPair alias to use 
in combination with KeyStore parameter" },
     "keyStore": { "index": 7, "kind": "parameter", "displayName": "Key Store", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.KeyStore", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "A KeyStore where we could get Cryptographic 
material" },
     "keyStorePassword": { "index": 8, "kind": "parameter", "displayName": "Key 
Store Password", "group": "advanced", "label": "advanced", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": true, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "The KeyStore password to 
use in combination with KeyStore Parameter" },
-    "signatureAlgorithm": { "index": 9, "kind": "parameter", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM" ], "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": [...]
+    "signatureAlgorithm": { "index": 9, "kind": "parameter", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM", "SPHINCSPLUS" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "confi [...]
     "signer": { "index": 10, "kind": "parameter", "displayName": "Signer", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.Signature", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "The Signer to be used" },
     "storeExtractedSecretKeyAsHeader": { "index": 11, "kind": "parameter", 
"displayName": "Store Extracted Secret Key As Header", "group": "advanced", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "In the context of extractSe [...]
     "symmetricKeyAlgorithm": { "index": 12, "kind": "parameter", 
"displayName": "Symmetric Key Algorithm", "group": "advanced", "label": 
"advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "enum": [ "AES", "ARIA", "RC2", "RC5", "CAMELLIA", "CAST5", 
"CAST6", "CHACHA7539", "DSTU7624", "GOST28147", "GOST3412_2015", "GRAIN128", 
"HC128", "HC256", "SALSA20", "SEED", "SM4", "DESEDE" ], "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false,  [...]
diff --git 
a/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json
 
b/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json
index 21e401ec69b..0f824890beb 100644
--- 
a/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json
+++ 
b/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json
@@ -34,7 +34,7 @@
     "keyPairAlias": { "index": 7, "kind": "property", "displayName": "Key Pair 
Alias", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "A KeyPair alias to use 
in combination with KeyStore parameter" },
     "keyStore": { "index": 8, "kind": "property", "displayName": "Key Store", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.KeyStore", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "A KeyStore where we could get Cryptographic 
material" },
     "keyStorePassword": { "index": 9, "kind": "property", "displayName": "Key 
Store Password", "group": "advanced", "label": "advanced", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": true, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "The KeyStore password to 
use in combination with KeyStore Parameter" },
-    "signatureAlgorithm": { "index": 10, "kind": "property", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM" ], "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": [...]
+    "signatureAlgorithm": { "index": 10, "kind": "property", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM", "SPHINCSPLUS" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "confi [...]
     "signer": { "index": 11, "kind": "property", "displayName": "Signer", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.Signature", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "The Signer to be used" },
     "storeExtractedSecretKeyAsHeader": { "index": 12, "kind": "property", 
"displayName": "Store Extracted Secret Key As Header", "group": "advanced", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "In the context of extractSec [...]
     "symmetricKeyAlgorithm": { "index": 13, "kind": "property", "displayName": 
"Symmetric Key Algorithm", "group": "advanced", "label": "advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", "enum": [ 
"AES", "ARIA", "RC2", "RC5", "CAMELLIA", "CAST5", "CAST6", "CHACHA7539", 
"DSTU7624", "GOST28147", "GOST3412_2015", "GRAIN128", "HC128", "HC256", 
"SALSA20", "SEED", "SM4", "DESEDE" ], "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, " [...]
@@ -58,7 +58,7 @@
     "keyPairAlias": { "index": 6, "kind": "parameter", "displayName": "Key 
Pair Alias", "group": "advanced", "label": "advanced", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "A KeyPair alias to use 
in combination with KeyStore parameter" },
     "keyStore": { "index": 7, "kind": "parameter", "displayName": "Key Store", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.KeyStore", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "A KeyStore where we could get Cryptographic 
material" },
     "keyStorePassword": { "index": 8, "kind": "parameter", "displayName": "Key 
Store Password", "group": "advanced", "label": "advanced", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": true, 
"configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", 
"configurationField": "configuration", "description": "The KeyStore password to 
use in combination with KeyStore Parameter" },
-    "signatureAlgorithm": { "index": 9, "kind": "parameter", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM" ], "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": [...]
+    "signatureAlgorithm": { "index": 9, "kind": "parameter", "displayName": 
"Signature Algorithm", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "MLDSA", 
"SLHDSA", "LMS", "XMSS", "FALCON", "PICNIC", "RAINBOW", "SNOVA", "MAYO", 
"DILITHIUM", "SPHINCSPLUS" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "confi [...]
     "signer": { "index": 10, "kind": "parameter", "displayName": "Signer", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "java.security.Signature", "deprecated": false, "deprecationNote": 
"", "autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "The Signer to be used" },
     "storeExtractedSecretKeyAsHeader": { "index": 11, "kind": "parameter", 
"displayName": "Store Extracted Secret Key As Header", "group": "advanced", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.pqc.PQCConfiguration", "configurationField": 
"configuration", "description": "In the context of extractSe [...]
     "symmetricKeyAlgorithm": { "index": 12, "kind": "parameter", 
"displayName": "Symmetric Key Algorithm", "group": "advanced", "label": 
"advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "enum": [ "AES", "ARIA", "RC2", "RC5", "CAMELLIA", "CAST5", 
"CAST6", "CHACHA7539", "DSTU7624", "GOST28147", "GOST3412_2015", "GRAIN128", 
"HC128", "HC256", "SALSA20", "SEED", "SM4", "DESEDE" ], "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false,  [...]
diff --git 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCComponent.java
 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCComponent.java
index 7a4af26d5e6..d023c31df76 100644
--- 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCComponent.java
+++ 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCComponent.java
@@ -98,6 +98,10 @@ public class PQCComponent extends HealthCheckComponent {
                         
configuration.setSigner(PQCDefaultDILITHIUMMaterial.signer);
                         
configuration.setKeyPair(PQCDefaultDILITHIUMMaterial.keyPair);
                         break;
+                    case "SPHINCSPLUS":
+                        
configuration.setSigner(PQCDefaultSPHINCSPLUSMaterial.signer);
+                        
configuration.setKeyPair(PQCDefaultSPHINCSPLUSMaterial.keyPair);
+                        break;
                     default:
                         break;
                 }
diff --git 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCConfiguration.java
 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCConfiguration.java
index 08945628a8b..14bf6f1e471 100644
--- 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCConfiguration.java
+++ 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCConfiguration.java
@@ -43,7 +43,7 @@ public class PQCConfiguration implements Cloneable {
     @UriParam
     @Metadata(label = "advanced", autowired = true)
     private Signature signer;
-    @UriParam(enums = 
"MLDSA,SLHDSA,LMS,XMSS,FALCON,PICNIC,RAINBOW,SNOVA,MAYO,DILITHIUM")
+    @UriParam(enums = 
"MLDSA,SLHDSA,LMS,XMSS,FALCON,PICNIC,RAINBOW,SNOVA,MAYO,DILITHIUM,SPHINCSPLUS")
     @Metadata(label = "advanced")
     private String signatureAlgorithm;
     @UriParam
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 c7405cad81f..4a4229298e9 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
@@ -29,7 +29,8 @@ public enum PQCSignatureAlgorithms {
     FALCON("FALCON", "BCPQC"),
     PICNIC("PICNIC", "BCPQC"),
     SNOVA("Snova", "BCPQC"),
-    MAYO("Mayo", "BCPQC");
+    MAYO("Mayo", "BCPQC"),
+    SPHINCSPLUS("SPHINCSPLUS", "BCPQC");
 
     private final String algorithm;
     private final String bcProvider;
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
new file mode 100644
index 00000000000..9a9bfedbe67
--- /dev/null
+++ 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultSPHINCSPLUSMaterial.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pqc.crypto;
+
+import java.security.*;
+
+import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+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;
+    public static final Signature signer;
+
+    static {
+        if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
+            Security.addProvider(new BouncyCastleProvider());
+        }
+        if (Security.getProvider(BouncyCastlePQCProvider.PROVIDER_NAME) == 
null) {
+            Security.addProvider(new BouncyCastlePQCProvider());
+        }
+        KeyPairGenerator generator;
+        try {
+            generator = prepareKeyPair();
+            keyPair = generator.generateKeyPair();
+            signer = 
Signature.getInstance(PQCSignatureAlgorithms.SPHINCSPLUS.getAlgorithm());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    protected static KeyPairGenerator prepareKeyPair()
+            throws NoSuchAlgorithmException, NoSuchProviderException, 
InvalidAlgorithmParameterException {
+        KeyPairGenerator kpGen = 
KeyPairGenerator.getInstance(PQCSignatureAlgorithms.SPHINCSPLUS.getAlgorithm(),
+                PQCSignatureAlgorithms.SPHINCSPLUS.getBcProvider());
+        kpGen.initialize(SPHINCSPlusParameterSpec.haraka_256s, new 
SecureRandom());
+        return kpGen;
+    }
+}
diff --git 
a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSNoAutowiredTest.java
 
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSNoAutowiredTest.java
new file mode 100644
index 00000000000..278ca24645a
--- /dev/null
+++ 
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSNoAutowiredTest.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pqc;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.Security;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+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.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PQCSignatureSPHINCSPLUSNoAutowiredTest extends CamelTestSupport {
+
+    @EndpointInject("mock:sign")
+    protected MockEndpoint resultSign;
+
+    @EndpointInject("mock:verify")
+    protected MockEndpoint resultVerify;
+
+    @Produce("direct:sign")
+    protected ProducerTemplate templateSign;
+
+    public PQCSignatureSPHINCSPLUSNoAutowiredTest() throws 
NoSuchAlgorithmException {
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:sign").to("pqc:sign?operation=sign&signatureAlgorithm=SPHINCSPLUS").to("mock:sign")
+                        
.to("pqc:verify?operation=verify&signatureAlgorithm=SPHINCSPLUS")
+                        .to("mock:verify");
+            }
+        };
+    }
+
+    @BeforeAll
+    public static void startup() throws Exception {
+        Security.addProvider(new BouncyCastleProvider());
+        Security.addProvider(new BouncyCastlePQCProvider());
+    }
+
+    @Test
+    void testSignAndVerify() throws Exception {
+        resultSign.expectedMessageCount(1);
+        resultVerify.expectedMessageCount(1);
+        templateSign.sendBody("Hello");
+        resultSign.assertIsSatisfied();
+        resultVerify.assertIsSatisfied();
+        
assertTrue(resultVerify.getExchanges().get(0).getMessage().getHeader(PQCConstants.VERIFY,
 Boolean.class));
+    }
+}
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
new file mode 100644
index 00000000000..322546594d6
--- /dev/null
+++ 
b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureSPHINCSPLUSTest.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.pqc;
+
+import java.security.*;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+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.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;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PQCSignatureSPHINCSPLUSTest extends CamelTestSupport {
+
+    @EndpointInject("mock:sign")
+    protected MockEndpoint resultSign;
+
+    @EndpointInject("mock:verify")
+    protected MockEndpoint resultVerify;
+
+    @Produce("direct:sign")
+    protected ProducerTemplate templateSign;
+
+    public PQCSignatureSPHINCSPLUSTest() throws NoSuchAlgorithmException {
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:sign").to("pqc:sign?operation=sign").to("mock:sign").to("pqc:verify?operation=verify")
+                        .to("mock:verify");
+            }
+        };
+    }
+
+    @BeforeAll
+    public static void startup() throws Exception {
+        Security.addProvider(new BouncyCastleProvider());
+        Security.addProvider(new BouncyCastlePQCProvider());
+    }
+
+    @Test
+    void testSignAndVerify() throws Exception {
+        resultSign.expectedMessageCount(1);
+        resultVerify.expectedMessageCount(1);
+        templateSign.sendBody("Hello");
+        resultSign.assertIsSatisfied();
+        resultVerify.assertIsSatisfied();
+        
assertTrue(resultVerify.getExchanges().get(0).getMessage().getHeader(PQCConstants.VERIFY,
 Boolean.class));
+    }
+
+    @BindToRegistry("Keypair")
+    public KeyPair setKeyPair() throws NoSuchAlgorithmException, 
NoSuchProviderException, InvalidAlgorithmParameterException {
+        KeyPairGenerator kpGen = 
KeyPairGenerator.getInstance(PQCSignatureAlgorithms.SPHINCSPLUS.getAlgorithm(),
+                PQCSignatureAlgorithms.SPHINCSPLUS.getBcProvider());
+        kpGen.initialize(SPHINCSPlusParameterSpec.haraka_256s, new 
SecureRandom());
+        KeyPair kp = kpGen.generateKeyPair();
+        return kp;
+    }
+
+    @BindToRegistry("Signer")
+    public Signature getSigner() throws NoSuchAlgorithmException {
+        Signature mlDsa = 
Signature.getInstance(PQCSignatureAlgorithms.SPHINCSPLUS.getAlgorithm());
+        return mlDsa;
+    }
+}

Reply via email to