APIdia Launch Partner
Top Description Fields Constructors Methods
javax.rmi.ssl

public Class SslRMIServerSocketFactory

extends Object
implements RMIServerSocketFactory
Class Inheritance
All Implemented Interfaces
java.rmi.server.RMIServerSocketFactory
Imports
java.io.IOException, java.net.ServerSocket, .Socket, java.rmi.server.RMIServerSocketFactory, java.util.Arrays, .List, javax.net.ssl.SSLContext, .SSLServerSocketFactory, .SSLSocket, .SSLSocketFactory

An SslRMIServerSocketFactory instance is used by the RMI runtime in order to obtain server sockets for RMI calls via SSL.

This class implements RMIServerSocketFactory over the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols.

This class creates SSL sockets using the default SSLSocketFactory (see SSLSocketFactory#getDefault) or the default SSLServerSocketFactory (see SSLServerSocketFactory#getDefault) unless the constructor taking an SSLContext is used in which case the SSL sockets are created using the SSLSocketFactory returned by SSLContext#getSocketFactory or the SSLServerSocketFactory returned by SSLContext#getServerSocketFactory. When an SSLContext is not supplied all the instances of this class share the same keystore, and the same truststore (when client authentication is required by the server). This behavior can be modified by supplying an already initialized SSLContext instance.

Since
1.5
See Also
javax.net.ssl.SSLSocketFactory, javax.net.ssl.SSLServerSocketFactory, javax.rmi.ssl.SslRMIClientSocketFactory

Field Summary

Modifier and TypeField and Description
private SSLContext
private static SSLSocketFactory
private final String[]
private List<String>
private final String[]
private List<String>
private final boolean

Constructor Summary

AccessConstructor and Description
public
SslRMIServerSocketFactory()

Creates a new SslRMIServerSocketFactory with the default SSL socket configuration.

public
SslRMIServerSocketFactory(String[]
names of all the cipher suites to enable on SSL connections accepted by server sockets created by this factory, or null to use the cipher suites that are enabled by default
enabledCipherSuites
,
String[]
names of all the protocol versions to enable on SSL connections accepted by server sockets created by this factory, or null to use the protocol versions that are enabled by default
enabledProtocols
,
boolean
true to require client authentication on SSL connections accepted by server sockets created by this factory; false to not require client authentication
needClientAuth
)

Creates a new SslRMIServerSocketFactory with the specified SSL socket configuration.

public
SslRMIServerSocketFactory(SSLContext
the SSL context to be used for creating SSL sockets. If context is null the default SSLSocketFactory or the default SSLServerSocketFactory will be used to create SSL sockets. Otherwise, the socket factory returned by SSLContext.getSocketFactory() or SSLContext.getServerSocketFactory() will be used instead.
context
,
String[]
names of all the cipher suites to enable on SSL connections accepted by server sockets created by this factory, or null to use the cipher suites that are enabled by default
enabledCipherSuites
,
String[]
names of all the protocol versions to enable on SSL connections accepted by server sockets created by this factory, or null to use the protocol versions that are enabled by default
enabledProtocols
,
boolean
true to require client authentication on SSL connections accepted by server sockets created by this factory; false to not require client authentication
needClientAuth
)

Creates a new SslRMIServerSocketFactory with the specified SSLContext and SSL socket configuration.

Method Summary

Modifier and TypeMethod and Description
private boolean
public ServerSocket
createServerSocket(int port)

Implements java.rmi.server.RMIServerSocketFactory.createServerSocket.

Creates a server socket that accepts SSL connections configured according to this factory's SSL socket configuration parameters.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private static synchronized SSLSocketFactory
public final String[]

Returns:

an array of cipher suites enabled, or null
getEnabledCipherSuites
()

Returns the names of the cipher suites enabled on SSL connections accepted by server sockets created by this factory, or null if this factory uses the cipher suites that are enabled by default.

public final String[]

Returns:

an array of protocol versions enabled, or null
getEnabledProtocols
()

Returns the names of the protocol versions enabled on SSL connections accepted by server sockets created by this factory, or null if this factory uses the protocol versions that are enabled by default.

public final boolean

Returns:

true if client authentication is required
getNeedClientAuth
()

Returns true if client authentication is required on SSL connections accepted by server sockets created by this factory.

public int

Returns:

a hash code value for this SslRMIServerSocketFactory.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this SslRMIServerSocketFactory.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private SSLContext context
defaultSSLSocketFactoryback to summary
private static SSLSocketFactory defaultSSLSocketFactory
enabledCipherSuitesback to summary
private final String[] enabledCipherSuites
enabledCipherSuitesListback to summary
private List<String> enabledCipherSuitesList
enabledProtocolsback to summary
private final String[] enabledProtocols
enabledProtocolsListback to summary
private List<String> enabledProtocolsList
needClientAuthback to summary
private final boolean needClientAuth

Constructor Detail

SslRMIServerSocketFactoryback to summary
public SslRMIServerSocketFactory()

Creates a new SslRMIServerSocketFactory with the default SSL socket configuration.

SSL connections accepted by server sockets created by this factory have the default cipher suites and protocol versions enabled and do not require client authentication.

SslRMIServerSocketFactoryback to summary
public SslRMIServerSocketFactory(String[] enabledCipherSuites, String[] enabledProtocols, boolean needClientAuth) throws IllegalArgumentException

Creates a new SslRMIServerSocketFactory with the specified SSL socket configuration.

Parameters
enabledCipherSuites:String[]

names of all the cipher suites to enable on SSL connections accepted by server sockets created by this factory, or null to use the cipher suites that are enabled by default

enabledProtocols:String[]

names of all the protocol versions to enable on SSL connections accepted by server sockets created by this factory, or null to use the protocol versions that are enabled by default

needClientAuth:boolean

true to require client authentication on SSL connections accepted by server sockets created by this factory; false to not require client authentication

Exceptions
IllegalArgumentException:
when one or more of the cipher suites named by the enabledCipherSuites parameter is not supported, when one or more of the protocols named by the enabledProtocols parameter is not supported or when a problem is encountered while trying to check if the supplied cipher suites and protocols to be enabled are supported.
See Also
SSLSocket#setEnabledCipherSuites, SSLSocket#setEnabledProtocols, SSLSocket#setNeedClientAuth
SslRMIServerSocketFactoryback to summary
public SslRMIServerSocketFactory(SSLContext context, String[] enabledCipherSuites, String[] enabledProtocols, boolean needClientAuth) throws IllegalArgumentException

Creates a new SslRMIServerSocketFactory with the specified SSLContext and SSL socket configuration.

Parameters
context:SSLContext

the SSL context to be used for creating SSL sockets. If context is null the default SSLSocketFactory or the default SSLServerSocketFactory will be used to create SSL sockets. Otherwise, the socket factory returned by SSLContext.getSocketFactory() or SSLContext.getServerSocketFactory() will be used instead.

enabledCipherSuites:String[]

names of all the cipher suites to enable on SSL connections accepted by server sockets created by this factory, or null to use the cipher suites that are enabled by default

enabledProtocols:String[]

names of all the protocol versions to enable on SSL connections accepted by server sockets created by this factory, or null to use the protocol versions that are enabled by default

needClientAuth:boolean

true to require client authentication on SSL connections accepted by server sockets created by this factory; false to not require client authentication

Exceptions
IllegalArgumentException:
when one or more of the cipher suites named by the enabledCipherSuites parameter is not supported, when one or more of the protocols named by the enabledProtocols parameter is not supported or when a problem is encountered while trying to check if the supplied cipher suites and protocols to be enabled are supported.
Since
1.7
See Also
SSLSocket#setEnabledCipherSuites, SSLSocket#setEnabledProtocols, SSLSocket#setNeedClientAuth

Method Detail

checkParametersback to summary
private boolean checkParameters(SslRMIServerSocketFactory that)
createServerSocketback to summary
public ServerSocket createServerSocket(int port) throws IOException

Implements java.rmi.server.RMIServerSocketFactory.createServerSocket.

Creates a server socket that accepts SSL connections configured according to this factory's SSL socket configuration parameters.

Exceptions
IOException:

Doc from java.rmi.server.RMIServerSocketFactory.createServerSocket.

if an I/O error occurs during server socket creation

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

Two SslRMIServerSocketFactory objects are equal if they have been constructed with the same SSL context and SSL socket configuration parameters.

A subclass should override this method (as well as hashCode()) if it adds instance state that affects equality.

getDefaultSSLSocketFactoryback to summary
private static synchronized SSLSocketFactory getDefaultSSLSocketFactory()
getEnabledCipherSuitesback to summary
public final String[] getEnabledCipherSuites()

Returns the names of the cipher suites enabled on SSL connections accepted by server sockets created by this factory, or null if this factory uses the cipher suites that are enabled by default.

Returns:String[]

an array of cipher suites enabled, or null

See Also
SSLSocket#setEnabledCipherSuites
getEnabledProtocolsback to summary
public final String[] getEnabledProtocols()

Returns the names of the protocol versions enabled on SSL connections accepted by server sockets created by this factory, or null if this factory uses the protocol versions that are enabled by default.

Returns:String[]

an array of protocol versions enabled, or null

See Also
SSLSocket#setEnabledProtocols
getNeedClientAuthback to summary
public final boolean getNeedClientAuth()

Returns true if client authentication is required on SSL connections accepted by server sockets created by this factory.

Returns:boolean

true if client authentication is required

See Also
SSLSocket#setNeedClientAuth
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this SslRMIServerSocketFactory.

Returns:int

a hash code value for this SslRMIServerSocketFactory.