netscape.ldap.factory

Class JSSESocketFactory

Implemented Interfaces:
LDAPSocketFactory, LDAPTLSSocketFactory, java.io.Serializable

public class JSSESocketFactory
extends java.lang.Object
implements LDAPTLSSocketFactory, java.io.Serializable

Creates an SSL socket connection to a server, using the JSSE package from Sun. This class implements the LDAPSocketFactory interface.

See Also:
LDAPSocketFactory, LDAPConnection.LDAPConnection(LDAPSocketFactory), Serialized Form

Field Summary

protected SSLSocketFactory
factory
protected String[]
suites

Constructor Summary

JSSESocketFactory()
Default factory constructor
JSSESocketFactory(String[] suites)
Factory constructor that uses the default JSSE SSLSocketFactory
JSSESocketFactory(String[] suites, SSLSocketFactory factory)
Factory constructor that provides an explicit SSLSocketFactory.

Method Summary

Socket
makeSocket(Socket s)
Creates an SSL socket layered over an existing socket.
Socket
makeSocket(String host, int port)
Creates an SSL socket.

Field Details

factory

protected SSLSocketFactory factory


suites

protected String[] suites

Constructor Details

JSSESocketFactory

public JSSESocketFactory()
Default factory constructor


JSSESocketFactory

public JSSESocketFactory(String[] suites)
Factory constructor that uses the default JSSE SSLSocketFactory

Parameters:
suites - Cipher suites to attempt to use with the server; if null, use any cipher suites available in the JSSE package


JSSESocketFactory

public JSSESocketFactory(String[] suites,
                         SSLSocketFactory factory)
Factory constructor that provides an explicit SSLSocketFactory.

Parameters:
suites - Cipher suites to attempt to use with the server; if null, use any cipher suites available in the JSSE package
factory - the specific SSL server socket factory to use

Method Details

makeSocket

public Socket makeSocket(Socket s)
            throws LDAPException
Creates an SSL socket layered over an existing socket. Used for the startTLS implementation (RFC2830).
Specified by:
makeSocket in interface LDAPTLSSocketFactory

Parameters:
s - An existing non-SSL socket

Returns:
A SSL socket layered over the input socket

Throws:
LDAPException - on error creating socket

Since:
LDAPJDK 4.17


makeSocket

public Socket makeSocket(String host,
                         int port)
            throws LDAPException
Creates an SSL socket.
Specified by:
makeSocket in interface LDAPSocketFactory

Parameters:
host - Host name or IP address of SSL server
port - Port numbers of SSL server

Returns:
A socket for an encrypted session

Throws:
LDAPException - on error creating socket