[Date Prev][Date Next] [Chronological] [Thread] [Top]

Jldap with SSL Fails

I'm having problems with multiple connection requests when using Jldap with SSL.
I believe I have everything configured correctly including keystores,
certificates, classpaths, etc. In fact, the test program below (and my actual
program) runs fine for me if I run it with the -Djavax.net.debug="all" flag:

java -classpath
-Djavax.net.debug="all" SSLConnection serverName "cn=manager,dc=company,dc=com"
goober c:\tmp\ldaptest\keystore\sslkey.keystore 

I have tried this test against a build of the latest Jldap sources, the binaries
from Novell, and with the Novell security provider. No luck. Does anyone know
what's going on here? Is anyone else using Jldap, or should I punt and go to



 * Test of Jldap SSL with Sun security provider (a slight modification of
Novell's SSLConnection.
import com.novell.ldap.*;
import java.security.Security;

public class SSLConnection
        public static void main( String[] args )
                if (args.length != 4) {
                   System.err.println("Usage:   java SSLConnection <localhost>"
                                                        + " <login dn>
                   System.err.println("Example: java SSLConnection Acme.com"
                                                        + " \"cn=Admin,o=Acme\"

                int ldapPort = LDAPConnection.DEFAULT_SSL_PORT;
                int ldapVersion = LDAPConnection.LDAP_V3;
                String ldapHost = args[0];
                String loginDN = args[1];
                String password = args[2];
                String path = args[3];

                LDAPSocketFactory ssf = null;
                //dynamically set JSSE as a security provider

                //dynamically set the property that JSSE uses to identify
                //the keystore that holds trusted root certificates
                System.setProperty("javax.net.ssl.trustStore", path);

                // The socket factory must be set before the connection is made.
                ssf = new LDAPJSSESecureSocketFactory();
                if (ldapPort == LDAPConnection.DEFAULT_SSL_PORT)

                for(int i=0; i <= 2; i++)
                                // Note: the socket factory can also be passed
in as a
                                // to the constructor.
                                LDAPConnection lc = new LDAPConnection();

                                // connect to the server
                                lc.connect( ldapHost, ldapPort );

                                // authenticate to the server
                                lc.bind( ldapVersion, loginDN, password );

                                // at this point you are connected with a secure

                                System.err.println( "Successful SSL bind with

                        catch( LDAPException e ) {
                                System.out.println( "Error: " + e.toString() );