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

davsclaus pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new 448b74b1890f [backport camel-4.22.x] CAMEL-27229: camel-ftp - ftps 
checks the server certificate against the JVM trust store when no trust store 
is configured (#30381)
448b74b1890f is described below

commit 448b74b1890fc38541118eaefe9e88569a2759a9
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 19 10:13:13 2026 +0100

    [backport camel-4.22.x] CAMEL-27229: camel-ftp - ftps checks the server 
certificate against the JVM trust store when no trust store is configured 
(#30381)
    
    An ftps endpoint configured with neither sslContextParameters nor the
    ftpClient.trustStore options kept the default trust manager of Commons
    Net, which only checks the validity dates of the server certificate.
    It now uses the default trust store of the JVM. The endpoints with
    sslContextParameters, the ftpClient.trustStore options or a custom
    ftpClient are unchanged.
    
    The FTPS integration tests configure a trust store for the certificate
    of the test server. The FTP component page and the 4.24 upgrade guide
    describe how to configure a trust store for a server with a self-signed
    certificate.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    (cherry picked from commit c57d0d8cbc47bc10ebb00e409f56132173bac4a0)
---
 .../apache/camel/catalog/docs/ftp-component.adoc   |  29 ++++--
 .../camel-ftp/src/main/docs/ftp-component.adoc     |  29 ++++--
 .../camel/component/file/remote/FtpsEndpoint.java  |   4 +
 .../file/remote/FtpsEndpointTrustManagerTest.java  | 101 +++++++++++++++++++++
 .../FileToFtpsExplicitSSLWithClientAuthIT.java     |   3 +-
 .../FileToFtpsExplicitSSLWithoutClientAuthIT.java  |   2 +-
 .../FileToFtpsExplicitTLSWithClientAuthIT.java     |   3 +-
 .../FileToFtpsExplicitTLSWithoutClientAuthIT.java  |   2 +-
 .../FileToFtpsImplicitSSLWithClientAuthIT.java     |   3 +-
 .../FileToFtpsImplicitSSLWithoutClientAuthIT.java  |   2 +-
 .../FileToFtpsImplicitTLSWithClientAuthIT.java     |   3 +-
 .../FileToFtpsImplicitTLSWithoutClientAuthIT.java  |   2 +-
 .../FileToFtpsWithDefaultSettingsIPV6IT.java       |   3 +-
 .../FileToFtpsWithDefaultSettingsIT.java           |   3 +-
 .../remote/integration/FtpsServerTestSupport.java  |   6 ++
 15 files changed, 169 insertions(+), 26 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
index 34423c3fcde4..2df726b2d1f0 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
@@ -102,14 +102,27 @@ earlier versions, use 
`ftpClient.endpointCheckingEnabled=true` as shown above.
 
 === FTPS component default trust store
 
-When using the `ftpClient.` properties related to SSL with the FTPS
-component, the trust store accepts all certificates. If you only want
-trust selective certificates, you have to configure the trust store with
-the `ftpClient.trustStore.xxx` options or by configuring a custom
-`ftpClient`.
-
-When using `sslContextParameters`, the trust store is managed by the
-configuration of the provided SSLContextParameters instance.
+Without trust settings, an `ftps` endpoint checks the certificate of the 
server against the default trust store of the
+JVM: the `cacerts` file of the JDK, or the trust store set with the 
`javax.net.ssl.trustStore` system property. A server
+certificate signed by a public certificate authority needs no configuration.
+
+For a server with a self-signed certificate, or a certificate signed by your 
own certificate authority, put that
+certificate (or the certificate of the authority) in a trust store and 
configure the endpoint with one of:
+
+* the `ftpClient.trustStore.` options: `ftpClient.trustStore.file`, 
`ftpClient.trustStore.password`, and optionally
+`ftpClient.trustStore.type` (the default key store type of the JVM by default) 
and `ftpClient.trustStore.algorithm`
+(the default trust manager algorithm of the JVM by default).
+* `sslContextParameters`: the trust store is then the one of the provided 
SSLContextParameters instance, and the
+`ftpClient.keyStore.` and `ftpClient.trustStore.` options are not used.
+
+[source,text]
+----
+ftps://admin@myserver/inbox?password=RAW(secret)&ftpClient.trustStore.file=/etc/camel/ftps-truststore.p12&ftpClient.trustStore.type=PKCS12&ftpClient.trustStore.password=RAW(changeit)
+----
+
+A custom `ftpClient` (an `FTPSClient` instance) keeps the trust manager it was 
created with: Camel does not change it.
+To check the server certificate in another way, configure the trust manager 
yourself, on a custom `ftpClient` with
+`setTrustManager`, or with the trust managers of `sslContextParameters`.
 
 You can configure additional options on the `ftpClient` and
 `ftpClientConfig` from the URI directly by using the `ftpClient.` or
diff --git a/components/camel-ftp/src/main/docs/ftp-component.adoc 
b/components/camel-ftp/src/main/docs/ftp-component.adoc
index 34423c3fcde4..2df726b2d1f0 100644
--- a/components/camel-ftp/src/main/docs/ftp-component.adoc
+++ b/components/camel-ftp/src/main/docs/ftp-component.adoc
@@ -102,14 +102,27 @@ earlier versions, use 
`ftpClient.endpointCheckingEnabled=true` as shown above.
 
 === FTPS component default trust store
 
-When using the `ftpClient.` properties related to SSL with the FTPS
-component, the trust store accepts all certificates. If you only want
-trust selective certificates, you have to configure the trust store with
-the `ftpClient.trustStore.xxx` options or by configuring a custom
-`ftpClient`.
-
-When using `sslContextParameters`, the trust store is managed by the
-configuration of the provided SSLContextParameters instance.
+Without trust settings, an `ftps` endpoint checks the certificate of the 
server against the default trust store of the
+JVM: the `cacerts` file of the JDK, or the trust store set with the 
`javax.net.ssl.trustStore` system property. A server
+certificate signed by a public certificate authority needs no configuration.
+
+For a server with a self-signed certificate, or a certificate signed by your 
own certificate authority, put that
+certificate (or the certificate of the authority) in a trust store and 
configure the endpoint with one of:
+
+* the `ftpClient.trustStore.` options: `ftpClient.trustStore.file`, 
`ftpClient.trustStore.password`, and optionally
+`ftpClient.trustStore.type` (the default key store type of the JVM by default) 
and `ftpClient.trustStore.algorithm`
+(the default trust manager algorithm of the JVM by default).
+* `sslContextParameters`: the trust store is then the one of the provided 
SSLContextParameters instance, and the
+`ftpClient.keyStore.` and `ftpClient.trustStore.` options are not used.
+
+[source,text]
+----
+ftps://admin@myserver/inbox?password=RAW(secret)&ftpClient.trustStore.file=/etc/camel/ftps-truststore.p12&ftpClient.trustStore.type=PKCS12&ftpClient.trustStore.password=RAW(changeit)
+----
+
+A custom `ftpClient` (an `FTPSClient` instance) keeps the trust manager it was 
created with: Camel does not change it.
+To check the server certificate in another way, configure the trust manager 
yourself, on a custom `ftpClient` with
+`setTrustManager`, or with the trust managers of `sslContextParameters`.
 
 You can configure additional options on the `ftpClient` and
 `ftpClientConfig` from the URI directly by using the `ftpClient.` or
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
index 7223f29c5a7b..7e1988c00776 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
@@ -39,6 +39,7 @@ import org.apache.commons.net.ftp.FTPClient;
 import org.apache.commons.net.ftp.FTPClientConfig;
 import org.apache.commons.net.ftp.FTPFile;
 import org.apache.commons.net.ftp.FTPSClient;
+import org.apache.commons.net.util.TrustManagerUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -161,6 +162,9 @@ public class FtpsEndpoint extends FtpEndpoint<FTPFile> {
                 trustMgrFactory.init(trustStore);
 
                 client.setTrustManager(trustMgrFactory.getTrustManagers()[0]);
+            } else {
+                // without trust store options, check the server certificate 
against the JVM default trust store
+                
client.setTrustManager(TrustManagerUtils.getDefaultTrustManager(null));
             }
         }
 
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsEndpointTrustManagerTest.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsEndpointTrustManagerTest.java
new file mode 100644
index 000000000000..289be07995b0
--- /dev/null
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsEndpointTrustManagerTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.file.remote;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.KeyStore;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.apache.commons.net.ftp.FTPSClient;
+import org.apache.commons.net.util.TrustManagerUtils;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * The trust manager of the FTPS client that the endpoint creates. The 
certificate of the test server is self-signed and
+ * only in src/test/resources/server.jks.
+ */
+public class FtpsEndpointTrustManagerTest extends CamelTestSupport {
+
+    private static final String TRUST_STORE_OPTIONS
+            = 
"ftpClient.trustStore.file=./src/test/resources/server.jks&ftpClient.trustStore.type=JKS"
+              + "&ftpClient.trustStore.password=password";
+
+    @BindToRegistry("customFtpClient")
+    private final FTPSClient customFtpClient = new FTPSClient();
+
+    @Test
+    public void createdClientWithoutTrustSettingsUsesJvmDefaultTrustStore() 
throws Exception {
+        FtpsEndpoint endpoint = context.getEndpoint("ftps://localhost/dir", 
FtpsEndpoint.class);
+
+        FTPSClient client = (FTPSClient) endpoint.createFtpClient();
+
+        
assertEquals(TrustManagerUtils.getDefaultTrustManager(null).getClass(), 
client.getTrustManager().getClass());
+    }
+
+    @Test
+    public void 
createdClientWithoutTrustSettingsRejectsServerCertificateNotInTrustStore() 
throws Exception {
+        FtpsEndpoint endpoint = context.getEndpoint("ftps://localhost/dir", 
FtpsEndpoint.class);
+        X509Certificate[] chain = serverCertificateChain();
+
+        X509TrustManager trustManager
+                = assertInstanceOf(X509TrustManager.class, ((FTPSClient) 
endpoint.createFtpClient()).getTrustManager());
+
+        assertThrows(CertificateException.class, () -> 
trustManager.checkServerTrusted(chain, "RSA"));
+    }
+
+    @Test
+    public void 
createdClientWithTrustStoreOptionsAcceptsServerCertificateInTrustStore() throws 
Exception {
+        FtpsEndpoint endpoint = context.getEndpoint("ftps://localhost/dir?" + 
TRUST_STORE_OPTIONS, FtpsEndpoint.class);
+        X509Certificate[] chain = serverCertificateChain();
+
+        X509TrustManager trustManager
+                = assertInstanceOf(X509TrustManager.class, ((FTPSClient) 
endpoint.createFtpClient()).getTrustManager());
+
+        assertDoesNotThrow(() -> trustManager.checkServerTrusted(chain, 
"RSA"));
+    }
+
+    @Test
+    public void customFtpClientKeepsItsTrustManager() throws Exception {
+        X509TrustManager before = assertInstanceOf(X509TrustManager.class, 
customFtpClient.getTrustManager());
+        FtpsEndpoint endpoint = 
context.getEndpoint("ftps://localhost/dir?ftpClient=#customFtpClient", 
FtpsEndpoint.class);
+
+        endpoint.createRemoteFileOperations();
+
+        assertSame(before, customFtpClient.getTrustManager());
+    }
+
+    private static X509Certificate[] serverCertificateChain() throws Exception 
{
+        KeyStore keyStore = KeyStore.getInstance("JKS");
+        try (InputStream is = 
Files.newInputStream(Paths.get("src/test/resources/server.jks"))) {
+            keyStore.load(is, "password".toCharArray());
+        }
+        return new X509Certificate[] { (X509Certificate) 
keyStore.getCertificate("ftpserver") };
+    }
+}
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithClientAuthIT.java
index 79693482bbcf..5bd528a06cc2 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithClientAuthIT.java
@@ -31,7 +31,8 @@ public class FileToFtpsExplicitSSLWithClientAuthIT extends 
FtpsServerExplicitSSL
         return "ftps://admin@localhost:{{ftp.server.port}}"
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true"
                + 
"&securityProtocol=TLSv1.2&implicit=false&ftpClient.keyStore.file=./src/test/resources/server.jks&ftpClient.keyStore.type=JKS"
-               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true";
+               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true"
+               + TRUST_STORE_OPTIONS;
     }
 
     @Test
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithoutClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithoutClientAuthIT.java
index 688ab1f71caa..0e48b3b221cb 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithoutClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitSSLWithoutClientAuthIT.java
@@ -30,7 +30,7 @@ public class FileToFtpsExplicitSSLWithoutClientAuthIT extends 
FtpsServerExplicit
     protected String getFtpUrl() {
         return "ftps://admin@localhost:" + service.getPort()
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true&delete=true"
-               + "&securityProtocol=TLSv1.2&implicit=false";
+               + "&securityProtocol=TLSv1.2&implicit=false" + 
TRUST_STORE_OPTIONS;
     }
 
     @Test
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithClientAuthIT.java
index b31be68340fe..e5202a54bbb0 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithClientAuthIT.java
@@ -32,7 +32,8 @@ public class FileToFtpsExplicitTLSWithClientAuthIT extends 
FtpsServerExplicitTLS
         return "ftps://admin@localhost:{{ftp.server.port}}"
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true"
                + 
