Top Description Fields Constructors Methods
org.conscrypt

pack-priv final Class ConscryptServerSocket

extends SSLServerSocket
Class Inheritance
Imports
java.io.IOException, java.net.InetAddress, .Socket, javax.net.ssl.SSLServerSocket

BoringSSL-based implementation of server sockets.

Field Summary

Modifier and TypeField and Description
private boolean
private final SSLParametersImpl
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
ConscryptServerSocket(int port, SSLParametersImpl sslParameters)

pack-priv
ConscryptServerSocket(int port, int backlog, SSLParametersImpl sslParameters)

pack-priv
ConscryptServerSocket(int port, int backlog, InetAddress iAddress, SSLParametersImpl sslParameters)

Method Summary

Modifier and TypeMethod and Description
public Socket
accept()

Overrides java.net.ServerSocket.accept.

Listens for a connection to be made to this socket and accepts it.
public String[]
getEnabledCipherSuites()

Implements abstract javax.net.ssl.SSLServerSocket.getEnabledCipherSuites.

Returns the list of cipher suites which are currently enabled for use by newly accepted connections.
public String[]

Returns:

an array of protocols names
getEnabledProtocols
()

Implements abstract javax.net.ssl.SSLServerSocket.getEnabledProtocols.

The names of the protocols' versions that in use on this SSL connection.
public boolean
getEnableSessionCreation()

Implements abstract javax.net.ssl.SSLServerSocket.getEnableSessionCreation.

Returns true if new SSL sessions may be established by the sockets which are created from this server socket.
public boolean
getNeedClientAuth()

Implements abstract javax.net.ssl.SSLServerSocket.getNeedClientAuth.

Returns true if client authentication will be required on newly accepted server-mode SSLSockets.
public String[]
getSupportedCipherSuites()

Implements abstract javax.net.ssl.SSLServerSocket.getSupportedCipherSuites.

Returns the names of the cipher suites which could be enabled for use on an SSL connection.
public String[]

Returns:

an array of protocols names
getSupportedProtocols
()

Implements abstract javax.net.ssl.SSLServerSocket.getSupportedProtocols.

The names of the protocols' versions that may be used on this SSL connection.
public boolean
getUseClientMode()

Implements abstract javax.net.ssl.SSLServerSocket.getUseClientMode.

Returns true if accepted connections will be in SSL client mode.
public boolean
getWantClientAuth()

Implements abstract javax.net.ssl.SSLServerSocket.getWantClientAuth.

Returns true if client authentication will be requested on newly accepted server-mode connections.
pack-priv boolean
isChannelIdEnabled()

Checks whether the TLS Channel ID extension is enabled for this server socket.

pack-priv void
setChannelIdEnabled(boolean enabled)

Enables/disables the TLS Channel ID extension for this server socket.

public void
setEnabledCipherSuites(String[]
the names of all the cipher suites to enable
suites
)

Implements abstract javax.net.ssl.SSLServerSocket.setEnabledCipherSuites.

This method enables the cipher suites listed by getSupportedCipherSuites().
public void
setEnabledProtocols(String[]
names of all the protocols to enable.
protocols
)

Implements abstract javax.net.ssl.SSLServerSocket.setEnabledProtocols.

This method enables the protocols' versions listed by getSupportedProtocols().
public void
setEnableSessionCreation(boolean
true indicates that sessions may be created; this is the default. false indicates that an existing session must be resumed.
flag
)

Implements abstract javax.net.ssl.SSLServerSocket.setEnableSessionCreation.

Controls whether new SSL sessions may be established by the sockets which are created from this server socket.
public void
setNeedClientAuth(boolean
set to true if client authentication is required, or false if no client authentication is desired.
need
)

Implements abstract javax.net.ssl.SSLServerSocket.setNeedClientAuth.

Controls whether accepted server-mode SSLSockets will be initially configured to require client authentication.
public void
setUseClientMode(boolean
true if newly accepted connections should use SSL client mode.
mode
)

Implements abstract javax.net.ssl.SSLServerSocket.setUseClientMode.

Controls whether accepted connections are in the (default) SSL server mode, or the SSL client mode.
pack-priv ConscryptServerSocket
setUseEngineSocket(boolean useEngineSocket)

Configures the socket to be created for this instance.

public void
setWantClientAuth(boolean
set to true if client authentication is requested, or false if no client authentication is desired.
want
)

Implements abstract javax.net.ssl.SSLServerSocket.setWantClientAuth.

