|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.ext.ssl.SslContextFactory
org.restlet.ext.ssl.DefaultSslContextFactory
public class DefaultSslContextFactory
This SslContextFactory makes it possible to configure most basic
options when building an SSLContext. See the init(Series) method for
the list of parameters supported by this factory when configuring your HTTP
client or server connector. Here is the list of SSL related parameters that
are also supported:
| Parameter name | Value type | Default value | Description |
|---|---|---|---|
| certAlgorithm | String | SunX509 | SSL certificate algorithm. |
| keystorePath | String | ${user.home}/.keystore | SSL keystore path. |
| keystorePassword | String | System property "javax.net.ssl.keyStorePassword" | SSL keystore password. |
| keystoreType | String | JKS | SSL keystore type |
| keyPassword | String | System property "javax.net.ssl.keyStorePassword" | SSL key password. |
| needClientAuthentication | boolean | false | Indicates if we require client certificate authentication |
| secureRandomAlgorithm | String | null (see java.security.SecureRandom) | Name of the RNG algorithm. (see java.security.SecureRandom class). |
| securityProvider | String | null (see javax.net.ssl.SSLContext) | Java security provider name (see java.security.Provider class). |
| sslProtocol | String | TLS | SSL protocol. |
| truststorePath | String | null | Path to trust store |
| truststorePassword | String | System property "javax.net.ssl.trustStorePassword" | Trust store password |
| truststoreType | String | System property "javax.net.ssl.trustStoreType" | Trust store type |
| wantClientAuthentication | boolean | false | Indicates if we would like client certificate authentication |
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,
JSSE Reference - Standard names| Constructor Summary | |
|---|---|
DefaultSslContextFactory()
|
|
| Method Summary | |
|---|---|
protected DefaultSslContextFactory |
clone()
This class is likely to contain sensitive information; cloning is therefore not allowed. |
SSLContext |
createSslContext()
Creates a configured and initialized SSLContext from the values set via the various setters of this class. |
String |
getCertAlgorithm()
Returns the name of the KeyManager algorithm. |
String[] |
getDisabledCipherSuites()
Returns the whitespace-separated list of disabled cipher suites. |
String[] |
getEnabledCipherSuites()
Returns the whitespace-separated list of enabled cipher suites. |
char[] |
getKeyStoreKeyPassword()
Returns the password for the key in the keystore (as a String). |
char[] |
getKeyStorePassword()
Returns the password for the keystore (as a String). |
String |
getKeyStorePath()
Returns the path to the KeyStore file. |
String |
getKeyStoreProvider()
Returns the name of the keystore provider. |
String |
getKeyStoreType()
Returns the keyStore type of the keystore. |
String |
getSecureRandomAlgorithm()
Returns the name of the SecureRandom algorithm. |
String |
getSslProtocol()
Returns the secure socket protocol name, "TLS" by default. |
String |
getTrustManagerAlgorithm()
Returns the name of the TrustManager algorithm. |
char[] |
getTrustStorePassword()
Returns the password for the trust store keystore. |
String |
getTrustStorePath()
Returns the path to the trust store (keystore) file. |
String |
getTrustStoreProvider()
Returns the name of the trust store (keystore) provider. |
String |
getTrustStoreType()
Returns the KeyStore type of the trust store. |
void |
init(Series<Parameter> helperParameters)
Sets the following options according to parameters that may have been set up directly in the HttpsClientHelper or HttpsServerHelper parameters. |
boolean |
isNeedClientAuthentication()
Indicates if we require client certificate authentication. |
boolean |
isWantClientAuthentication()
Indicates if we would like client certificate authentication. |
void |
setCertAlgorithm(String keyManagerAlgorithm)
Sets the KeyManager algorithm. |
void |
setDisabledCipherSuites(String[] disabledCipherSuites)
Sets the whitespace-separated list of disabled cipher suites. |
void |
setEnabledCipherSuites(String[] enabledCipherSuites)
Sets the whitespace-separated list of enabled cipher suites. |
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 |
setNeedClientAuthentication(boolean needClientAuthentication)
Indicates if we require client certificate authentication. |
void |
setSecureRandomAlgorithm(String secureRandomAlgorithm)
Sets the SecureRandom algorithm. |
void |
setSslProtocol(String sslProtocol)
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. |
void |
setWantClientAuthentication(boolean wantClientAuthentication)
Indicates if we would like client certificate authentication. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultSslContextFactory()
| Method Detail |
|---|
protected final DefaultSslContextFactory clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException
public SSLContext createSslContext()
throws Exception
keyStorePath,
keyStoreProvider, keyStoreType are all
null, the SSLContext will be initialized with a
null array of KeyManagers. Similarly, if
trustStorePath, trustStoreProvider,
trustStoreType are all null, a
null array of TrustManagers will be used.
- Specified by:
createSslContext in class SslContextFactory
- Returns:
- A configured and initialized SSLContext.
- Throws:
Exception- See Also:
SSLContext.init(javax.net.ssl.KeyManager[],
javax.net.ssl.TrustManager[], SecureRandom)
public String getCertAlgorithm()
public String[] getDisabledCipherSuites()
public String[] getEnabledCipherSuites()
public char[] getKeyStoreKeyPassword()
public char[] getKeyStorePassword()
public String getKeyStorePath()
public String getKeyStoreProvider()
public String getKeyStoreType()
public String getSecureRandomAlgorithm()
public String getSslProtocol()
public String getTrustManagerAlgorithm()
public char[] getTrustStorePassword()
public String getTrustStorePath()
public String getTrustStoreProvider()
public String getTrustStoreType()
public void init(Series<Parameter> helperParameters)
| Parameter name | Value type | Default value | Description |
|---|---|---|---|
| enabledCipherSuites | String | null | Whitespace-separated list of enabled cipher suites and/or can be specified multiple times |
| disabledCipherSuites | String | null | Whitespace-separated list of disabled cipher suites and/or can be specified multiple times. It affects the cipher suites manually enabled or the default ones. |
| keyStorePath | String | ${user.home}/.keystore | SSL keystore path. |
| keyStorePassword | String | SSL keystore password. | |
| keyStoreType | String | JKS | SSL keystore type |
| keyPassword | String | SSL key password. | |
| certAlgorithm | String | SunX509 | SSL certificate algorithm. |
| needClientAuthentication | boolean | false | Indicates if we require client certificate authentication |
| secureRandomAlgorithm | String | null (see java.security.SecureRandom) | Name of the RNG algorithm. (see java.security.SecureRandom class) |
| sslProtocol | String | TLS | SSL protocol. |
| truststorePath | String | null | Path to trust store |
| truststorePassword | String | System property "javax.net.ssl.trustStorePassword" | Trust store password |
| truststoreType | String | System property "javax.net.ssl.trustStoreType" | Trust store type |
| wantClientAuthentication | boolean | false | Indicates if we would like client certificate authentication |
init in class SslContextFactoryhelperParameters - Typically, the parameters that would have been obtained from
HttpsServerHelper.getParameters()public boolean isNeedClientAuthentication()
public boolean isWantClientAuthentication()
public void setCertAlgorithm(String keyManagerAlgorithm)
keyManagerAlgorithm - The KeyManager algorithm.public void setDisabledCipherSuites(String[] disabledCipherSuites)
disabledCipherSuites - The whitespace-separated list of disabled cipher suites.public void setEnabledCipherSuites(String[] enabledCipherSuites)
enabledCipherSuites - The whitespace-separated list of enabled cipher suites.public void setKeyStoreKeyPassword(char[] keyStoreKeyPassword)
keyStoreKeyPassword - The password of the key in the keystore.public void setKeyStoreKeyPassword(String keyStoreKeyPassword)
keyStoreKeyPassword - The password of the key in the keystore.public void setKeyStorePassword(char[] keyStorePassword)
keyStorePassword - Sets the keystore password.public void setKeyStorePassword(String keyStorePassword)
keyStorePassword - Sets the keystore password.public void setKeyStorePath(String keyStorePath)
keyStorePath - The path to the keystore file.public void setKeyStoreProvider(String keyStoreProvider)
keyStoreProvider - The name of the keystore provider.public void setKeyStoreType(String keyStoreType)
keyStoreType - The KeyStore type of the keystore.public void setNeedClientAuthentication(boolean needClientAuthentication)
needClientAuthentication - True if we require client certificate authentication.public void setSecureRandomAlgorithm(String secureRandomAlgorithm)
secureRandomAlgorithm - The SecureRandom algorithm.public void setSslProtocol(String sslProtocol)
sslProtocol - Name of the secure socket protocol to use.public void setTrustManagerAlgorithm(String trustManagerAlgorithm)
trustManagerAlgorithm - The TrustManager algorithm.public void setTrustStorePassword(char[] trustStorePassword)
trustStorePassword - The password of the trust store KeyStore.public void setTrustStorePassword(String trustStorePassword)
trustStorePassword - The password of the trust store KeyStore.public void setTrustStorePath(String trustStorePath)
trustStorePath - The trustStorePath to setpublic void setTrustStoreProvider(String trustStoreProvider)
trustStoreProvider - The name of the trust store provider.public void setTrustStoreType(String trustStoreType)
trustStoreType - The KeyStore type of the trust store.public void setWantClientAuthentication(boolean wantClientAuthentication)
wantClientAuthentication - True if we would like client certificate authentication.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||