gnodet commented on code in PR #31349:
URL: https://github.com/apache/camel/pull/31349#discussion_r4798569332


##########
components/camel-pqc/src/test/java/org/apache/camel/component/pqc/lifecycle/KeyAlgorithmSupportTest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.lifecycle;
+
+import java.security.KeyPair;
+import java.security.Security;
+
+import org.apache.camel.component.pqc.PQCKeyEncapsulationAlgorithms;
+import org.apache.camel.component.pqc.PQCSignatureAlgorithms;
+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 org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class KeyAlgorithmSupportTest {
+
+    @BeforeAll
+    static void startup() {
+        if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
+            Security.addProvider(new BouncyCastleProvider());
+        }
+        if (Security.getProvider(BouncyCastlePQCProvider.PROVIDER_NAME) == 
null) {
+            Security.addProvider(new BouncyCastlePQCProvider());
+        }
+    }
+
+    @ParameterizedTest

Review Comment:
   ✅ Excellent use of `@EnumSource` to verify all enum members have default 
parameter specs. This will prevent drift between the enum definitions and the 
mapping in `getDefaultParameterSpec()`. Future additions to 
`PQCSignatureAlgorithms` or `PQCKeyEncapsulationAlgorithms` will immediately 
fail this test if no default is configured.
   
   _Claude Code on behalf of Guillaume Nodet_



##########
components/camel-pqc/src/main/java/org/apache/camel/component/pqc/lifecycle/KeyAlgorithmSupport.java:
##########
@@ -69,7 +63,8 @@ public static KeyPair generateKeyPair(String algorithm, 
Object parameterSpec) th
             if (defaultSpec != null) {
                 generator.initialize(defaultSpec, 
SecureRandomHelper.getSecureRandom());
             } else {
-                generator.initialize(DEFAULT_KEY_SIZE, 
SecureRandomHelper.getSecureRandom());
+                throw new IllegalArgumentException(

Review Comment:
   ⚠️ This is a breaking behavioral change. The removal of the 256-bit fallback 
means algorithms like "EC" that previously generated P-256 keys via 
`initialize(256)` will now fail with `IllegalArgumentException`.
   
   This should be documented in 
`docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc` to 
inform users upgrading to 4.25.
   
   **Note:** PR #31350 addresses this by including an upgrade guide entry.
   
   _Claude Code on behalf of Guillaume Nodet_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to