All Packages Class Hierarchy This Package Previous Next Index
Class sun.security.ssl.SSLServerSocket
java.lang.Object
|
+----java.net.ServerSocket
|
+----sun.security.ssl.SSLServerSocket
- public final class SSLServerSocket
- extends ServerSocket
This class provides a simple way for servers to support conventional
use of the Secure Sockets Layer (SSL). Application code uses an
SSLServerSocket exactly like it uses a regular TCP ServerSocket; the
difference is that the connections established are secured using SSL.
System security defaults prevent server sockets from accepting
connections if they the authentication context has not been given
a certificate chain and its matching private key. If the clients
of your application support "anonymous" cipher suites, you may be
able to configure a server socket to accept those suites.
Notes:
- This API is still a "work in progress". Comments are solicited!
It is not intended to be a complete (or final) API at this time.
- As of this writing, there is no public way to "log in" and provide
the private key and certificate chain to the authentication context.
This means that server sockets must explicitly enable an anonymous
cipher suite.
- See Also:
- SSLSocket
-
SSLServerSocket(int)
- Create an SSL server socket on a port, using the default
authentication context.
-
SSLServerSocket(int, AuthContext)
- Create an SSL server socket on a port, using a non-default
authentication context.
-
SSLServerSocket(int, int)
- Create an SSL server socket on a port, using the default
authentication context and a specified backlog of connections.
-
SSLServerSocket(int, int, AuthContext)
- Create an SSL server socket on a port, using a non-default
authentication context and a specified connection backlog.
-
accept()
- Accept a new SSL connection.
-
getEnabledCipherSuites()
- Returns the list of cipher suites which are currently enabled
for use by newly accepted connections.
-
setEnabledCipherSuites(String[])
- Controls which particular SSL cipher suites are enabled for use
by accepted connections.
-
setNeedClientAuth(boolean)
- Controls whether the connections which are accepted must include
client authentication.
-
toString()
- Provides a brief description of this SSL socket.
SSLServerSocket
public SSLServerSocket(int port) throws IOException
- Create an SSL server socket on a port, using the default
authentication context. The connection backlog defaults to
fifty connections queued up before the system starts to
reject new connection requests.
- Parameters:
- port - the port on which to listen
SSLServerSocket
public SSLServerSocket(int port,
int backlog) throws IOException
- Create an SSL server socket on a port, using the default
authentication context and a specified backlog of connections.
- Parameters:
- port - the port on which to listen
- backlog - how many connections may be pending before
the system should start rejecting new requests
SSLServerSocket
public SSLServerSocket(int port,
AuthContext context) throws IOException
- Create an SSL server socket on a port, using a non-default
authentication context. The connection backlog defaults to
fifty connections queued up before the system starts to
reject new connection requests.
- Parameters:
- port - the port on which to listen
- context - authentication context for this server
SSLServerSocket
public SSLServerSocket(int port,
int backlog,
AuthContext context) throws IOException, SSLException
- Create an SSL server socket on a port, using a non-default
authentication context and a specified connection backlog.
- Parameters:
- port - the port on which to listen
- backlog - how many connections may be pending before
the system should start rejecting new requests
- context - authentication context for this server
getEnabledCipherSuites
public String[] getEnabledCipherSuites()
- Returns the list of cipher suites which are currently enabled
for use by newly accepted connections.
- See Also:
- getSupportedCipherSuites, getDefaultCipherSuites, setEnabledCipherSuites
setEnabledCipherSuites
public void setEnabledCipherSuites(String suites[])
- Controls which particular SSL cipher suites are enabled for use
by accepted connections. The cipher suites must have been listed
by SSLSocket.getSupportedCipherSuites() as being supported. Suites
which require authentication information which is not available
in this ServerSocket's authentication context will not be used
in any case, even if they are enabled.
- Parameters:
- suites - Names of all the cipher suites to enable; null
means to accept system defaults.
- See Also:
- getSupportedCipherSuites, getDefaultCipherSuites, getEnabledCipherSuites
setNeedClientAuth
public void setNeedClientAuth(boolean flag)
- Controls whether the connections which are accepted must include
client authentication. By default, clients do not need to provide
authentication information.
accept
public Socket accept() throws IOException
- Accept a new SSL connection. This server identifies itself with
information provided in the authentication context which was
presented during construction.
- Overrides:
- accept in class ServerSocket
toString
public String toString()
- Provides a brief description of this SSL socket.
- Overrides:
- toString in class ServerSocket
All Packages Class Hierarchy This Package Previous Next Index