0

我正在尝试使用 TLS 连接到 apacheds,但出现 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();
    }

可能是什么问题?

4

1 回答 1

1

使用端口 10389,10636 用于 LDAPS 连接。

于 2013-12-24T07:21:04.510 回答