これは私のコードです
try{
TrustManager[] trustManager = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() { return null; }
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
} };
SSLContext sslContext = null;
sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, trustManager, new SecureRandom());
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
FTPClient client = new FTPClient();
client.setSSLSocketFactory(sslSocketFactory);
client.setSecurity(FTPClient.SECURITY_FTPES);
client.connect("xxx.xxx.xxx", 21);
System.out.println("Connected (" + client.isConnected() + ") to host " + client.getHost() + ":" + client.getPort());
client.login("xxxxx", "xxxxx");
}catch (Exception e) {
e.printStackTrace();
}
実行時に返される
Connected (true) to host xxx.xxx.xxx:21
client.login("xxxxx", "xxxxx"); で中断します。例外あり
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
なぜこれが起こるのか分かりますか?
javaのバージョンは1.4.2、ftp4jのバージョンは1.7.2