org.opends.server.tools
Class SSLConnectionFactory

java.lang.Object
  extended by org.opends.server.tools.SSLConnectionFactory

public class SSLConnectionFactory
extends java.lang.Object

This class provides SSL connection related utility functions.


Constructor Summary
SSLConnectionFactory()
          Constructor for the SSL connection factory.
 
Method Summary
 java.net.Socket createSocket(java.net.Socket s, java.lang.String hostName, int portNumber, boolean autoClose)
          Create the SSL socket connection to the specified host layered over an existing socket.
 java.net.Socket createSocket(java.lang.String hostName, int portNumber)
          Create the SSL socket connection to the specified host.
 void init(boolean trustAll, java.lang.String keyStorePath, java.lang.String keyStorePassword, java.lang.String clientAlias, java.lang.String trustStorePath, java.lang.String trustStorePassword)
          Initialize the connection factory by creating the key and trust managers for the SSL connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSLConnectionFactory

public SSLConnectionFactory()
Constructor for the SSL connection factory.

Method Detail

init

public void init(boolean trustAll,
                 java.lang.String keyStorePath,
                 java.lang.String keyStorePassword,
                 java.lang.String clientAlias,
                 java.lang.String trustStorePath,
                 java.lang.String trustStorePassword)
          throws SSLConnectionException
Initialize the connection factory by creating the key and trust managers for the SSL connection.

Parameters:
trustAll - Indicates whether to blindly trust all certificates.
keyStorePath - The path to the key store file.
keyStorePassword - The PIN to use to access the key store contents.
clientAlias - The alias to use for the client certificate.
trustStorePath - The path to the trust store file.
trustStorePassword - The PIN to use to access the trust store contents.
Throws:
SSLConnectionException - If a problem occurs while initializing the connection factory.

createSocket

public java.net.Socket createSocket(java.lang.String hostName,
                                    int portNumber)
                             throws SSLConnectionException,
                                    java.io.IOException
Create the SSL socket connection to the specified host.

Parameters:
hostName - The address of the system to which the connection should be established.
portNumber - The port number to which the connection should be established.
Returns:
The SSL socket established to the specified host.
Throws:
SSLConnectionException - If a problem occurs while performing SSL negotiation.
java.io.IOException - If a problem occurs while attempting to communicate with the server.

createSocket

public java.net.Socket createSocket(java.net.Socket s,
                                    java.lang.String hostName,
                                    int portNumber,
                                    boolean autoClose)
                             throws SSLConnectionException,
                                    java.io.IOException
Create the SSL socket connection to the specified host layered over an existing socket.

Parameters:
s - The socket to use for the existing connection.
hostName - The address of the system to which the connection should be established.
portNumber - The port number to which the connection should be established.
autoClose - Indicates whether the underlying connection should be automatically closed when the SSL session is ended.
Returns:
The SSL socket established to the specified host.
Throws:
SSLConnectionException - If a problem occurs while performing SSL negotiation.
java.io.IOException - If a problem occurs while attempting to communicate with the server.