javax.net.ssl

Class SSLSocketFactory


public abstract class SSLSocketFactory
extends SocketFactory

A socket factory for creating Secure Socket Layer (SSL) sockets.

Constructor Summary

SSLSocketFactory()

Method Summary

abstract Socket
createSocket(Socket socket, String host, int port, boolean autoClose)
Creates a SSL socket wrapped around an existing socket.
static SocketFactory
getDefault()
Returns a default implementation of a SSL socket factory.
abstract String[]
getDefaultCipherSuites()
Returns the list of cipher suites that will be enabled in sockets created by this factory.
abstract String[]
getSupportedCipherSuites()
Returns the list of all cipher suites supported by this factory.

Methods inherited from class javax.net.SocketFactory

createSocket, createSocket, createSocket, createSocket, createSocket, getDefault

Constructor Details

SSLSocketFactory

public SSLSocketFactory()

Method Details

createSocket

public abstract Socket createSocket(Socket socket,
                                    String host,
                                    int port,
                                    boolean autoClose)
            throws IOException
Creates a SSL socket wrapped around an existing socket.
Parameters:
socket - The socket to wrap.
host - The host the socket is connected to.
port - The port the socket is connected to.
autoClose - Whether or not the wrapped socket should be closed automatically.
Returns:
The new SSL socket.

getDefault

public static SocketFactory getDefault()
Returns a default implementation of a SSL socket factory.

To control the class that gets returned by this method, set the security property "ssl.SocketFactory.provider" to the class name of a concrete implementation of this class. If not set, a system-dependent implementation will be used.

The implementation returned is created by the first implementation of the SSLContext class found, which is initialized with default parameters. To control the key and trust manager factory algorithms used as defaults, set the security properties "ssl.keyManagerFactory.algorithm" and "ssl.trustManagerFactory.algorithm" to the appropriate names.

Using this method is not recommended. Instead, use the methods of SSLContext, which provide much better control over the creation of socket factories.

Overrides:
getDefault in interface SocketFactory
Returns:
The default socket factory.

getDefaultCipherSuites

public abstract String[] getDefaultCipherSuites()
Returns the list of cipher suites that will be enabled in sockets created by this factory.
Returns:
The default cipher suites.

getSupportedCipherSuites

public abstract String[] getSupportedCipherSuites()
Returns the list of all cipher suites supported by this factory.
Returns:
The list of supported cipher suites.