Package org.forgerock.opendj.security
Class SslOptions
- java.lang.Object
-
- org.forgerock.opendj.security.SslOptions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSslOptions.ClientAuthPolicyRepresents the client authentication policy option.
-
Field Summary
Fields Modifier and Type Field Description static StringSSL_HOST_NAME_VALIDATION_DISABLED_PROPERTYThe name of the property which, when true, will disable SSL host name validation.static KeyManager[]USE_EMPTY_KEY_MANAGERUse an emptyKeyManagerwhile initializing anSSLContext.static TrustManager[]USE_JVM_TRUST_MANAGERUse the JVM trust manager.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SslOptions.ClientAuthPolicyclientAuthPolicy()Returns the client authentication policy.SslOptionsclientAuthPolicy(SslOptions.ClientAuthPolicy clientAuthPolicy)Sets the client auth policy.static SslOptionscopyOfSslOptions(SslOptions sslOptions)Creates a copy of the providedSslOptions.String[]enabledCipherSuites()Returns the names of the cipher suites which are currently enabled for secure connections with the Directory Server.SslOptionsenabledCipherSuites(String... cipherSuites)Adds the cipher suites enabled for secure connections with the Directory Server.SslOptionsenabledCipherSuites(Collection<String> cipherSuites)Adds the cipher suites enabled for secure connections with the Directory Server.String[]enabledProtocols()Returns the names of the protocol versions which are currently enabled for secure connections with the Directory Server.SslOptionsenabledProtocols(String... protocols)Adds the protocol versions enabled for secure connections with the Directory Server.SslOptionsenabledProtocols(Collection<String> protocols)Adds the protocol versions enabled for secure connections with the Directory Server.static booleanisSslHostNameValidationEnabled()Returns whether server host name validation against the SSL certificate's subject must be performed.KeyManager[]keyManagers()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.SSLContextsslContext()Returns theSSLContextthat should be used when installing the SSL layer.static List<String>supportedCipherSuites()Returns aListof TLS cipher suites names reported as supported by the running JVM.static List<String>supportedProtocols()Returns aListof TLS protocol names reported as supported by the running JVM.TrustManager[]trustManagers()Return the trust managers ornull.
-
-
-
Field Detail
-
USE_EMPTY_KEY_MANAGER
public static final KeyManager[] 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
public static final TrustManager[] USE_JVM_TRUST_MANAGER
Use the JVM trust manager.
-
SSL_HOST_NAME_VALIDATION_DISABLED_PROPERTY
public static final String 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:
- Constant Field Values
-
-
Method Detail
-
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
public static SSLEngine newClientSslEngine(SslOptions sslOptions, String host, int port)
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
public static SSLEngine newServerSslEngine(SslOptions sslOptions)
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
public static List<String> 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
public static List<String> 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
public static SslOptions copyOfSslOptions(SslOptions sslOptions)
Creates a copy of the providedSslOptions.- Parameters:
sslOptions- TheSslOptions- Returns:
- A new
SslOptionsinstance.
-
clientAuthPolicy
public SslOptions.ClientAuthPolicy clientAuthPolicy()
Returns the client authentication policy. This option is only useful in server mode.- Returns:
- The
SslOptions.ClientAuthPolicyoption.
-
enabledProtocols
public String[] 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
public String[] 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
public KeyManager[] 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
public TrustManager[] 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
public SSLContext sslContext()
Returns theSSLContextthat should be used when installing the SSL layer.- Returns:
- The
SSLContextthat should be used when installing the SSL layer.
-
clientAuthPolicy
public SslOptions clientAuthPolicy(SslOptions.ClientAuthPolicy 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:
SslOptions.ClientAuthPolicy
-
enabledCipherSuites
public SslOptions enabledCipherSuites(Collection<String> cipherSuites)
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
public SslOptions enabledCipherSuites(String... cipherSuites)
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
public SslOptions enabledProtocols(Collection<String> protocols)
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
public SslOptions enabledProtocols(String... protocols)
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.
-
-