Home

Results 1 to 2 of 2

Thread: LDAP over SSL connection problem ?

  1. #1
    flatplane NNTP User

    LDAP over SSL connection problem ?


    Hello,

    I got a problem with coding LDAP over SSL. I got the following error
    under tomcat :

    LDAP Error : LDAPException: Connection lost waiting for results from
    10.30.42.2:636 (91) Connect Error
    java.io.EOFException: BERDecoder: decode: EOF in Identifier

    Please what does it mean ? My certificate was add as trusted and out of
    tomcat, a jar works great using approximately the same code :

    LDAPSocketFactory ssf;

    try {
    // Dynamically set JSSE as a security provider
    // Security.addProvider(new
    com.sun.net.ssl.internal.ssl.Provider());

    // Dynamically set the property that JSSE uses to identify
    // the keystore that holds trusted root certificates
    //
    System.out.println(System.getProperty("javax.net.s sl.trustStore"));
    //System.setProperty("javax.net.ssl.trustStore", path);
    //
    System.out.println(System.getProperty("javax.net.s sl.trustStore"));

    ssf = new LDAPJSSESecureSocketFactory();

    // Set the socket factory as the default for all future
    connections
    //LDAPConnection.setSocketFactory(ssf);


    // Note: the socket factory can also be passed in as a
    parameter
    // to the constructor to set it for this connection only.
    LDAPConnection lc = new LDAPConnection(ssf);

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


    Any help would be greatly appreciated..

    Regards

    FP


    --
    flatplane
    ------------------------------------------------------------------------
    flatplane's Profile: http://forums.novell.com/member.php?userid=81794
    View this thread: http://forums.novell.com/showthread.php?t=405749


  2. #2
    Jim Willeke NNTP User

    Re: LDAP over SSL connection problem ?

    I have added the cert to the default keystore for the Java VM I am using.

    This works for me:

    public LDAPSSL()
    {
    LDAPSocketFactory ssf;

    ssf = new LDAPJSSESecureSocketFactory();
    LDAPConnection lc = new LDAPConnection(ssf);
    // connect to the server
    String ldapHost = "ldap.yourdomain.com";
    int ldapPort = LDAPConnection.DEFAULT_SSL_PORT;
    try
    {
    lc.connect(ldapHost, ldapPort);
    System.out.println("Success!");
    }
    catch (LDAPException e)
    {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }

    public static void main(String[] args)
    {
    LDAPSSL ldssl = new LDAPSSL();
    }


    -jim


    On 3/25/2010 10:16 AM, flatplane wrote:
    >
    > Hello,
    >
    > I got a problem with coding LDAP over SSL. I got the following error
    > under tomcat :
    >
    > LDAP Error : LDAPException: Connection lost waiting for results from
    > 10.30.42.2:636 (91) Connect Error
    > java.io.EOFException: BERDecoder: decode: EOF in Identifier
    >
    > Please what does it mean ? My certificate was add as trusted and out of
    > tomcat, a jar works great using approximately the same code :
    >
    > LDAPSocketFactory ssf;
    >
    > try {
    > // Dynamically set JSSE as a security provider
    > // Security.addProvider(new
    > com.sun.net.ssl.internal.ssl.Provider());
    >
    > // Dynamically set the property that JSSE uses to identify
    > // the keystore that holds trusted root certificates
    > //
    > System.out.println(System.getProperty("javax.net.s sl.trustStore"));
    > //System.setProperty("javax.net.ssl.trustStore", path);
    > //
    > System.out.println(System.getProperty("javax.net.s sl.trustStore"));
    >
    > ssf = new LDAPJSSESecureSocketFactory();
    >
    > // Set the socket factory as the default for all future
    > connections
    > //LDAPConnection.setSocketFactory(ssf);
    >
    >
    > // Note: the socket factory can also be passed in as a
    > parameter
    > // to the constructor to set it for this connection only.
    > LDAPConnection lc = new LDAPConnection(ssf);
    >
    > // connect to the server
    > lc.connect(ldapHost,ldapPort);
    >
    >
    > Any help would be greatly appreciated..
    >
    > Regards
    >
    > FP
    >
    >


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •