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
SSLEngines.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the client authentication policy option. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the property which, when true, will disable SSL host name validation.static final KeyManager[]Use an emptyKeyManagerwhile 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 SslOptionscopyOfSslOptions(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 booleanReturns 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 ornullif no certificates are used.static SSLEnginenewClientSslEngine(SslOptions sslOptions, String host, int port) Creates a newSSLEngineconfigured to be used by a client application.static SSLEnginenewServerSslEngine(SslOptions sslOptions) Creates a newSSLEngineconfigured to be used by a server application.static SslOptionsnewSslOptions(KeyManager[] keyManagers, TrustManager[] trustManagers) Creates a newSslOptionsfor the provided key managers and trust managers.static SslOptionsnewSslOptions(KeyManager keyManager, TrustManager trustManager) Creates a newSslOptionsfor the provided key manager and trust manager.Returns theSSLContextthat should be used when installing the SSL layer.Returns aListof TLS cipher suites names reported as supported by the running JVM.Returns aListof TLS protocol names reported as supported by the running JVM.Return the trust managers ornull.
-
Field Details
-
USE_EMPTY_KEY_MANAGER
Use an emptyKeyManagerwhile initializing anSSLContext.This parameter should be used as the first one of
SSLContext.init(KeyManager[], TrustManager[], java.security.SecureRandom). An emptyKeyManagerimplementation 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:
trueIf the host name must be validated,falseotherwise.
-
newClientSslEngine
Creates a newSSLEngineconfigured 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
SSLEnginewhich has been configured with the settings contained in thisSslOptions
-
newServerSslEngine
Creates a newSSLEngineconfigured to be used by a server application.- Parameters:
sslOptions- SslOptions to use to configure theSSLEngine.- Returns:
- A new
SSLEnginewhich has been configured with the settings contained in thisSslOptions
-
supportedCipherSuites
Returns aListof TLS cipher suites names reported as supported by the running JVM.- Returns:
- a
Listof TLS cipher suites names reported as supported by the running JVM
-
supportedProtocols
Returns aListof TLS protocol names reported as supported by the running JVM.- Returns:
- a
Listof TLS protocol names reported as supported by the running JVM
-
newSslOptions
public static SslOptions newSslOptions(KeyManager keyManager, TrustManager trustManager) throws KeyManagementException Creates a newSslOptionsfor the provided key manager and trust manager.- Parameters:
keyManager- The key manager, which may benullindicating 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
SslOptionsinstance. - 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 newSslOptionsfor the provided key managers and trust managers.- Parameters:
keyManagers- The key managers, which may benullindicating 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
SslOptionsinstance. - 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
SslOptionsinstance.
-
clientAuthPolicy
Returns the client authentication policy. This option is only useful in server mode.- Returns:
- The
SslOptions.ClientAuthPolicyoption.
-
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
nullif 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
nullif the default cipher-suites are to be used.
-
keyManagers
Return the key managers which can be used to secure connections ornullif no certificates are used.- Returns:
- The key managers or
nullif 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
nullif there are none.
-
sslContext
Returns theSSLContextthat should be used when installing the SSL layer.- Returns:
- The
SSLContextthat 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 ornullto 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 ornullto 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 ornullto 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 ornullto use the default ones.- Returns:
- This SslOptions.
-