LDAP Classes
Implements Java LDAP

com.novell.ldap
Class LDAPJSSEStartTLSFactory

java.lang.Object
  extended bycom.novell.ldap.LDAPJSSEStartTLSFactory
All Implemented Interfaces:
org.ietf.ldap.LDAPSocketFactory, LDAPSocketFactory, LDAPTLSSocketFactory

public class LDAPJSSEStartTLSFactory
extends java.lang.Object
implements LDAPTLSSocketFactory, org.ietf.ldap.LDAPSocketFactory

Represents a socket factory that the method startTLS of LDAPConnection can use to create secure TLS connections to LDAP servers using JSSE technology.

See Also:
LDAPConnection.LDAPConnection(LDAPSocketFactory), LDAPConnection.setSocketFactory(com.novell.ldap.LDAPSocketFactory)

Constructor Summary
LDAPJSSEStartTLSFactory()
          Constructs an LDAPJSSEStartTLSFactory object using the default settings for a JSSE SSLSocketFactory.
LDAPJSSEStartTLSFactory(javax.net.ssl.SSLSocketFactory factory)
          Constructs an LDAPSocketFactory using the SSLSocketFactory specified.
 
Method Summary
 java.net.Socket createSocket(java.net.Socket socket)
          Called by startTLS and returns a TLS secured socket which is layered over the specified socket.
 java.net.Socket createSocket(java.lang.String host, int port)
          Returns a socket connected using the provided host name and port number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPJSSEStartTLSFactory

public LDAPJSSEStartTLSFactory()
Constructs an LDAPJSSEStartTLSFactory object using the default settings for a JSSE SSLSocketFactory.

Setting the keystore for the default implementation is specific to the implementation. For Sun's JSSE implementation, the property javax.net.ssl.truststore should be set to the path of a keystore that holds the trusted root certificate of the directory server.

For information on creating keystores see the keytool documentation on Java 2, security tools


LDAPJSSEStartTLSFactory

public LDAPJSSEStartTLSFactory(javax.net.ssl.SSLSocketFactory factory)
Constructs an LDAPSocketFactory using the SSLSocketFactory specified.

This SSLSocketFactory is used when startTLS is called. For information on using the SSLSocketFactory see also javax.net.ssl.SSLContext.

Method Detail

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Description copied from interface: LDAPSocketFactory
Returns a socket connected using the provided host name and port number.

This method is called in the constructor of LDAPConnection and the resulting socket will be used for the duration of the connection.

Specified by:
createSocket in interface LDAPSocketFactory
Parameters:
host - The host name or a dotted string representing the IP address of the LDAP server to which you want to connect.

port - The TCP or UDP port number to connect to or contact. The default LDAP port is 389.
Returns:
the new Socket
Throws:
java.net.UnknownHostException - The specified host could not be found.
java.io.IOException - The socket to the specified host and port could not be created.

createSocket

public java.net.Socket createSocket(java.net.Socket socket)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Description copied from interface: LDAPTLSSocketFactory
Called by startTLS and returns a TLS secured socket which is layered over the specified socket.

Implementations of this interface MUST return a TLS secured socket which, when closed, does not close the underlying socket.

RFC2830 - the LDAP draft explaining how TLS should work in LDAP, maindates that the connection identity must match the identify in the certificate returned from the server. For more information see rfc2830 section 5.2

Specified by:
createSocket in interface LDAPTLSSocketFactory
Parameters:
socket - The socket on which TLS is to be negotiated.
Returns:
The socket with TLS negotiated.
Throws:
java.io.IOException - The socket to the specified host and port could not be created.
java.net.UnknownHostException - The specified host could not be found.
See Also:
LDAPConnection.startTLS()

LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000