public class SSLUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SSLUtils.SSLContext
Wrapper around javax.net.ssl.SSLContext, adding SSL handshake and close notify timeouts
which cannot be set on the SSL context directly.
|
Constructor and Description |
---|
SSLUtils() |
Modifier and Type | Method and Description |
---|---|
static SSLEngineFactory |
createClientSSLEngineFactory(Configuration config)
Creates a
SSLEngineFactory to be used by the Client. |
static SSLEngineFactory |
createServerSSLEngineFactory(Configuration config)
Creates a
SSLEngineFactory to be used by the Server. |
static SSLUtils.SSLContext |
createSSLClientContext(Configuration sslConfig)
Creates the SSL Context for the client if SSL is configured.
|
static SSLUtils.SSLContext |
createSSLServerContext(Configuration sslConfig)
Creates the SSL Context for the server if SSL is configured.
|
static boolean |
getSSLEnabled(Configuration sslConfig)
Retrieves the global ssl flag from configuration.
|
static void |
setSSLVerAndCipherSuites(ServerSocket socket,
Configuration config)
Sets SSl version and cipher suites for SSLServerSocket.
|
static void |
setSSLVerAndCipherSuites(SSLEngine engine,
Configuration config)
|
static void |
setSSLVerifyHostname(Configuration sslConfig,
SSLParameters sslParams)
Sets SSL options to verify peer's hostname in the certificate.
|
public static boolean getSSLEnabled(Configuration sslConfig)
sslConfig
- The application configurationpublic static void setSSLVerAndCipherSuites(ServerSocket socket, Configuration config)
socket
- Socket to be handledconfig
- The application configurationpublic static SSLEngineFactory createServerSSLEngineFactory(Configuration config) throws Exception
SSLEngineFactory
to be used by the Server.config
- The application configuration.Exception
public static SSLEngineFactory createClientSSLEngineFactory(Configuration config) throws Exception
SSLEngineFactory
to be used by the Client.config
- The application configuration.Exception
@Deprecated public static void setSSLVerAndCipherSuites(SSLEngine engine, Configuration config)
createClientSSLEngineFactory(Configuration)
or
createServerSSLEngineFactory(Configuration)
.engine
- SSLEngine to be handledconfig
- The application configurationpublic static void setSSLVerifyHostname(Configuration sslConfig, SSLParameters sslParams)
sslConfig
- The application configurationsslParams
- The SSL parameters that need to be updated@Nullable public static SSLUtils.SSLContext createSSLClientContext(Configuration sslConfig) throws Exception
sslConfig
- The application configurationException
- Thrown if there is any misconfiguration@Nullable public static SSLUtils.SSLContext createSSLServerContext(Configuration sslConfig) throws Exception
sslConfig
- The application configurationException
- Thrown if there is any misconfigurationCopyright © 2014–2019 The Apache Software Foundation. All rights reserved.