ServerSocket and
provides secure server sockets using protocols such as the Secure
Sockets Layer (SSL) or Transport Layer Security (TLS) protocols.
Instances of this class are generally created using an
SSLServerSocketFactory. The primary function
of an SSLServerSocket
is to create SSLSockets by accepting
connections.
An SSLServerSocket contains several pieces of state data
which are inherited by the SSLSocket at
socket creation. These include the enabled cipher
suites and protocols, whether client
authentication is necessary, and whether created sockets should
begin handshaking in client or server mode. The state
inherited by the created SSLSocket can be
overridden by calling the appropriate methods.
java.net.ServerSocket , SSLSocket
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | |
| protected | SSLServerSocket(int
the port on which to listen port, int requested maximum length of the queue of incoming
connections. backlog)Used only by subclasses. |
| protected | SSLServerSocket(int
the port on which to listen port, int requested maximum length of the queue of incoming
connections. backlog, InetAddress the address of the network interface through
which connections will be accepted address)Used only by subclasses. |
| Modifier and Type | Method and Description |
|---|---|
| public abstract String[] | Returns: an array of cipher suites enabledReturns the list of cipher suites which are currently enabled for use by newly accepted connections. |
| public abstract String[] | Returns: an array of protocol namesReturns the names of the protocols which are currently enabled for use by the newly accepted connections. |
| public abstract boolean | Returns: true indicates that sessions may be created; this is the default. false indicates that an existing session must be resumedReturns true if new SSL sessions may be established by the sockets which are created from this server socket. |
| public abstract boolean | Returns: true if client authentication is required, or false if no client authentication is desired.Returns true if client authentication will be required on
newly |
| public SSLParameters | Returns: the SSLParameters in effect for newly accepted connectionsReturns the SSLParameters in effect for newly accepted connections. |
| public abstract String[] | Returns: an array of cipher suite namesReturns the names of the cipher suites which could be enabled for use on an SSL connection. |
| public abstract String[] | Returns: an array of protocol names supportedReturns the names of the protocols which could be enabled for use. |
| public abstract boolean | Returns: true if the connection should use SSL client mode.Returns true if accepted connections will be in SSL client mode. |
| public abstract boolean | Returns: true if client authentication is requested, or false if no client authentication is desired.Returns true if client authentication will be requested on newly accepted server-mode connections. |
| public abstract void | setEnabledCipherSuites(String[]
Names of all the cipher suites to enable suites)Sets the cipher suites enabled for use by accepted connections. |
| public abstract void | setEnabledProtocols(String[]
Names of all the protocols to enable. protocols)Controls which particular protocols are enabled for use by accepted connections. |
| public abstract void | setEnableSessionCreation(boolean
true indicates that sessions may be created; this
is the default. false indicates that an existing session
must be resumed. flag)Controls whether new SSL sessions may be established by the sockets which are created from this server socket. |
| public abstract void | setNeedClientAuth(boolean
set to true if client authentication is required,
or false if no client authentication is desired. need)Controls whether |
| public void | setSSLParameters(SSLParameters
the parameters params)Applies SSLParameters to newly accepted connections. |
| public abstract void | setUseClientMode(boolean
true if newly accepted connections should use SSL
client mode. mode)Controls whether accepted connections are in the (default) SSL server mode, or the SSL client mode. |
| public abstract void | setWantClientAuth(boolean
set to true if client authentication is requested,
or false if no client authentication is desired. want)Controls whether |
| SSLServerSocket | back to summary |
|---|---|
| protected SSLServerSocket() throws IOException Used only by subclasses. Create an unbound TCP server socket using the default authentication context.
| |
| SSLServerSocket | back to summary |
|---|---|
| protected SSLServerSocket(int port) throws IOException Used only by subclasses. Create a TCP 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.
A port number of
| |
| SSLServerSocket | back to summary |
|---|---|
| protected SSLServerSocket(int port, int backlog) throws IOException Used only by subclasses. Create a TCP server socket on a port, using the default authentication context and a specified backlog of connections.
A port number of
The
| |
| SSLServerSocket | back to summary |
|---|---|
| protected SSLServerSocket(int port, int backlog, InetAddress address) throws IOException Used only by subclasses. Create a TCP server socket on a port, using the default authentication context and a specified backlog of connections as well as a particular specified network interface. This constructor is used on multihomed hosts, such as those used for firewalls or as routers, to control through which interface a network service is provided.
A port number of
The If address is null, it will default accepting connections on any/all local addresses.
| |
| getEnabledCipherSuites | back to summary |
|---|---|
| public abstract String[] getEnabledCipherSuites() Returns the list of cipher suites which are currently enabled for use by newly accepted connections. If this list has not been explicitly modified, a system-provided default guarantees a minimum quality of service in all enabled cipher suites. Note that even if a suite is enabled, it may never be used. This can occur if the peer does not support it, or its use is restricted, or the requisite certificates (and private keys) for the suite are not available, or an anonymous suite is enabled but authentication is required. The returned array includes cipher suites from the list of standard cipher suite names in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification, and may also include other cipher suites that the provider supports.
| |
| getEnabledProtocols | back to summary |
|---|---|
| public abstract String[] getEnabledProtocols() Returns the names of the protocols which are currently enabled for use by the newly accepted connections. Note that even if a protocol is enabled, it may never be used. This can occur if the peer does not support the protocol, or its use is restricted, or there are no enabled cipher suites supported by the protocol.
| |
| getEnableSessionCreation | back to summary |
|---|---|
| public abstract boolean getEnableSessionCreation() Returns true if new SSL sessions may be established by the sockets which are created from this server socket.
| |
| getNeedClientAuth | back to summary |
|---|---|
| public abstract boolean getNeedClientAuth() Returns true if client authentication will be required on
newly
The initial inherited setting may be overridden by calling
| |
| getSSLParameters | back to summary |
|---|---|
| public SSLParameters getSSLParameters() Returns the SSLParameters in effect for newly accepted connections. The ciphersuites and protocols of the returned SSLParameters are always non-null.
| |
| getSupportedCipherSuites | back to summary |
|---|---|
| public abstract String[] getSupportedCipherSuites() Returns the names of the cipher suites which could be enabled for use on an SSL connection. Normally, only a subset of these will actually be enabled by default, since this list may include cipher suites which do not meet quality of service requirements for those defaults. Such cipher suites are useful in specialized applications. The returned array includes cipher suites from the list of standard cipher suite names in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification, and may also include other cipher suites that the provider supports.
| |
| getSupportedProtocols | back to summary |
|---|---|
| public abstract String[] getSupportedProtocols() Returns the names of the protocols which could be enabled for use.
| |
| getUseClientMode | back to summary |
|---|---|
| public abstract boolean getUseClientMode() Returns true if accepted connections will be in SSL client mode.
| |
| getWantClientAuth | back to summary |
|---|---|
| public abstract boolean getWantClientAuth() Returns true if client authentication will be requested on newly accepted server-mode connections.
The initial inherited setting may be overridden by calling
| |
| setEnabledCipherSuites | back to summary |
|---|---|
| public abstract void setEnabledCipherSuites(String[] suites) Sets the cipher suites enabled for use by accepted connections.
The cipher suites must have been listed by getSupportedCipherSuites()
as being supported. Following a successful call to this method,
only suites listed in the Suites that 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. Note that the standard list of cipher suite names may be found in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification. Providers may support cipher suite names not found in this list or might not use the recommended name for a certain cipher suite.
| |
| setEnabledProtocols | back to summary |
|---|---|
| public abstract void setEnabledProtocols(String[] protocols) Controls which particular protocols are enabled for use by accepted connections.
The protocols must have been listed by
getSupportedProtocols() as being supported.
Following a successful call to this method, only protocols listed
in the
| |
| setEnableSessionCreation | back to summary |
|---|---|
| public abstract void setEnableSessionCreation(boolean flag) Controls whether new SSL sessions may be established by the sockets which are created from this server socket.
| |
| setNeedClientAuth | back to summary |
|---|---|
| public abstract void setNeedClientAuth(boolean need) Controls whether A socket's client authentication setting is one of the following:
Unlike
Calling this method overrides any previous setting made by
this method or
The initial inherited setting may be overridden by calling
| |
| setSSLParameters | back to summary |
|---|---|
| public void setSSLParameters(SSLParameters params) Applies SSLParameters to newly accepted connections. This means:
| |
| setUseClientMode | back to summary |
|---|---|
| public abstract void setUseClientMode(boolean mode) Controls whether accepted connections are in the (default) SSL server mode, or the SSL client mode. Servers normally authenticate themselves, and clients are not required to do so. In rare cases, TCP servers need to act in the SSL client mode on newly accepted connections. For example, FTP clients acquire server sockets and listen there for reverse connections from the server. An FTP client would use an SSLServerSocket in "client" mode to accept the reverse connection while the FTP server uses an SSLSocket with "client" mode disabled to initiate the connection. During the resulting handshake, existing SSL sessions may be reused.
| |
| setWantClientAuth | back to summary |
|---|---|
| public abstract void setWantClientAuth(boolean want) Controls whether A socket's client authentication setting is one of the following:
Unlike
Calling this method overrides any previous setting made by
this method or
The initial inherited setting may be overridden by calling
| |