我正在尝试使用TLS连接到apached但我收到了LdapOperationException:
PROTOCOL_ERROR:服务器将断开连接!
这是我的代码:
LdapNetworkConnection connection = null;
LdapConnectionConfig ldapConnectionConfig = new LdapConnectionConfig();
ldapConnectionConfig.setUseTls(true);
ldapConnectionConfig.setLdapHost("localhost");
ldapConnectionConfig.setLdapPort(10636);
ldapConnectionConfig.setTrustManagers(new X509TrustManager(){
public X509Certificate[] getAcceptedIssuers(){
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException{}
public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException{}
});
connection = new LdapNetworkConnection(ldapConnectionConfig);
connection.connect();
try{
connection.startTls();
}catch(LdapException e){
e.printStackTrace();
}
可能是什么问题?
答案 0 :(得分:1)
使用端口10389,10636用于LDAPS连接。