Class SSLSocketFactory
- java.lang.Object
-
- javax.net.SocketFactory
-
- javax.net.ssl.SSLSocketFactory
-
- com.ibm.websphere.ssl.protocol.SSLSocketFactory
-
public class SSLSocketFactory extends javax.net.ssl.SSLSocketFactory
This class is for creating SSLSockets. It utilizes the com.ibm.websphere.ssl.JSSEHelper APIs to retrieve WebSphere SSL configuration information. You can pass in a Properties object containing SSL properties, or an SSL alias, or allow it to return the default SSLSocketFactory.
- Since:
- WAS 6.1
- Version:
- 1.0
- See Also:
JSSEHelper
-
-
Field Summary
Fields Modifier and Type Field and Description protected boolean
default_constructor
protected java.util.Map
ldapConnectionInfo
protected java.util.Properties
props
protected static java.util.Map
validateLdapConnectionInfo
-
Constructor Summary
Constructors Constructor and Description SSLSocketFactory()
This is the default constructor which will retrieve the default SSL configuration for creating Sockets.SSLSocketFactory(java.util.Properties sslprops)
This constructor allows you to pass in a set of SSL properties used for creating Sockets.SSLSocketFactory(java.lang.String alias)
This constructor allows you to pass in an SSL alias to retrieve an SSL configuration other than the default for creating Sockets.SSLSocketFactory(java.lang.String alias, java.util.Map connectionInfo)
This constructor allows you to pass in an SSL alias, and/or connectionInfo.
-
Method Summary
Methods Modifier and Type Method and Description int
compare(javax.net.SocketFactory sf1, javax.net.SocketFactory sf2)
java.net.Socket
createSocket()
Creates an unconnected socket.java.net.Socket
createSocket(java.net.InetAddress host, int port)
Creates a socket and connects it to the specified port number at the specified address.java.net.Socket
createSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort)
Creates a socket and connects it to the specified remote host on the specified remote port.java.net.Socket
createSocket(java.net.Socket s, java.lang.String host, int port, boolean autoClose)
Returns a socket layered over an existing socket connected to the named host, at the given port.java.net.Socket
createSocket(java.lang.String host, int port)
Creates a socket and connects it to the specified remote host at the specified remote port.java.net.Socket
createSocket(java.lang.String host, int port, java.net.InetAddress localHost, int localPort)
Creates a socket and connects it to the specified remote host on the specified remote port.static javax.net.SocketFactory
getDefault()
Returns a copy of the environment's default socket factory.java.lang.String[]
getDefaultCipherSuites()
Returns the list of cipher suites which are enabled by default.java.lang.String[]
getSupportedCipherSuites()
Returns the names of the cipher suites which could be enabled for use on an SSL connection created by this factory.
-
-
-
Field Detail
-
props
protected java.util.Properties props
-
default_constructor
protected boolean default_constructor
-
ldapConnectionInfo
protected java.util.Map ldapConnectionInfo
-
validateLdapConnectionInfo
protected static java.util.Map validateLdapConnectionInfo
-
-
Constructor Detail
-
SSLSocketFactory
public SSLSocketFactory()
This is the default constructor which will retrieve the default SSL configuration for creating Sockets. It first tries to find the javax.net.ssl.* properties and if not present will choose the default SSL configuration.
-
SSLSocketFactory
public SSLSocketFactory(java.lang.String alias)
This constructor allows you to pass in an SSL alias to retrieve an SSL configuration other than the default for creating Sockets. If the alias is not found, the default SSL configuration will be used.
- Parameters:
String
- alias
-
SSLSocketFactory
public SSLSocketFactory(java.util.Properties sslprops)
This constructor allows you to pass in a set of SSL properties used for creating Sockets.
- Parameters:
java.util.Properties
- sslprops
-
SSLSocketFactory
public SSLSocketFactory(java.lang.String alias, java.util.Map connectionInfo)
This constructor allows you to pass in an SSL alias, and/or connectionInfo. depending upon what is available. You may specified null for any parameters. If the connectionInfo is specified, a check will be made to determine if a dynamic association between protocol/host/port has been made for this particular protocol and target host/port. If there is not dynamic association and an SSL alias is specified, a direct selection will occur. Finally, a group selection will occur where the localEndPoint (contained in the connectionInfo) will be used to determine if an SSL config is associated with that endpoint. If not, it will move up the topology to determine the next management scope that has an SSL configuration associated which this EndPoint falls under (e.g., server -> node -> cell, etc.).
- Parameters:
String
- aliasjava.util.Map
- connectionInfo- See Also:
JSSEHelper
-
-
Method Detail
-
getDefault
public static javax.net.SocketFactory getDefault()
Returns a copy of the environment's default socket factory.
-
getDefaultCipherSuites
public java.lang.String[] getDefaultCipherSuites()
Returns the list of cipher suites which are enabled by default.
- Specified by:
getDefaultCipherSuites
in classjavax.net.ssl.SSLSocketFactory
-
getSupportedCipherSuites
public java.lang.String[] getSupportedCipherSuites()
Returns the names of the cipher suites which could be enabled for use on an SSL connection created by this factory.- Specified by:
getSupportedCipherSuites
in classjavax.net.ssl.SSLSocketFactory
-
createSocket
public java.net.Socket createSocket() throws java.io.IOException
Creates an unconnected socket.
- Overrides:
createSocket
in classjavax.net.SocketFactory
- Returns:
- java.net.Socket
- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.net.Socket s, java.lang.String host, int port, boolean autoClose) throws java.io.IOException, java.net.UnknownHostException
Returns a socket layered over an existing socket connected to the named host, at the given port. The properties used to create the SSL socket are based upon the what was passed into the SSLSocketFactory constructor.
- Specified by:
createSocket
in classjavax.net.ssl.SSLSocketFactory
- Parameters:
java.net.Socket
- s - existing socketString
- host - target hostint
- port - target portboolean
- autoClose - close the underlying socket when this socket is closed- Returns:
- java.net.Socket
- Throws:
java.io.IOException
java.net.UnknownHostException
-
createSocket
public java.net.Socket createSocket(java.net.InetAddress host, int port) throws java.io.IOException
Creates a socket and connects it to the specified port number at the specified address. The properties used to create the SSL socket are based upon the what was passed into the SSLSocketFactory constructor.
- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
InetAddress
- host - target hostint
- port - target port- Returns:
- java.net.Socket
- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort) throws java.io.IOException
Creates a socket and connects it to the specified remote host on the specified remote port. The socket will also be bound to the local address and port supplied. This socket is configured using the socket options established for this factory. The properties used to create the SSL socket are based upon the what was passed into the SSLSocketFactory constructor.
- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
InetAddress
- host - target hostint
- port - target portInetAddress
- localAddress - local hostint
- localPort - local port- Returns:
- java.net.Socket
- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.lang.String host, int port) throws java.io.IOException, java.net.UnknownHostException
Creates a socket and connects it to the specified remote host at the specified remote port. This socket is configured using the socket options established for this factory. The properties used to create the SSL socket are based upon the what was passed into the SSLSocketFactory constructor.
- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
InetAddress
- host - target hostint
- port - target portInetAddress
- localAddress - local hostint
- localPort - local port- Returns:
- java.net.Socket
- Throws:
java.io.IOException
java.net.UnknownHostException
-
createSocket
public java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localHost, int localPort) throws java.io.IOException, java.net.UnknownHostException
Creates a socket and connects it to the specified remote host on the specified remote port. The socket will also be bound to the local address and port supplied. This socket is configured using the socket options established for this factory. The properties used to create the SSL socket are based upon the what was passed into the SSLSocketFactory constructor.
- Specified by:
createSocket
in classjavax.net.SocketFactory
- Parameters:
String
- host - target hostint
- port - target portInetAddress
- localAddress - local hostint
- localPort - local port- Returns:
- java.net.Socket
- Throws:
java.io.IOException
java.net.UnknownHostException
-
compare
public int compare(javax.net.SocketFactory sf1, javax.net.SocketFactory sf2)
-
-