"&securityProtocol=TLSv1.3&implicit=false&ftpClient.keyStore.file=./src/test/resources/server.jks&ftpClient.keyStore.type=JKS"
-               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true";
+               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true"
+               + TRUST_STORE_OPTIONS;
     }
 
     @Disabled("Embedded Apache FtpServer does not support TLS 1.3")
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithoutClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithoutClientAuthIT.java
index 06e1db5fd593..7ec628337a27 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithoutClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsExplicitTLSWithoutClientAuthIT.java
@@ -31,7 +31,7 @@ public class FileToFtpsExplicitTLSWithoutClientAuthIT extends 
FtpsServerExplicit
     protected String getFtpUrl() {
         return "ftps://admin@localhost:{{ftp.server.port}}"
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true"
-               + "&securityProtocol=TLSv1.3&implicit=false&delete=true";
+               + "&securityProtocol=TLSv1.3&implicit=false&delete=true" + 
TRUST_STORE_OPTIONS;
     }
 
     @Disabled("Embedded Apache FtpServer does not support TLS 1.3")
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithClientAuthIT.java
index 95d354883201..15b85ade8e9d 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithClientAuthIT.java
@@ -31,7 +31,8 @@ public class FileToFtpsImplicitSSLWithClientAuthIT extends 
FtpsServerImplicitSSL
         return "ftps://admin@localhost:" + service.getPort()
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true"
                + 
