Package org.opends.server.tools
Class SSLConnectionFactory
- java.lang.Object
-
- org.opends.server.tools.SSLConnectionFactory
-
public class SSLConnectionFactory extends Object
This class provides SSL connection related utility functions.
-
-
Constructor Summary
Constructors Constructor Description SSLConnectionFactory()Constructor for the SSL connection factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SocketcreateSocket(String hostName, int portNumber)Create the SSL socket connection to the specified host.SocketcreateSocket(InetAddress host, int portNumber)Create the SSL socket connection to the specified host.SocketcreateSocket(Socket s, String hostName, int portNumber, boolean autoClose)Create the SSL socket connection to the specified host layered over an existing socket.voidinit(boolean trustAll, String keyStorePath, String keyStorePassword, String clientAlias, String trustStorePath, String trustStorePassword)Initialize the connection factory by creating the key and trust managers for the SSL connection.
-
-
-
Method Detail
-
init
public void init(boolean trustAll, String keyStorePath, String keyStorePassword, String clientAlias, String trustStorePath, String trustStorePassword) throws SSLConnectionExceptionInitialize 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 Socket createSocket(String hostName, int portNumber) throws SSLConnectionException, 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.IOException- If a problem occurs while attempting to communicate with the server.
-
createSocket
public Socket createSocket(InetAddress host, int portNumber) throws SSLConnectionException, IOException
Create the SSL socket connection to the specified host.- Parameters:
host- 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.IOException- If a problem occurs while attempting to communicate with the server.
-
createSocket
public Socket createSocket(Socket s, String hostName, int portNumber, boolean autoClose) throws SSLConnectionException, 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.IOException- If a problem occurs while attempting to communicate with the server.
-
-