This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch bouncycastle-1.81 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 64514a52e6d0e9c79e2c9a78de10df5c5bcabf8f Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Thu Jun 12 11:22:00 2025 +0200 Upgrade Bouncycastle to version 1.81 Signed-off-by: Andrea Cosentino <anco...@gmail.com> --- .../apache/camel/component/pqc/PQCComponent.java | 4 - .../component/pqc/PQCSignatureAlgorithms.java | 3 +- .../pqc/crypto/PQCDefaultRainbowMaterial.java | 54 ------------ .../pqc/PQCSignatureRainbowNoAutowiredTest.java | 76 ----------------- .../component/pqc/PQCSignatureRainbowTest.java | 97 ---------------------- parent/pom.xml | 2 +- 6 files changed, 2 insertions(+), 234 deletions(-) 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 78239db496a..11e704ac805 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 @@ -86,10 +86,6 @@ public class PQCComponent extends HealthCheckComponent { configuration.setSigner(PQCDefaultPicnicMaterial.signer); configuration.setKeyPair(PQCDefaultPicnicMaterial.keyPair); break; - case "RAINBOW": - configuration.setSigner(PQCDefaultRainbowMaterial.signer); - configuration.setKeyPair(PQCDefaultRainbowMaterial.keyPair); - break; default: break; } 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 c2c79b3da2d..e2108a07f6b 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 @@ -26,8 +26,7 @@ public enum PQCSignatureAlgorithms { // Experimental and non-standardized FALCON("FALCON", "BCPQC"), - PICNIC("PICNIC", "BCPQC"), - RAINBOW("RAINBOW", "BCPQC"); + PICNIC("PICNIC", "BCPQC"); private final String algorithm; private final String bcProvider; diff --git a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultRainbowMaterial.java b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultRainbowMaterial.java deleted file mode 100644 index 4deb98e30f8..00000000000 --- a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/crypto/PQCDefaultRainbowMaterial.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.RainbowParameterSpec; - -public class PQCDefaultRainbowMaterial { - 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.RAINBOW.getAlgorithm()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - protected static KeyPairGenerator prepareKeyPair() - throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException { - KeyPairGenerator kpGen = KeyPairGenerator.getInstance(PQCSignatureAlgorithms.RAINBOW.getAlgorithm(), - PQCSignatureAlgorithms.RAINBOW.getBcProvider()); - kpGen.initialize(RainbowParameterSpec.rainbowVclassic); - return kpGen; - } -} diff --git a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureRainbowNoAutowiredTest.java b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureRainbowNoAutowiredTest.java deleted file mode 100644 index c4f58b39d62..00000000000 --- a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureRainbowNoAutowiredTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 PQCSignatureRainbowNoAutowiredTest extends CamelTestSupport { - - @EndpointInject("mock:sign") - protected MockEndpoint resultSign; - - @EndpointInject("mock:verify") - protected MockEndpoint resultVerify; - - @Produce("direct:sign") - protected ProducerTemplate templateSign; - - public PQCSignatureRainbowNoAutowiredTest() throws NoSuchAlgorithmException { - } - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() { - from("direct:sign").to("pqc:sign?operation=sign&signatureAlgorithm=RAINBOW").to("mock:sign") - .to("pqc:verify?operation=verify&signatureAlgorithm=RAINBOW") - .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/PQCSignatureRainbowTest.java b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureRainbowTest.java deleted file mode 100644 index a24916737fa..00000000000 --- a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/PQCSignatureRainbowTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.InvalidAlgorithmParameterException; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.Security; -import java.security.Signature; - -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.RainbowParameterSpec; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class PQCSignatureRainbowTest extends CamelTestSupport { - - @EndpointInject("mock:sign") - protected MockEndpoint resultSign; - - @EndpointInject("mock:verify") - protected MockEndpoint resultVerify; - - @Produce("direct:sign") - protected ProducerTemplate templateSign; - - public PQCSignatureRainbowTest() 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.RAINBOW.getAlgorithm(), - PQCSignatureAlgorithms.RAINBOW.getBcProvider()); - kpGen.initialize(RainbowParameterSpec.rainbowVclassic); - KeyPair kp = kpGen.generateKeyPair(); - return kp; - } - - @BindToRegistry("Signer") - public Signature getSigner() throws NoSuchAlgorithmException { - Signature mlDsa = Signature.getInstance(PQCSignatureAlgorithms.RAINBOW.getAlgorithm()); - return mlDsa; - } -} diff --git a/parent/pom.xml b/parent/pom.xml index 42c42478fbf..77136ee5e92 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -81,7 +81,7 @@ <azure-sdk-bom-version>1.2.35</azure-sdk-bom-version> <azure-storage-blob-changefeed-version>12.0.0-beta.30</azure-storage-blob-changefeed-version> <beanio-version>3.2.1</beanio-version> - <bouncycastle-version>1.80</bouncycastle-version> + <bouncycastle-version>1.81</bouncycastle-version> <box-java-sdk-version>4.16.2</box-java-sdk-version> <braintree-gateway-version>3.42.0</braintree-gateway-version> <build-helper-maven-plugin-version>3.6.1</build-helper-maven-plugin-version>