public class DefaultSslContextFactory extends SslContextFactory
In short, two instances of KeyStore are used when configuring an SSLContext: the keystore (which contains the public and private keys and certificates to be used locally) and the trust store (which generally holds the CA certificates to be trusted when connecting to a remote host). Both keystore and trust store are KeyStores. When not explicitly set using the setters of this class, the values will default to the default system properties, following the behavior described in the JSSE reference guide.
There is more information in the JSSE Reference Guide.
SSLContext
,
KeyStore
Constructor and Description |
---|
DefaultSslContextFactory() |
Modifier and Type | Method and Description |
---|---|
protected DefaultSslContextFactory |
clone()
This class is likely to contain sensitive information; cloning is
therefore not allowed.
|
SSLContext |
createSslContext()
Creates a configured and initialised SSLContext from the values set via
the various setters of this class.
|
String |
getSecureSocketProtocol()
Returns the secure socket protocol name, "TLS" by default.
|
void |
init(Series<Parameter> helperParameters)
Sets the following options according to parameters that may have been set
up directly in the HttpsServerHelper parameters.
|
void |
setKeyManagerAlgorithm(String keyManagerAlgorithm)
Sets the KeyManager algorithm.
|
void |
setKeyStoreKeyPassword(char[] keyStoreKeyPassword)
Sets the password of the key in the keystore.
|
void |
setKeyStoreKeyPassword(String keyStoreKeyPassword)
Sets the password of the key in the keystore.
|
void |
setKeyStorePassword(char[] keyStorePassword)
Sets the keystore password.
|
void |
setKeyStorePassword(String keyStorePassword)
Sets the keystore password.
|
void |
setKeyStorePath(String keyStorePath)
Sets the path to the keystore file.
|
void |
setKeyStoreProvider(String keyStoreProvider)
Sets the name of the keystore provider.
|
void |
setKeyStoreType(String keyStoreType)
Sets the KeyStore type of the keystore.
|
void |
setSecureRandomAlgorithm(String secureRandomAlgorithm)
Sets the SecureRandom algorithm.
|
void |
setSecureSocketProtocol(String secureSocketProtocol)
Sets the secure socket protocol name, "TLS" by default.
|
void |
setTrustManagerAlgorithm(String trustManagerAlgorithm)
Sets the TrustManager algorithm.
|
void |
setTrustStorePassword(char[] trustStorePassword)
Sets the password of the trust store KeyStore.
|
void |
setTrustStorePassword(String trustStorePassword)
Sets the password of the trust store KeyStore.
|
void |
setTrustStorePath(String trustStorePath)
Sets the path to the trust store KeyStore.
|
void |
setTrustStoreProvider(String trustStoreProvider)
Sets the name of the trust store provider.
|
void |
setTrustStoreType(String trustStoreType)
Sets the KeyStore type of the trust store.
|
protected final DefaultSslContextFactory clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public SSLContext createSslContext() throws Exception
keyStorePath
,
keyStoreProvider
, keyStoreType
are all
null
, the SSLContext will be initialised with a
null array of KeyManager
s. Similarly, if
trustStorePath
, trustStoreProvider
,
trustStoreType
are all null
, a
null
array of TrustManager
s will be used.
createSslContext
in class SslContextFactory
Exception
SSLContext.init(javax.net.ssl.KeyManager[],
javax.net.ssl.TrustManager[], SecureRandom)
public String getSecureSocketProtocol()
public void init(Series<Parameter> helperParameters)
Setter of this class | Parameter name | Value type | Default value | Description |
---|---|---|---|---|
setKeyStorePath | keystorePath | String | ${user.home}/.keystore | SSL keystore path. |
setKeyStorePassword | keystorePassword | String | SSL keystore password. | |
setKeyStoreType | keystoreType | String | JKS | SSL keystore type |
setKeyStoreKeyPassword | keyPassword | String | SSL key password. | |
setKeyManagerAlgorithm | certAlgorithm | String | SunX509 | SSL certificate algorithm. |
setSecureSocketProtocol | sslProtocol | String | TLS | SSL protocol. |
init
in class SslContextFactory
helperParameters
- Typically, the parameters that would have been obtained from
HttpsServerHelper.getParameters()public void setKeyManagerAlgorithm(String keyManagerAlgorithm)
keyManagerAlgorithm
- The KeyManager algorithm.public final void setKeyStoreKeyPassword(char[] keyStoreKeyPassword)
keyStoreKeyPassword
- The password of the key in the keystore.public final void setKeyStoreKeyPassword(String keyStoreKeyPassword)
keyStoreKeyPassword
- The password of the key in the keystore.public final void setKeyStorePassword(char[] keyStorePassword)
keyStorePassword
- Sets the keystore password.public final void setKeyStorePassword(String keyStorePassword)
keyStorePassword
- Sets the keystore password.public final void setKeyStorePath(String keyStorePath)
keyStorePath
- The path to the keystore file.public void setKeyStoreProvider(String keyStoreProvider)
keyStoreProvider
- The name of the keystore provider.public final void setKeyStoreType(String keyStoreType)
keyStoreType
- The KeyStore type of the keystore.public void setSecureRandomAlgorithm(String secureRandomAlgorithm)
secureRandomAlgorithm
- The SecureRandom algorithm.public void setSecureSocketProtocol(String secureSocketProtocol)
secureSocketProtocol
- Name of the secure socket protocol to use.public void setTrustManagerAlgorithm(String trustManagerAlgorithm)
trustManagerAlgorithm
- The TrustManager algorithm.public final void setTrustStorePassword(char[] trustStorePassword)
trustStorePassword
- The password of the trust store KeyStore.public final void setTrustStorePassword(String trustStorePassword)
trustStorePassword
- The password of the trust store KeyStore.public final void setTrustStorePath(String trustStorePath)
trustStorePath
- The trustStorePath to setpublic final void setTrustStoreProvider(String trustStoreProvider)
trustStoreProvider
- The name of the trust store provider.public final void setTrustStoreType(String trustStoreType)
trustStoreType
- The KeyStore type of the trust store.Copyright © 2005–2016. All rights reserved.