Controls whether accepted server-mode SSLSockets will be initially configured to request client authentication.
Inherited from javax.net.ssl.SSLServerSocket:
getSSLParameterssetSSLParameters

Field Detail

channelIdEnabledback to summary
private boolean channelIdEnabled
sslParametersback to summary
private final SSLParametersImpl sslParameters
useEngineSocketback to summary
private boolean useEngineSocket

Constructor Detail

ConscryptServerSocketback to summary
pack-priv ConscryptServerSocket(SSLParametersImpl sslParameters) throws IOException
ConscryptServerSocketback to summary
pack-priv ConscryptServerSocket(int port, SSLParametersImpl sslParameters) throws IOException
ConscryptServerSocketback to summary
pack-priv ConscryptServerSocket(int port, int backlog, SSLParametersImpl sslParameters) throws IOException
ConscryptServerSocketback to summary
pack-priv ConscryptServerSocket(int port, int backlog, InetAddress iAddress, SSLParametersImpl sslParameters) throws IOException

Method Detail

acceptback to summary
public Socket accept() throws IOException

Overrides java.net.ServerSocket.accept.

Doc from java.net.ServerSocket.accept.

Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made.

This method is interruptible in the following circumstances:

  1. The socket is associated with a ServerSocketChannel. In that case, interrupting a thread accepting a connection will close the underlying channel and cause this method to throw java.nio.channels.ClosedByInterruptException with the interrupt status set.
  2. The socket uses the system-default socket implementation and a virtual thread is accepting a connection. In that case, interrupting the virtual thread will cause it to wakeup and close the socket. This method will then throw SocketException with the interrupt status set.

A new Socket s is created and, if there is a security manager, the security manager's checkAccept method is called with s.getInetAddress().getHostAddress() and s.getPort() as its arguments to ensure the operation is allowed. This could result in a SecurityException.

Returns:Socket

the new Socket

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when waiting for a connection.
getEnabledCipherSuitesback to summary
public String[] getEnabledCipherSuites()

Implements abstract javax.net.ssl.SSLServerSocket.getEnabledCipherSuites.

Doc from javax.net.ssl.SSLServerSocket.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.

Returns:String[]

an array of cipher suites enabled

Annotations
@Override
getEnabledProtocolsback to summary
public String[] getEnabledProtocols()

Implements abstract javax.net.ssl.SSLServerSocket.getEnabledProtocols.

The names of the protocols' versions that in use on this SSL connection.

Returns:String[]

an array of protocols names

Annotations
@Override
getEnableSessionCreationback to summary
public boolean getEnableSessionCreation()

Implements abstract javax.net.ssl.SSLServerSocket.getEnableSessionCreation.

Doc from javax.net.ssl.SSLServerSocket.getEnableSessionCreation.

Returns true if new SSL sessions may be established by the sockets which are created from this server socket.

Returns:boolean

true indicates that sessions may be created; this is the default. false indicates that an existing session must be resumed

Annotations
@Override
getNeedClientAuthback to summary
public boolean getNeedClientAuth()

Implements abstract javax.net.ssl.SSLServerSocket.getNeedClientAuth.

Doc from javax.net.ssl.SSLServerSocket.getNeedClientAuth.

Returns true if client authentication will be required on newly accepted server-mode SSLSockets.

The initial inherited setting may be overridden by calling SSLSocket#setNeedClientAuth(boolean) or SSLSocket#setWantClientAuth(boolean).

Returns:boolean

true if client authentication is required, or false if no client authentication is desired.

Annotations
@Override
getSupportedCipherSuitesback to summary
public String[] getSupportedCipherSuites()

Implements abstract javax.net.ssl.SSLServerSocket.getSupportedCipherSuites.

Doc from javax.net.ssl.SSLServerSocket.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.

Returns:String[]

an array of cipher suite names

Annotations
@Override
getSupportedProtocolsback to summary
public String[] getSupportedProtocols()

Implements abstract javax.net.ssl.SSLServerSocket.getSupportedProtocols.

The names of the protocols' versions that may be used on this SSL connection.

Returns:String[]

an array of protocols names

Annotations
@Override
getUseClientModeback to summary
public boolean getUseClientMode()

Implements abstract javax.net.ssl.SSLServerSocket.getUseClientMode.

Doc from javax.net.ssl.SSLServerSocket.getUseClientMode.

Returns true if accepted connections will be in SSL client mode.

Returns:boolean

true if the connection should use SSL client mode.

Annotations
@Override
getWantClientAuthback to summary
public boolean getWantClientAuth()

Implements abstract javax.net.ssl.SSLServerSocket.getWantClientAuth.

