简体   繁体   English

无法使用Java连接到FTPS(显式)服务器?

[英]can not connect to FTPS (explicit) server with java?

I use this code to connect to ftps with explicit encryption 我使用此代码通过显式加密连接到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");
}

when I try to connect to my own ftps it returns this error: 431 No security resource for TLS/SSL encryption, probably there is no selected SSL certificate 当我尝试连接到自己的ftps时,它将返回以下错误:431没有用于TLS / SSL加密的安全资源,可能没有选定的SSL证书

any help would be appreciated; 任何帮助,将不胜感激;

Try setting the auth on ftps client using below code after object is constructed: 构造对象后,尝试使用以下代码在ftps客户端上设置auth:

ftpClient.setAuthValue("TLS"); ftpClient.setAuthValue(“ TLS”);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM