Package org.forgerock.opendj.security
Class SslOptions
java.lang.Object
org.forgerock.opendj.security.SslOptions
Encapsulates options for configuring SSL based security as well as providing methods for building
SSLEngine
s.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the client authentication policy option. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name of the property which, when true, will disable SSL host name validation.static final KeyManager[]
Use an emptyKeyManager
while initializing anSSLContext
.static final TrustManager[]
Use the JVM trust manager. -
Method Summary
Modifier and TypeMethodDescriptionReturns the client authentication policy.clientAuthPolicy
(SslOptions.ClientAuthPolicy clientAuthPolicy) Sets the client auth policy.static SslOptions
copyOfSslOptions
(SslOptions sslOptions) Creates a copy of the providedSslOptions
.String[]
Returns the names of the cipher suites which are currently enabled for secure connections with the Directory Server.enabledCipherSuites
(String... cipherSuites) Adds the cipher suites enabled for secure connections with the Directory Server.enabledCipherSuites
(Collection<String> cipherSuites) Adds the cipher suites enabled for secure connections with the Directory Server.String[]
Returns the names of the protocol versions which are currently enabled for secure connections with the Directory Server.enabledProtocols
(String... protocols) Adds the protocol versions enabled for secure connections with the Directory Server.enabledProtocols
(Collection<String> protocols) Adds the protocol versions enabled for secure connections with the Directory Server.static boolean
Returns whether server host name validation against the SSL certificate's subject must be performed.Return the key managers which can be used to secure connections ornull
if no certificates are used.static SSLEngine
newClientSslEngine
(SslOptions sslOptions, String host, int port) Creates a newSSLEngine
configured to be used by a client application.static SSLEngine
newServerSslEngine
(SslOptions sslOptions) Creates a newSSLEngine
configured to be used by a server application.static SslOptions
newSslOptions
(KeyManager[] keyManagers, TrustManager[] trustManagers) Creates a newSslOptions
for the provided key managers and trust managers.static SslOptions
newSslOptions
(KeyManager keyManager, TrustManager trustManager) Creates a newSslOptions
for the provided key manager and trust manager.Returns theSSLContext
that should be used when installing the SSL layer.Returns aList
of TLS cipher suites names reported as supported by the running JVM.Returns aList
of TLS protocol names reported as supported by the running JVM.Return the trust managers ornull
.
-
Field Details
-
USE_EMPTY_KEY_MANAGER
Use an emptyKeyManager
while initializing anSSLContext
.This parameter should be used as the first one of
SSLContext.init(KeyManager[], TrustManager[], java.security.SecureRandom)
. An emptyKeyManager
implementation never returns any certificates/keys. -
USE_JVM_TRUST_MANAGER
Use the JVM trust manager. -
SSL_HOST_NAME_VALIDATION_DISABLED_PROPERTY
The name of the property which, when true, will disable SSL host name validation. Host name validation is enabled by default.- See Also:
-
-
Method Details
-
isSslHostNameValidationEnabled
public static boolean isSslHostNameValidationEnabled()Returns whether server host name validation against the SSL certificate's subject must be performed.- Returns:
true
If the host name must be validated,false
otherwise.
-
newClientSslEngine
Creates a newSSLEngine
configured to be used by a client application. Provide a host and port in order to perform host name verification.- Parameters:
sslOptions
- SslOptions to use to configure theSSLEngine
.host
- The non-authoritative name of the peer host.port
- The non-authoritative peer port.- Returns:
- A new
SSLEngine
which has been configured with the settings contained in thisSslOptions
-
newServerSslEngine
Creates a newSSLEngine
configured to be used by a server application.- Parameters:
sslOptions
- SslOptions to use to configure theSSLEngine
.- Returns:
- A new
SSLEngine
which has been configured with the settings contained in thisSslOptions
-
supportedCipherSuites
Returns aList
of TLS cipher suites names reported as supported by the running JVM.- Returns:
- a
List
of TLS cipher suites names reported as supported by the running JVM
-
supportedProtocols
Returns aList
of TLS protocol names reported as supported by the running JVM.- Returns:
- a
List
of TLS protocol names reported as supported by the running JVM
-
newSslOptions
public static SslOptions newSslOptions(KeyManager keyManager, TrustManager trustManager) throws KeyManagementException Creates a newSslOptions
for the provided key manager and trust manager.- Parameters:
keyManager
- The key manager, which may benull
indicating that no certificates will be used.trustManager
- The trust manager, which may benull
. In the latter case, only certificates signed by the authorities associated with the installed security providers of this JVM are accepted.- Returns:
- A new
SslOptions
instance. - Throws:
KeyManagementException
- If the key manager or trust manager could not be used for some reason.
-
newSslOptions
public static SslOptions newSslOptions(KeyManager[] keyManagers, TrustManager[] trustManagers) throws KeyManagementException Creates a newSslOptions
for the provided key managers and trust managers.- Parameters:
keyManagers
- The key managers, which may benull
indicating that no certificates will be used.trustManagers
- The trust manager, which may benull
. In the latter case, only certificates signed by the authorities associated with the installed security providers of this JVM are accepted.- Returns:
- A new
SslOptions
instance. - Throws:
KeyManagementException
- If the key managers or trust managers could not be used for some reason.
-
copyOfSslOptions
Creates a copy of the providedSslOptions
.- Parameters:
sslOptions
- TheSslOptions
- Returns:
- A new
SslOptions
instance.
-
clientAuthPolicy
Returns the client authentication policy. This option is only useful in server mode.- Returns:
- The
SslOptions.ClientAuthPolicy
option.
-
enabledProtocols
Returns the names of the protocol versions which are currently enabled for secure connections with the Directory Server.- Returns:
- an array of protocols or
null
if the default protocols are to be used.
-
enabledCipherSuites
Returns the names of the cipher suites which are currently enabled for secure connections with the Directory Server.- Returns:
- an array of cipher-suite or
null
if the default cipher-suites are to be used.
-
keyManagers
Return the key managers which can be used to secure connections ornull
if no certificates are used.- Returns:
- The key managers or
null
if there are none.
-
trustManagers
Return the trust managers ornull
. In the latter case, only certificates signed by the authorities associated with the installed security providers of this JVM are accepted.- Returns:
- The trust managers or
null
if there are none.
-
sslContext
Returns theSSLContext
that should be used when installing the SSL layer.- Returns:
- The
SSLContext
that should be used when installing the SSL layer.
-
clientAuthPolicy
Sets the client auth policy. This option is only useful in server mode.- Parameters:
clientAuthPolicy
- The client auth policy.- Returns:
- this
SslOptions
. - See Also:
-
enabledCipherSuites
Adds the cipher suites enabled for secure connections with the Directory Server. The suites must be supported by the SSLContext specified during construction. Following a successful call to this method, only the suites listed in the protocols parameter are enabled for use.- Parameters:
cipherSuites
- Names of all the cipher-suites to enable ornull
to use the default ones.- Returns:
- This SslOptions.
-
enabledCipherSuites
Adds the cipher suites enabled for secure connections with the Directory Server. The suites must be supported by the SSLContext specified during construction. Following a successful call to this method, only the suites listed in the protocols parameter are enabled for use.- Parameters:
cipherSuites
- Names of all the cipher-suites to enable ornull
to use the default ones.- Returns:
- This SslOptions.
-
enabledProtocols
Adds the protocol versions enabled for secure connections with the Directory Server. The protocols must be supported by the SSLContext specified during construction.- Parameters:
protocols
- Names of all the protocols to enable ornull
to use the default ones.- Returns:
- This SslOptions.
-
enabledProtocols
Adds the protocol versions enabled for secure connections with the Directory Server. The protocols must be supported by the SSLContext specified during construction.- Parameters:
protocols
- Names of all the protocols to enable ornull
to use the default ones.- Returns:
- This SslOptions.
-