public class SslRMIServerSocketFactory extends Object implements RMIServerSocketFactory
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.
SSLSocketFactory
,
SSLServerSocketFactory
,
SslRMIClientSocketFactory
Constructor and Description |
---|
SslRMIServerSocketFactory()
Creates a new
SslRMIServerSocketFactory with
the default SSL socket configuration. |
SslRMIServerSocketFactory(SSLContext context,
String[] enabledCipherSuites,
String[] enabledProtocols,
boolean needClientAuth)
Creates a new
SslRMIServerSocketFactory with the
specified SSLContext and SSL socket configuration. |
SslRMIServerSocketFactory(String[] enabledCipherSuites,
String[] enabledProtocols,
boolean needClientAuth)
Creates a new
SslRMIServerSocketFactory with
the specified SSL socket configuration. |
Modifier and Type | Method and Description |
---|---|
ServerSocket |
createServerSocket(int port)
Creates a server socket that accepts SSL connections
configured according to this factory's SSL socket configuration
parameters.
|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
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. |
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. |
boolean |
getNeedClientAuth()
Returns
true if client authentication is
required on SSL connections accepted by server sockets created
by this factory. |
int |
hashCode()
Returns a hash code value for this
SslRMIServerSocketFactory . |
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.
public SslRMIServerSocketFactory(String[] enabledCipherSuites, String[] enabledProtocols, boolean needClientAuth) throws IllegalArgumentException
Creates a new SslRMIServerSocketFactory
with
the specified SSL socket configuration.
enabledCipherSuites
- 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 defaultenabledProtocols
- 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 defaultneedClientAuth
- true
to require client
authentication on SSL connections accepted by server sockets
created by this factory; false
to not require
client authenticationIllegalArgumentException
- 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.SSLSocket.setEnabledCipherSuites(java.lang.String[])
,
SSLSocket.setEnabledProtocols(java.lang.String[])
,
SSLSocket.setNeedClientAuth(boolean)
public SslRMIServerSocketFactory(SSLContext context, String[] enabledCipherSuites, String[] enabledProtocols, boolean needClientAuth) throws IllegalArgumentException
Creates a new SslRMIServerSocketFactory
with the
specified SSLContext
and SSL socket configuration.
context
- 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
- 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 defaultenabledProtocols
- 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 defaultneedClientAuth
- true
to require client
authentication on SSL connections accepted by server sockets
created by this factory; false
to not require
client authenticationIllegalArgumentException
- 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.SSLSocket.setEnabledCipherSuites(java.lang.String[])
,
SSLSocket.setEnabledProtocols(java.lang.String[])
,
SSLSocket.setNeedClientAuth(boolean)
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.
null
SSLSocket.setEnabledCipherSuites(java.lang.String[])
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.
null
SSLSocket.setEnabledProtocols(java.lang.String[])
public final boolean getNeedClientAuth()
Returns true
if client authentication is
required on SSL connections accepted by server sockets created
by this factory.
true
if client authentication is requiredSSLSocket.setNeedClientAuth(boolean)
public ServerSocket createServerSocket(int port) throws IOException
Creates a server socket that accepts SSL connections configured according to this factory's SSL socket configuration parameters.
createServerSocket
in interface RMIServerSocketFactory
port
- the port numberIOException
- if an I/O error occurs during server socket
creationpublic boolean equals(Object obj)
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.
equals
in class Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public int hashCode()
Returns a hash code value for this
SslRMIServerSocketFactory
.
hashCode
in class Object
SslRMIServerSocketFactory
.Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.