public final class SslConfigurator extends Object
SSLContext
instances.
For example:
SslConfigurator sslConfig = SslConfigurator.newInstance() .trustStoreFile("truststore.jks") .trustStorePassword("asdfgh") .trustStoreType("JKS") .trustManagerFactoryAlgorithm("PKIX") .keyStoreFile("keystore.jks") .keyPassword("asdfgh") .keyStoreType("JKS") .keyManagerFactoryAlgorithm("SunX509") .keyStoreProvider("SunJSSE") .securityProtocol("SSL"); SSLContext sslContext = sslConfig.createSSLContext();
Modifier and Type | Field and Description |
---|---|
static String |
KEY_MANAGER_FACTORY_ALGORITHM
Key manager factory algorithm name.
|
static String |
KEY_MANAGER_FACTORY_PROVIDER
Key manager factory provider name.
|
static String |
KEY_STORE_FILE
Key store file name.
|
static String |
KEY_STORE_PASSWORD
Key store file password - the password used to unlock the trust store file.
|
static String |
KEY_STORE_PROVIDER
Key store provider name.
|
static String |
KEY_STORE_TYPE
Key store type (see
KeyStore.getType() for more info). |
static String |
TRUST_MANAGER_FACTORY_ALGORITHM
Trust manager factory algorithm name.
|
static String |
TRUST_MANAGER_FACTORY_PROVIDER
Trust manager factory provider name.
|
static String |
TRUST_STORE_FILE
Trust store file name.
|
static String |
TRUST_STORE_PASSWORD
Trust store file password - the password used to unlock the trust store file.
|
static String |
TRUST_STORE_PROVIDER
Trust store provider name.
|
static String |
TRUST_STORE_TYPE
Trust store type (see
KeyStore.getType() for more info). |
Modifier and Type | Method and Description |
---|---|
SslConfigurator |
copy()
Create a copy of the current SSL configurator instance.
|
SSLContext |
createSSLContext()
Create new SSL context instance using the current SSL context configuration.
|
boolean |
equals(Object o) |
static SSLContext |
getDefaultContext()
Get a new instance of a
SSLContext configured using default configuration settings. |
static SSLContext |
getDefaultContext(boolean readSystemProperties)
Get a new instance of a
SSLContext configured using default configuration settings. |
int |
hashCode() |
SslConfigurator |
keyManagerFactoryAlgorithm(String algorithm)
Set the key manager factory algorithm.
|
SslConfigurator |
keyManagerFactoryProvider(String provider)
Set the key manager factory provider.
|
SslConfigurator |
keyPassword(char[] password)
Set the password of the key in the key store.
|
SslConfigurator |
keyPassword(String password)
Set the password of the key in the key store.
|
SslConfigurator |
keyStore(KeyStore keyStore)
Set the key store instance.
|
SslConfigurator |
keyStoreBytes(byte[] payload)
Set the key store payload as byte array.
|
SslConfigurator |
keyStoreFile(String fileName)
Set the key store file name.
|
SslConfigurator |
keyStorePassword(char[] password)
Set the password of key store.
|
SslConfigurator |
keyStorePassword(String password)
Set the password of key store.
|
SslConfigurator |
keyStoreProvider(String keyStoreProvider)
Set the key store provider name.
|
SslConfigurator |
keyStoreType(String keyStoreType)
Set the type of key store.
|
static SslConfigurator |
newInstance()
Get a new & initialized SSL configurator instance.
|
static SslConfigurator |
newInstance(boolean readSystemProperties)
Get a new SSL configurator instance.
|
SslConfigurator |
retrieve()
Retrieve the SSL context configuration from the system properties.
|
SslConfigurator |
retrieve(Properties props)
Retrieve the SSL context configuration from the supplied properties.
|
SslConfigurator |
securityProtocol(String protocol)
Set the SSLContext protocol.
|
SslConfigurator |
trustManagerFactoryAlgorithm(String algorithm)
Set the trust manager factory algorithm.
|
SslConfigurator |
trustManagerFactoryProvider(String provider)
Set the trust manager factory provider.
|
SslConfigurator |
trustStore(KeyStore trustStore)
Set the trust store instance.
|
SslConfigurator |
trustStoreBytes(byte[] payload)
Set the trust store payload as byte array.
|
SslConfigurator |
trustStoreFile(String fileName)
Set the trust store file name.
|
SslConfigurator |
trustStorePassword(String password)
Set the password of trust store.
|
SslConfigurator |
trustStoreProvider(String trustStoreProvider)
Set the trust store provider name.
|
SslConfigurator |
trustStoreType(String trustStoreType)
Set the type of trust store.
|
public static final String TRUST_STORE_PROVIDER
String
representing the name of a trust store provider.
No default value is set.
The name of the configuration property is "javax.net.ssl.trustStoreProvider".
public static final String KEY_STORE_PROVIDER
String
representing the name of a trust store provider.
No default value is set.
The name of the configuration property is "javax.net.ssl.keyStoreProvider".
public static final String TRUST_STORE_FILE
String
representing the name of a trust store file.
No default value is set.
The name of the configuration property is "javax.net.ssl.trustStore".
public static final String KEY_STORE_FILE
String
representing the name of a key store file.
No default value is set.
The name of the configuration property is "javax.net.ssl.keyStore".
public static final String TRUST_STORE_PASSWORD
String
representing the trust store file password.
No default value is set.
The name of the configuration property is "javax.net.ssl.trustStorePassword".
public static final String KEY_STORE_PASSWORD
String
representing the key store file password.
No default value is set.
The name of the configuration property is "javax.net.ssl.keyStorePassword".
public static final String TRUST_STORE_TYPE
KeyStore.getType()
for more info).
The value MUST be a String
representing the trust store type name.
No default value is set.
The name of the configuration property is "javax.net.ssl.trustStoreType".
public static final String KEY_STORE_TYPE
KeyStore.getType()
for more info).
The value MUST be a String
representing the key store type name.
No default value is set.
The name of the configuration property is "javax.net.ssl.keyStoreType".
public static final String KEY_MANAGER_FACTORY_ALGORITHM
String
representing the key manager factory algorithm name.
No default value is set.
The name of the configuration property is "ssl.keyManagerFactory.algorithm".
public static final String KEY_MANAGER_FACTORY_PROVIDER
String
representing the key manager factory provider name.
No default value is set.
The name of the configuration property is "ssl.keyManagerFactory.provider".
public static final String TRUST_MANAGER_FACTORY_ALGORITHM
String
representing the trust manager factory algorithm name.
No default value is set.
The name of the configuration property is "ssl.trustManagerFactory.algorithm".
public static final String TRUST_MANAGER_FACTORY_PROVIDER
String
representing the trust manager factory provider name.
No default value is set.
The name of the configuration property is "ssl.trustManagerFactory.provider".
public static SSLContext getDefaultContext()
SSLContext
configured using default configuration settings.
The default SSL configuration is initialized from system properties. This method is a shortcut
for getDefaultContext(true)
.public static SSLContext getDefaultContext(boolean readSystemProperties)
SSLContext
configured using default configuration settings.
If readSystemProperties
parameter is set to true
, the default SSL configuration
is initialized from system properties.readSystemProperties
- if true
, the default SSL context will be initialized using
system properties.public static SslConfigurator newInstance()
public static SslConfigurator newInstance(boolean readSystemProperties)
readSystemProperties
- if true
, Retrieves
the initial configuration from
System.getProperty(String)
}, otherwise the instantiated configurator will
be empty.public SslConfigurator copy()
public SslConfigurator trustStoreProvider(String trustStoreProvider)
trustStoreProvider
- trust store provider to set.public SslConfigurator keyStoreProvider(String keyStoreProvider)
keyStoreProvider
- key store provider to set.public SslConfigurator trustStoreType(String trustStoreType)
trustStoreType
- type of trust store to set.public SslConfigurator keyStoreType(String keyStoreType)
keyStoreType
- type of key store to set.public SslConfigurator trustStorePassword(String password)
password
- password of trust store to set.public SslConfigurator keyStorePassword(String password)
password
- password of key store to set.public SslConfigurator keyStorePassword(char[] password)
password
- password of key store to set.public SslConfigurator keyPassword(String password)
password
- password of key to set.public SslConfigurator keyPassword(char[] password)
password
- password of key to set.public SslConfigurator trustStoreFile(String fileName)
Setting a trust store instance resets any trust store instance
or trust store payload
value previously set.
fileName
- file
name of the trust store.public SslConfigurator trustStoreBytes(byte[] payload)
Setting a trust store instance resets any trust store file
or trust store instance
value previously set.
payload
- trust store payload.public SslConfigurator keyStoreFile(String fileName)
Setting a key store instance resets any key store instance
or key store payload
value previously set.
fileName
- file
name of the key store.public SslConfigurator keyStoreBytes(byte[] payload)
Setting a key store instance resets any key store file
or key store instance
value previously set.
payload
- key store payload.public SslConfigurator trustManagerFactoryAlgorithm(String algorithm)
algorithm
- the trust manager factory algorithm.public SslConfigurator keyManagerFactoryAlgorithm(String algorithm)
algorithm
- the key manager factory algorithm.public SslConfigurator trustManagerFactoryProvider(String provider)
provider
- the trust manager factory provider.public SslConfigurator keyManagerFactoryProvider(String provider)
provider
- the key manager factory provider.public SslConfigurator securityProtocol(String protocol)
TLS
if this is null
.protocol
- protocol for SSLContext.getProtocol()
.public SslConfigurator keyStore(KeyStore keyStore)
Setting a key store instance resets any key store file
or key store payload
value previously set.
keyStore
- key store instance.public SslConfigurator trustStore(KeyStore trustStore)
trustStore
- trust store instance.public SSLContext createSSLContext()
public SslConfigurator retrieve(Properties props)
props
- properties containing the SSL context configuration.public SslConfigurator retrieve()
Copyright © 2007-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.