public class SSLContextConfigurator extends Object
SSLContext
.Modifier and Type | Field and Description |
---|---|
static SSLContextConfigurator |
DEFAULT_CONFIG
Default SSL configuration.
|
static String |
KEY_FACTORY_MANAGER_ALGORITHM |
static String |
KEY_STORE_FILE |
static String |
KEY_STORE_PASSWORD |
static String |
KEY_STORE_PROVIDER |
static String |
KEY_STORE_TYPE |
static String |
TRUST_FACTORY_MANAGER_ALGORITHM |
static String |
TRUST_STORE_FILE |
static String |
TRUST_STORE_PASSWORD |
static String |
TRUST_STORE_PROVIDER |
static String |
TRUST_STORE_TYPE |
Constructor and Description |
---|
SSLContextConfigurator()
Default constructor.
|
SSLContextConfigurator(boolean readSystemProperties)
Constructor that allows you creating empty configuration.
|
Modifier and Type | Method and Description |
---|---|
SSLContext |
createSSLContext() |
void |
retrieve(Properties props) |
void |
setKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm)
Sets the key manager factory algorithm.
|
void |
setKeyPass(char[] keyPass)
Password of the key in the key store.
|
void |
setKeyPass(String keyPass)
Password of the key in the key store.
|
void |
setKeyStoreBytes(byte[] keyStoreBytes)
Sets key store payload as byte array.
|
void |
setKeyStoreFile(String keyStoreFile)
Sets key store file name, also makes sure that if other key store
configuration parameters are not set to set them to default values.
|
void |
setKeyStorePass(char[] keyStorePass)
Password of key store.
|
void |
setKeyStorePass(String keyStorePass)
Password of key store.
|
void |
setKeyStoreProvider(String keyStoreProvider)
Sets the key store provider name.
|
void |
setKeyStoreType(String keyStoreType)
Type of key store.
|
void |
setSecurityProtocol(String securityProtocol)
Sets the SSLContext protocol.
|
void |
setTrustManagerFactoryAlgorithm(String trustManagerFactoryAlgorithm)
Sets the trust manager factory algorithm.
|
void |
setTrustStoreBytes(byte[] trustStoreBytes)
Sets trust store payload as byte array.
|
void |
setTrustStoreFile(String trustStoreFile)
Sets trust store file name, also makes sure that if other trust store
configuration parameters are not set to set them to default values.
|
void |
setTrustStorePass(String trustStorePass)
Password of trust store.
|
void |
setTrustStoreProvider(String trustStoreProvider)
Sets the trust store provider name.
|
void |
setTrustStoreType(String trustStoreType)
Type of trust store.
|
boolean |
validateConfiguration()
Validates
SSLContextConfigurator configuration. |
boolean |
validateConfiguration(boolean needsKeyStore)
Validates
SSLContextConfigurator configuration. |
public static final String TRUST_STORE_PROVIDER
public static final String KEY_STORE_PROVIDER
public static final String TRUST_STORE_FILE
public static final String KEY_STORE_FILE
public static final String TRUST_STORE_PASSWORD
public static final String KEY_STORE_PASSWORD
public static final String TRUST_STORE_TYPE
public static final String KEY_STORE_TYPE
public static final String KEY_FACTORY_MANAGER_ALGORITHM
public static final String TRUST_FACTORY_MANAGER_ALGORITHM
public static final SSLContextConfigurator DEFAULT_CONFIG
System.getProperties()
of javax.net.ssl family you should refresh
this configuration by calling retrieve(java.util.Properties)
.public SSLContextConfigurator()
System.getProperties()
. Calls SSLContextConfigurator(boolean)
with
true
.public SSLContextConfigurator(boolean readSystemProperties)
readSystemProperties
- If true
populates configuration from
System.getProperties()
, else you have empty
configuration.public void setTrustStoreProvider(String trustStoreProvider)
trustStoreProvider
- Trust store provider to set.public void setKeyStoreProvider(String keyStoreProvider)
keyStoreProvider
- Key store provider to set.public void setTrustStoreType(String trustStoreType)
trustStoreType
- Type of trust store to set.public void setKeyStoreType(String keyStoreType)
keyStoreType
- Type of key store to set.public void setTrustStorePass(String trustStorePass)
trustStorePass
- Password of trust store to set.public void setKeyStorePass(String keyStorePass)
keyStorePass
- Password of key store to set.public void setKeyStorePass(char[] keyStorePass)
keyStorePass
- Password of key store to set.public void setKeyPass(String keyPass)
keyPass
- Password of key to set.public void setKeyPass(char[] keyPass)
keyPass
- Password of key to set.public void setTrustStoreFile(String trustStoreFile)
setTrustStoreBytes(byte[])
.trustStoreFile
- File name of trust store.public void setTrustStoreBytes(byte[] trustStoreBytes)
setTrustStoreFile(java.lang.String)
.trustStoreBytes
- trust store payload.public void setKeyStoreFile(String keyStoreFile)
setKeyStoreBytes(byte[])
.keyStoreFile
- File name of key store.public void setKeyStoreBytes(byte[] keyStoreBytes)
setKeyStoreFile(java.lang.String)
.keyStoreBytes
- key store payload.public void setTrustManagerFactoryAlgorithm(String trustManagerFactoryAlgorithm)
trustManagerFactoryAlgorithm
- the trust manager factory algorithm.public void setKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm)
keyManagerFactoryAlgorithm
- the key manager factory algorithm.public void setSecurityProtocol(String securityProtocol)
TLS
if
this is null.securityProtocol
- Protocol for SSLContext.getProtocol()
.public boolean validateConfiguration()
SSLContextConfigurator
configuration.true
if configuration is valid, else
false
.public boolean validateConfiguration(boolean needsKeyStore)
SSLContextConfigurator
configuration.needsKeyStore
- forces failure if no keystore is specified.true
if configuration is valid, else
false
.public SSLContext createSSLContext()
public void retrieve(Properties props)
Copyright © 2014 Oracle Corporation. All rights reserved.