"&securityProtocol=TLSv1.2&implicit=true&ftpClient.keyStore.file=./src/test/resources/server.jks&ftpClient.keyStore.type=JKS"
-               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true";
+               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true"
+               + TRUST_STORE_OPTIONS;
     }
 
     @Test
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithoutClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithoutClientAuthIT.java
index 52a731442bf5..82d3e19f2e17 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithoutClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitSSLWithoutClientAuthIT.java
@@ -30,7 +30,7 @@ public class FileToFtpsImplicitSSLWithoutClientAuthIT extends 
FtpsServerImplicit
     protected String getFtpUrl() {
         return "ftps://admin@localhost:{{ftp.server.port}}"
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true"
-               + "&securityProtocol=TLSv1.2&implicit=true&delete=true";
+               + "&securityProtocol=TLSv1.2&implicit=true&delete=true" + 
TRUST_STORE_OPTIONS;
     }
 
     @Test
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithClientAuthIT.java
index d2668205cfcc..65fce311d61a 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithClientAuthIT.java
@@ -32,7 +32,8 @@ public class FileToFtpsImplicitTLSWithClientAuthIT extends 
FtpsServerImplicitTLS
         return "ftps://admin@localhost:{{ftp.server.port}}"
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true"
                + 
"&securityProtocol=TLSv1.3&implicit=true&ftpClient.keyStore.file=./src/test/resources/server.jks&ftpClient.keyStore.type=JKS"
-               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true";
+               + 
"&ftpClient.keyStore.algorithm=SunX509&ftpClient.keyStore.password=password&ftpClient.keyStore.keyPassword=password&delete=true"
+               + TRUST_STORE_OPTIONS;
     }
 
     @Disabled("Embedded Apache FtpServer does not support TLS 1.3")
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithoutClientAuthIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithoutClientAuthIT.java
index 8294ff1e00ec..65ede4b20a68 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithoutClientAuthIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsImplicitTLSWithoutClientAuthIT.java
@@ -31,7 +31,7 @@ public class FileToFtpsImplicitTLSWithoutClientAuthIT extends 
FtpsServerImplicit
     protected String getFtpUrl() {
         return "ftps://admin@localhost:{{ftp.server.port}}"
                + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true"
-               + "&securityProtocol=TLSv1.3&implicit=true&delete=true";
+               + "&securityProtocol=TLSv1.3&implicit=true&delete=true" + 
TRUST_STORE_OPTIONS;
     }
 
     @Disabled("Embedded Apache FtpServer does not support TLS 1.3")
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIPV6IT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIPV6IT.java
index 5cee515a1c6f..19c367f752aa 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIPV6IT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIPV6IT.java
@@ -29,7 +29,8 @@ public class FileToFtpsWithDefaultSettingsIPV6IT extends 
FtpsServerExplicitTLSWi
 
     private String getFtpUrl() {
         return "ftps://admin@[::1]:{{ftp.server.port}}"
-               + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true&delete=true";
+               + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true&delete=true"
+               + TRUST_STORE_OPTIONS;
     }
 
     @Test
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIT.java
index 29edc6b1109b..9a700b8e9083 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FileToFtpsWithDefaultSettingsIT.java
@@ -30,7 +30,8 @@ public class FileToFtpsWithDefaultSettingsIT extends 
FtpsServerExplicitTLSWithou
 
     private String getFtpUrl() {
         return "ftps://admin@localhost:{{ftp.server.port}}"
-               + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true&delete=true";
+               + 
"/tmp2/camel?password=admin&initialDelay=2000&disableSecureDataChannelDefaults=true&delete=true"
+               + TRUST_STORE_OPTIONS;
     }
 
     @Disabled("Embedded Apache FtpServer does not support TLS 1.3")
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpsServerTestSupport.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpsServerTestSupport.java
index 36956e278d55..cec83fafe929 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpsServerTestSupport.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpsServerTestSupport.java
@@ -24,4 +24,10 @@ import 
org.apache.camel.component.file.remote.BaseServerTestSupport;
 public abstract class FtpsServerTestSupport extends BaseServerTestSupport {
     protected static final String AUTH_VALUE_SSL = "TLSv1.2";
     protected static final String AUTH_VALUE_TLS = "TLSv1.3";
+
+    /**
+     * Endpoint options for a trust store with the certificate of the test 
server, which is self-signed.
+     */
+    protected static final String TRUST_STORE_OPTIONS = 
"&ftpClient.trustStore.file=./src/test/resources/server.jks"
+                                                        + 
"&ftpClient.trustStore.type=JKS&ftpClient.trustStore.password=password";
 }

Reply via email to