Skip to content

Commit bb33328

Browse files
committed
feat: Use test containers for SFTP/Mina-sftp tests and remove certs from the repo
* remove cert files and use testcontainers * Add RSA certificate test to mina-sftp * ssh remove net.i2p.crypto eddsa support
1 parent 257e7c9 commit bb33328

27 files changed

Lines changed: 885 additions & 683 deletions

File tree

extensions/ftp/deployment/src/main/java/org/apache/camel/quarkus/component/ftp/deployment/FtpProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ class FtpProcessor {
2727
FeatureBuildItem feature() {
2828
return new FeatureBuildItem(FEATURE);
2929
}
30+
3031
}

extensions/ssh/deployment/src/main/java/org/apache/camel/quarkus/component/ssh/deployment/SshProcessor.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.security.KeyFactory;
2020
import java.security.KeyPairGenerator;
2121
import java.security.Signature;
22+
import java.util.ArrayList;
23+
import java.util.Arrays;
2224
import java.util.List;
2325

2426
import javax.crypto.KeyAgreement;
@@ -33,7 +35,6 @@
3335
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
3436
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
3537
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
36-
import net.i2p.crypto.eddsa.EdDSAEngine;
3738
import org.apache.sshd.common.channel.ChannelListener;
3839
import org.apache.sshd.common.forward.PortForwardingEventListener;
3940
import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
@@ -51,15 +52,29 @@ FeatureBuildItem feature() {
5152

5253
@BuildStep
5354
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
55+
// Register standard Java security and SSHD classes
56+
List<Class<?>> classes = new ArrayList<>(Arrays.asList(
57+
KeyPairGenerator.class,
58+
KeyAgreement.class,
59+
KeyFactory.class,
60+
Signature.class,
61+
Mac.class,
62+
Nio2ServiceFactoryFactory.class));
63+
64+
// Conditionally register net.i2p.crypto EdDSA classes only if present on classpath.
65+
// When net.i2p.crypto:eddsa is excluded, Apache SSHD 2.15+ automatically falls back
66+
// to BouncyCastle for EdDSA support (see BouncyCastleSecurityProviderRegistrar).
67+
try {
68+
classes.add(Class.forName("net.i2p.crypto.eddsa.EdDSAEngine", false,
69+
Thread.currentThread().getContextClassLoader()));
70+
classes.add(Class.forName("net.i2p.crypto.eddsa.KeyFactory", false,
71+
Thread.currentThread().getContextClassLoader()));
72+
} catch (ClassNotFoundException e) {
73+
// EdDSA classes not available - BouncyCastle will handle EdDSA instead
74+
}
75+
5476
reflectiveClasses.produce(
55-
ReflectiveClassBuildItem.builder(KeyPairGenerator.class,
56-
KeyAgreement.class,
57-
KeyFactory.class,
58-
Signature.class,
59-
Mac.class,
60-
Nio2ServiceFactoryFactory.class,
61-
EdDSAEngine.class,
62-
net.i2p.crypto.eddsa.KeyFactory.class).methods().build());
77+
ReflectiveClassBuildItem.builder(classes.toArray(new Class<?>[0])).methods().build());
6378
}
6479

6580
@BuildStep

extensions/ssh/runtime/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@
4848
<groupId>org.apache.camel.quarkus</groupId>
4949
<artifactId>camel-quarkus-support-bouncycastle</artifactId>
5050
</dependency>
51-
<!-- TODO: Remove this as it's an optional dependency -->
52-
<!-- https://github.com/apache/camel-quarkus/issues/2212 -->
53-
<dependency>
54-
<groupId>net.i2p.crypto</groupId>
55-
<artifactId>eddsa</artifactId>
56-
</dependency>
5751
<dependency>
5852
<groupId>org.graalvm.sdk</groupId>
5953
<artifactId>nativeimage</artifactId>

extensions/ssh/runtime/src/main/java/org/apache/camel/quarkus/component/ssh/runtime/SubstituteEdDSAEngine.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

integration-tests-support/sftp/pom.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,8 @@
3838
<artifactId>camel-quarkus-integration-test-support</artifactId>
3939
</dependency>
4040
<dependency>
41-
<groupId>org.apache.sshd</groupId>
42-
<artifactId>sshd-sftp</artifactId>
43-
</dependency>
44-
<dependency>
45-
<groupId>org.apache.sshd</groupId>
46-
<artifactId>sshd-scp</artifactId>
41+
<groupId>org.testcontainers</groupId>
42+
<artifactId>testcontainers</artifactId>
4743
</dependency>
4844
<dependency>
4945
<groupId>io.quarkus</groupId>

0 commit comments

Comments
 (0)