java.lang.Object
org.glassfish.grizzly.ssl.SSLContextConfigurator
Utility class, which helps to configure
SSLContext.- Author:
- Alexey Stashok, Hubert Iwaniuk, Bruno Harbulot
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SSLContextConfigurator(boolean readSystemProperties) Constructor that allows you creating empty configuration. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.createSSLContext(boolean throwException) Create a newSSLContext.voidretrieve(Properties props) voidsetKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm) Sets the key manager factory algorithm.voidsetKeyPass(char[] keyPass) Password of the key in the key store.voidsetKeyPass(String keyPass) Password of the key in the key store.voidsetKeyStoreBytes(byte[] keyStoreBytes) Sets key store payload as byte array.voidsetKeyStoreFile(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.voidsetKeyStorePass(char[] keyStorePass) Password of key store.voidsetKeyStorePass(String keyStorePass) Password of key store.voidsetKeyStoreProvider(String keyStoreProvider) Sets the key store provider name.voidsetKeyStoreType(String keyStoreType) Type of key store.voidsetSecurityProtocol(String securityProtocol) Sets the SSLContext protocol.voidsetTrustManagerFactoryAlgorithm(String trustManagerFactoryAlgorithm) Sets the trust manager factory algorithm.voidsetTrustStoreBytes(byte[] trustStoreBytes) Sets trust store payload as byte array.voidsetTrustStoreFile(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.voidsetTrustStorePass(String trustStorePass) Password of trust store.voidsetTrustStoreProvider(String trustStoreProvider) Sets the trust store provider name.voidsetTrustStoreType(String trustStoreType) Type of trust store.booleanDeprecated.booleanvalidateConfiguration(boolean needsKeyStore) Deprecated.
-
Field Details
-
TRUST_STORE_PROVIDER
- See Also:
-
KEY_STORE_PROVIDER
- See Also:
-
TRUST_STORE_FILE
- See Also:
-
KEY_STORE_FILE
- See Also:
-
TRUST_STORE_PASSWORD
- See Also:
-
KEY_STORE_PASSWORD
- See Also:
-
TRUST_STORE_TYPE
- See Also:
-
KEY_STORE_TYPE
- See Also:
-
KEY_FACTORY_MANAGER_ALGORITHM
- See Also:
-
TRUST_FACTORY_MANAGER_ALGORITHM
- See Also:
-
DEFAULT_CONFIG
Default SSL configuration. If you have changed any ofSystem.getProperties()of javax.net.ssl family you should refresh this configuration by callingretrieve(java.util.Properties).
-
-
Constructor Details
-
SSLContextConfigurator
public SSLContextConfigurator()Default constructor. Reads configuration properties fromSystem.getProperties(). CallsSSLContextConfigurator(boolean)withtrue. -
SSLContextConfigurator
public SSLContextConfigurator(boolean readSystemProperties) Constructor that allows you creating empty configuration.- Parameters:
readSystemProperties- Iftruepopulates configuration fromSystem.getProperties(), else you have empty configuration.
-
-
Method Details
-
setTrustStoreProvider
Sets the trust store provider name.- Parameters:
trustStoreProvider- Trust store provider to set.
-
setKeyStoreProvider
Sets the key store provider name.- Parameters:
keyStoreProvider- Key store provider to set.
-
setTrustStoreType
Type of trust store.- Parameters:
trustStoreType- Type of trust store to set.
-
setKeyStoreType
Type of key store.- Parameters:
keyStoreType- Type of key store to set.
-
setTrustStorePass
Password of trust store.- Parameters:
trustStorePass- Password of trust store to set.
-
setKeyStorePass
Password of key store.- Parameters:
keyStorePass- Password of key store to set.
-
setKeyStorePass
public void setKeyStorePass(char[] keyStorePass) Password of key store.- Parameters:
keyStorePass- Password of key store to set.
-
setKeyPass
Password of the key in the key store.- Parameters:
keyPass- Password of key to set.
-
setKeyPass
public void setKeyPass(char[] keyPass) Password of the key in the key store.- Parameters:
keyPass- Password of key to set.
-
setTrustStoreFile
Sets trust store file name, also makes sure that if other trust store configuration parameters are not set to set them to default values. Method resets trust store bytes if any have been set before viasetTrustStoreBytes(byte[]).- Parameters:
trustStoreFile- File name of trust store.
-
setTrustStoreBytes
public void setTrustStoreBytes(byte[] trustStoreBytes) Sets trust store payload as byte array. Method resets trust store file if any has been set before viasetTrustStoreFile(java.lang.String).- Parameters:
trustStoreBytes- trust store payload.
-
setKeyStoreFile
Sets key store file name, also makes sure that if other key store configuration parameters are not set to set them to default values. Method resets key store bytes if any have been set before viasetKeyStoreBytes(byte[]).- Parameters:
keyStoreFile- File name of key store.
-
setKeyStoreBytes
public void setKeyStoreBytes(byte[] keyStoreBytes) Sets key store payload as byte array. Method resets key store file if any has been set before viasetKeyStoreFile(java.lang.String).- Parameters:
keyStoreBytes- key store payload.
-
setTrustManagerFactoryAlgorithm
Sets the trust manager factory algorithm.- Parameters:
trustManagerFactoryAlgorithm- the trust manager factory algorithm.
-
setKeyManagerFactoryAlgorithm
Sets the key manager factory algorithm.- Parameters:
keyManagerFactoryAlgorithm- the key manager factory algorithm.
-
setSecurityProtocol
Sets the SSLContext protocol. The default value isTLSif this is null.- Parameters:
securityProtocol- Protocol forSSLContext.getProtocol().
-
validateConfiguration
Deprecated.ValidatesSSLContextConfiguratorconfiguration.- Returns:
trueif configuration is valid, elsefalse.
-
validateConfiguration
Deprecated.ValidatesSSLContextConfiguratorconfiguration.- Parameters:
needsKeyStore- forces failure if no keystore is specified.- Returns:
trueif configuration is valid, elsefalse.
-
createSSLContext
Deprecated.Create a newSSLContext. Note that if there are any problems with the key or trust stores, that no exception will be thrown.- Returns:
- a new
SSLContext
-
createSSLContext
Create a newSSLContext. If theSSLContextcannot be created for whatever reason, aSSLContextConfigurator.GenericStoreExceptionwill be raised containing the root cause of the failure.- Parameters:
throwException-trueif an exception should be raised upon failure.- Returns:
- a new
SSLContext - Throws:
SSLContextConfigurator.GenericStoreException-throwExceptionistrueand the SSLContext cannot be created- Since:
- 2.3.28
-
retrieve
-
createSSLContext(boolean).