Doc from javax.net.ssl.SSLServerSocket.getWantClientAuth.

Returns true if client authentication will be requested on newly accepted server-mode connections.

The initial inherited setting may be overridden by calling SSLSocket#setNeedClientAuth(boolean) or SSLSocket#setWantClientAuth(boolean).

Returns:boolean

true if client authentication is requested, or false if no client authentication is desired.

Annotations
@Override
isChannelIdEnabledback to summary
pack-priv boolean isChannelIdEnabled()

Checks whether the TLS Channel ID extension is enabled for this server socket.

setChannelIdEnabledback to summary
pack-priv void setChannelIdEnabled(boolean enabled)

Enables/disables the TLS Channel ID extension for this server socket.

setEnabledCipherSuitesback to summary
public void setEnabledCipherSuites(String[] suites)

Implements abstract javax.net.ssl.SSLServerSocket.setEnabledCipherSuites.

This method enables the cipher suites listed by getSupportedCipherSuites().

Parameters
suites:String[]

the names of all the cipher suites to enable

Annotations
@Override
Exceptions
IllegalArgumentException:
when one or more of the ciphers in array suites are not supported, or when the array is null.
setEnabledProtocolsback to summary
public void setEnabledProtocols(String[] protocols)

Implements abstract javax.net.ssl.SSLServerSocket.setEnabledProtocols.

This method enables the protocols' versions listed by getSupportedProtocols().

Parameters
protocols:String[]

names of all the protocols to enable.

Annotations
@Override
Exceptions
IllegalArgumentException:
when one or more of the names in the array are not supported, or when the array is null.
setEnableSessionCreationback to summary
public void setEnableSessionCreation(boolean flag)

Implements abstract javax.net.ssl.SSLServerSocket.setEnableSessionCreation.

Doc from javax.net.ssl.SSLServerSocket.setEnableSessionCreation.

Controls whether new SSL sessions may be established by the sockets which are created from this server socket.

SSLSockets returned from accept() inherit this setting.

Parameters
flag:boolean

true indicates that sessions may be created; this is the default. false indicates that an existing session must be resumed.

Annotations
@Override
setNeedClientAuthback to summary
public void setNeedClientAuth(boolean need)

Implements abstract javax.net.ssl.SSLServerSocket.setNeedClientAuth.

Doc from javax.net.ssl.SSLServerSocket.setNeedClientAuth.

Controls whether accepted server-mode SSLSockets will be initially configured to require client authentication.

A socket's client authentication setting is one of the following:

  • client authentication required
  • client authentication requested
  • no client authentication desired

Unlike setWantClientAuth(boolean), if the accepted socket's option is set and the client chooses not to provide authentication information about itself, the negotiations will stop and the connection will be dropped.

Calling this method overrides any previous setting made by this method or setWantClientAuth(boolean).

The initial inherited setting may be overridden by calling SSLSocket#setNeedClientAuth(boolean) or SSLSocket#setWantClientAuth(boolean).

Parameters
need:boolean

set to true if client authentication is required, or false if no client authentication is desired.

Annotations
@Override
setUseClientModeback to summary
public void setUseClientMode(boolean mode)

Implements abstract javax.net.ssl.SSLServerSocket.setUseClientMode.

Doc from javax.net.ssl.SSLServerSocket.setUseClientMode.

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.

SSLSockets returned from accept() inherit this setting.

Parameters
mode:boolean

true if newly accepted connections should use SSL client mode.

Annotations
@Override
setUseEngineSocketback to summary
pack-priv ConscryptServerSocket setUseEngineSocket(boolean useEngineSocket)

Configures the socket to be created for this instance.

setWantClientAuthback to summary
public void setWantClientAuth(boolean want)

Implements abstract javax.net.ssl.SSLServerSocket.setWantClientAuth.

Doc from javax.net.ssl.SSLServerSocket.setWantClientAuth.

Controls whether accepted server-mode SSLSockets will be initially configured to request client authentication.

A socket's client authentication setting is one of the following:

  • client authentication required
  • client authentication requested
  • no client authentication desired

Unlike setNeedClientAuth(boolean), if the accepted socket's option is set and the client chooses not to provide authentication information about itself, the negotiations will continue.

Calling this method overrides any previous setting made by this method or setNeedClientAuth(boolean).

The initial inherited setting may be overridden by calling SSLSocket#setNeedClientAuth(boolean) or SSLSocket#setWantClientAuth(boolean).

Parameters
want:boolean

set to true if client authentication is requested, or false if no client authentication is desired.

Annotations
@Override