【问题标题】:can not connect to FTPS (explicit) server with java?无法使用 java 连接到 FTPS(显式)服务器?
【发布时间】:2014-09-17 11:29:35
【问题描述】:

我使用此代码通过显式加密连接到 ftps

String host = "10.21.13.66";
int port = 21;
String username = "user";
String password = "pass";
 try {
FTPSClient ftpClient = new FTPSClient("ssl",false);
ftpClient.addProtocolCommandListener(new PrintCommandListener(new  PrintWriter(System.out)));
ftpClient.connect(host, port);
int reply = ftpClient.getReplyCode();
if (FTPReply.isPositiveCompletion(reply)) {

// Login
(ftpClient.login(username, password)) 
}
} catch (IOException ioe) {
System.out.println("FTP client received network error");
}

当我尝试连接到我自己的 ftps 时,它返回此错误:431 No security resource for TLS/SSL encryption,可能没有选定的 SSL 证书

任何帮助将不胜感激;

【问题讨论】:

    标签: java ssl ftps apache-commons-net


    【解决方案1】:

    在构造对象后尝试使用以下代码在 ftps 客户端上设置身份验证:

    ftpClient.setAuthValue("TLS");

    【讨论】:

    • 出现同样的异常
    • 问题在于创建服务器,我没有为它设置证书,因为我虽然证书对于隐式连接是必需的,但我错了
    猜你喜欢
    • 1970-01-01
    • 2011-10-14
    • 1970-01-01
    • 2011-07-15
    • 1970-01-01
    • 2013-11-03
    • 1970-01-01
    • 1970-01-01
    • 2011-05-28
    相关资源
    最近更新 更多