Hello list,

Is it possible to pass a certificate file like ssl-cert.pem to the LdapConnectionConfig? My sample code right now is:

public static LdapConnection createConnection(String host, int port,
String user, String pass, boolean useSSL, boolean useSSLv3) throws IOException, LdapException {
        LdapConnectionConfig connectionConfig = new LdapConnectionConfig();

        if (host == null || host.isEmpty()) {
throw new IllegalArgumentException("Hostname is not specified");
        }
        if(port <= 0) {
throw new IllegalArgumentException("The ldap port is not valid");
        }
        connectionConfig.setLdapHost(host);
        connectionConfig.setLdapPort(port);

        if(user!= null && user.length() > 0) {
            connectionConfig.setName(user);
        }
        if(pass != null && pass.length() > 0) {
            connectionConfig.setCredentials(pass);
        }
        if(useSSL == true) {
            connectionConfig.setUseSsl(true);
        }
        if(useSSLv3 == true) {
            connectionConfig.setSslProtocol("SSLv3");
        }
LdapConnection connection = new LdapNetworkConnection(connectionConfig);

        connection.connect();
        connection.bind();

        return connection;
}

Reply via email to