我正在尝试为我的 FTPS 客户端使用 org.springframework.integration.ftp.session.DefaultFtpsSessionFactory
,但我没有用户 ID 或密码。我有 *.cer 文件。如何使用证书创建 session 工厂实例。到目前为止我已经看了
https://docs.spring.io/spring-integration/reference/html/ftp.html
http://tutorials.jenkov.com/java-cryptography/certificatefactory.html
How do I configure client authentication with generated certificate in apache-commons net
https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html
我只是找不到在创建 ftpsclient 时使用证书的任何直接用法。
最佳答案
我还没有这样做,但我认为您必须创建 DefaultFtpsSessionFactory
的子类,覆盖 createClientInstance()
以使用 FTPSClient 之一
采用 SSLContext
的构造函数。
您必须使用已从包含证书的 keystore 初始化的 KeyManager
初始化 SSL 上下文。
spring-integration-ip
有 some code that does this for TCP connections .
关于java - 如何借助证书创建 DefaultFtpsSessionFactory 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51734709/