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

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

commit 1c0492c929e0aeeb5bab353ba31da4ffb5ab80a7
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Fri Apr 18 14:20:48 2025 +0200

    A
    
    Signed-off-by: Andrea Cosentino <anco...@gmail.com>
---
 .../org/apache/camel/component/pqc/PQCOperations.java    |  3 ++-
 .../java/org/apache/camel/component/pqc/PQCProducer.java | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCOperations.java
 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCOperations.java
index 45d6abdc5c1..85f4d34eec7 100644
--- 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCOperations.java
+++ 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCOperations.java
@@ -20,5 +20,6 @@ public enum PQCOperations {
     sign,
     verify,
     generateSecretKeyEncapsulation,
-    extractSecretKeyEncapsulation
+    extractSecretKeyEncapsulation,
+    getExtractSecretKeyFromEncapsulation
 }
diff --git 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCProducer.java
 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCProducer.java
index 08fcad12404..5468e6b9d5c 100644
--- 
a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCProducer.java
+++ 
b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCProducer.java
@@ -169,4 +169,20 @@ public class PQCProducer extends DefaultProducer {
         exchange.getMessage().setBody(secEnc2, 
SecretKeyWithEncapsulation.class);
     }
 
+    private void extractSecretKeyFromEncapsulation(Exchange exchange)
+            throws InvalidAlgorithmParameterException,
+            InvalidPayloadException {
+        // initialise for creating an encapsulation and shared secret.
+        SecretKeyWithEncapsulation payload = 
exchange.getMessage().getMandatoryBody(SecretKeyWithEncapsulation.class);
+
+        if 
(ObjectHelper.isEmpty(getConfiguration().getSymmetricKeyAlgorithm())) {
+            throw new IllegalArgumentException("Symmetric Algorithm needs to 
be specified");
+        }
+
+        // initialise for extracting the shared secret from the encapsulation.
+        SecretKeyWithEncapsulation secEnc2 = (SecretKeyWithEncapsulation) 
keyGenerator.generateKey();
+
+        exchange.getMessage().setBody(secEnc2, 
SecretKeyWithEncapsulation.class);
+    }
+
 }

Reply via email to