@ManagedObject public class SslContextFactory extends AbstractLifeCycle implements Dumpable
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
DEFAULT_KEYMANAGERFACTORY_ALGORITHM |
|
static java.lang.String |
DEFAULT_TRUSTMANAGERFACTORY_ALGORITHM |
|
static java.lang.String |
KEYPASSWORD_PROPERTY |
String name of key password property.
|
static java.lang.String |
PASSWORD_PROPERTY |
String name of keystore password property.
|
static javax.net.ssl.TrustManager[] |
TRUST_ALL_CERTS |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
Constructor | Description |
---|---|
SslContextFactory() |
Construct an instance of SslContextFactory
Default constructor for use in XmlConfiguration files
|
SslContextFactory(boolean trustAll) |
Construct an instance of SslContextFactory
Default constructor for use in XmlConfiguration files
|
SslContextFactory(java.lang.String keyStorePath) |
Construct an instance of SslContextFactory
|
Modifier and Type | Method | Description |
---|---|---|
void |
addExcludeCipherSuites(java.lang.String... cipher) |
|
void |
addExcludeProtocols(java.lang.String... protocol) |
|
void |
customize(javax.net.ssl.SSLEngine sslEngine) |
Customize an SslEngine instance with the configuration of this factory,
by calling
customize(SSLParameters) |
javax.net.ssl.SSLParameters |
customize(javax.net.ssl.SSLParameters sslParams) |
Customize an SslParameters instance with the configuration of this factory.
|
static int |
deduceKeyLength(java.lang.String cipherSuite) |
Given the name of a TLS/SSL cipher suite, return an int representing it effective stream
cipher key strength.
|
protected void |
doStart() |
Creates the SSLContext object and starts the lifecycle
|
protected void |
doStop() |
|
java.lang.String |
dump() |
|
void |
dump(java.lang.Appendable out,
java.lang.String indent) |
|
java.util.Set<java.lang.String> |
getAliases() |
|
java.lang.String |
getCertAlias() |
|
static java.security.cert.X509Certificate[] |
getCertChain(javax.net.ssl.SSLSession sslSession) |
|
java.util.Comparator<java.lang.String> |
getCipherComparator() |
|
java.lang.String |
getCrlPath() |
|
java.lang.String |
getEndpointIdentificationAlgorithm() |
|
java.lang.String[] |
getExcludeCipherSuites() |
|
java.lang.String[] |
getExcludeProtocols() |
|
java.lang.String[] |
getIncludeCipherSuites() |
|
java.lang.String[] |
getIncludeProtocols() |
|
java.lang.String |
getKeyManagerFactoryAlgorithm() |
|
protected javax.net.ssl.KeyManager[] |
getKeyManagers(java.security.KeyStore keyStore) |
|
java.security.KeyStore |
getKeyStore() |
|
java.lang.String |
getKeyStorePath() |
|
java.lang.String |
getKeyStoreProvider() |
|
Resource |
getKeyStoreResource() |
|
java.lang.String |
getKeyStoreType() |
|
int |
getMaxCertPathLength() |
|
boolean |
getNeedClientAuth() |
|
java.lang.String |
getOcspResponderURL() |
|
protected Password |
getPassword(java.lang.String realm) |
Returns the password object for the given realm.
|
java.security.cert.PKIXCertPathChecker |
getPkixCertPathChecker() |
|
java.lang.String |
getProtocol() |
|
java.lang.String |
getProvider() |
|
int |
getRenegotiationLimit() |
|
java.lang.String |
getSecureRandomAlgorithm() |
|
java.lang.String[] |
getSelectedCipherSuites() |
|
java.lang.String[] |
getSelectedProtocols() |
|
javax.net.ssl.SSLContext |
getSslContext() |
|
int |
getSslSessionCacheSize() |
Get SSL session cache size.
|
int |
getSslSessionTimeout() |
Get SSL session timeout.
|
java.lang.String |
getTrustManagerFactoryAlgorithm() |
|
protected javax.net.ssl.TrustManager[] |
getTrustManagers(java.security.KeyStore trustStore,
java.util.Collection<? extends java.security.cert.CRL> crls) |
|
java.security.KeyStore |
getTrustStore() |
|
java.lang.String |
getTrustStorePath() |
|
java.lang.String |
getTrustStoreProvider() |
|
Resource |
getTrustStoreResource() |
|
java.lang.String |
getTrustStoreType() |
|
boolean |
getWantClientAuth() |
|
X509 |
getX509(java.lang.String alias) |
|
boolean |
isEnableCRLDP() |
|
boolean |
isEnableOCSP() |
|
boolean |
isRenegotiationAllowed() |
|
boolean |
isSessionCachingEnabled() |
|
boolean |
isTrustAll() |
|
boolean |
isUseCipherSuitesOrder() |
|
boolean |
isValidateCerts() |
|
boolean |
isValidatePeerCerts() |
|
protected java.util.Collection<? extends java.security.cert.CRL> |
loadCRL(java.lang.String crlPath) |
Loads certificate revocation list (CRL) from a file.
|
protected java.security.KeyStore |
loadKeyStore(Resource resource) |
Override this method to provide alternate way to load a keystore.
|
protected java.security.KeyStore |
loadTrustStore(Resource resource) |
Override this method to provide alternate way to load a truststore.
|
Password |
newPassword(java.lang.String password) |
Creates a new Password object.
|
protected java.security.cert.PKIXBuilderParameters |
newPKIXBuilderParameters(java.security.KeyStore trustStore,
java.util.Collection<? extends java.security.cert.CRL> crls) |
|
javax.net.ssl.SSLEngine |
newSSLEngine() |
Factory method for "scratch"
SSLEngine s, usually only used for retrieving configuration
information such as the application buffer size or the list of protocols/ciphers. |
javax.net.ssl.SSLEngine |
newSSLEngine(java.lang.String host,
int port) |
General purpose factory method for creating
SSLEngine s, although creation of
SSLEngine s on the server-side should prefer newSSLEngine(InetSocketAddress) . |
javax.net.ssl.SSLEngine |
newSSLEngine(java.net.InetSocketAddress address) |
Server-side only factory method for creating
SSLEngine s. |
javax.net.ssl.SSLServerSocket |
newSslServerSocket(java.lang.String host,
int port,
int backlog) |
|
javax.net.ssl.SSLSocket |
newSslSocket() |
|
protected void |
processIncludeCipherSuites(java.lang.String[] supportedCipherSuites,
java.util.List<java.lang.String> selected_ciphers) |
|
void |
reload(java.util.function.Consumer<SslContextFactory> consumer) |
|
protected void |
removeExcludedCipherSuites(java.util.List<java.lang.String> selected_ciphers) |
|
protected void |
selectCipherSuites(java.lang.String[] enabledCipherSuites,
java.lang.String[] supportedCipherSuites) |
Select cipher suites to be used by the connector
based on configured inclusion and exclusion lists
as well as enabled and supported cipher suite lists.
|
void |
selectProtocols(java.lang.String[] enabledProtocols,
java.lang.String[] supportedProtocols) |
Select protocols to be used by the connector
based on configured inclusion and exclusion lists
as well as enabled and supported protocols.
|
void |
setCertAlias(java.lang.String certAlias) |
Set the default certificate Alias.
|
void |
setCipherComparator(java.util.Comparator<java.lang.String> cipherComparator) |
|
void |
setCrlPath(java.lang.String crlPath) |
|
void |
setEnableCRLDP(boolean enableCRLDP) |
Enables CRL Distribution Points Support
|
void |
setEnableOCSP(boolean enableOCSP) |
Enables On-Line Certificate Status Protocol support
|
void |
setEndpointIdentificationAlgorithm(java.lang.String endpointIdentificationAlgorithm) |
When set to "HTTPS" hostname verification will be enabled
|
void |
setExcludeCipherSuites(java.lang.String... cipherSuites) |
You can either use the exact cipher suite name or a a regular expression.
|
void |
setExcludeProtocols(java.lang.String... protocols) |
|
void |
setIncludeCipherSuites(java.lang.String... cipherSuites) |
You can either use the exact cipher suite name or a a regular expression.
|
void |
setIncludeProtocols(java.lang.String... protocols) |
|
void |
setKeyManagerFactoryAlgorithm(java.lang.String algorithm) |
|
void |
setKeyManagerPassword(java.lang.String password) |
|
void |
setKeyStore(java.security.KeyStore keyStore) |
Set the key store.
|
void |
setKeyStorePassword(java.lang.String password) |
|
void |
setKeyStorePath(java.lang.String keyStorePath) |
|
void |
setKeyStoreProvider(java.lang.String keyStoreProvider) |
|
void |
setKeyStoreResource(Resource resource) |
Set the key store resource.
|
void |
setKeyStoreType(java.lang.String keyStoreType) |
|
void |
setMaxCertPathLength(int maxCertPathLength) |
|
void |
setNeedClientAuth(boolean needClientAuth) |
|
void |
setOcspResponderURL(java.lang.String ocspResponderURL) |
Set the location of the OCSP Responder.
|
void |
setPkixCertPathChecker(java.security.cert.PKIXCertPathChecker pkixCertPatchChecker) |
|
void |
setProtocol(java.lang.String protocol) |
|
void |
setProvider(java.lang.String provider) |
|
void |
setRenegotiationAllowed(boolean renegotiationAllowed) |
|
void |
setRenegotiationLimit(int renegotiationLimit) |
|
void |
setSecureRandomAlgorithm(java.lang.String algorithm) |
|
void |
setSessionCachingEnabled(boolean enableSessionCaching) |
Set the flag to enable SSL Session caching.
|
void |
setSslContext(javax.net.ssl.SSLContext sslContext) |
|
void |
setSslSessionCacheSize(int sslSessionCacheSize) |
Set SSL session cache size.
|
void |
setSslSessionTimeout(int sslSessionTimeout) |
Set SSL session timeout.
|
void |
setTrustAll(boolean trustAll) |
|
void |
setTrustManagerFactoryAlgorithm(java.lang.String algorithm) |
|
void |
setTrustStore(java.security.KeyStore trustStore) |
Set the trust store.
|
void |
setTrustStorePassword(java.lang.String password) |
|
void |
setTrustStorePath(java.lang.String trustStorePath) |
|
void |
setTrustStoreProvider(java.lang.String trustStoreProvider) |
|
void |
setTrustStoreResource(Resource resource) |
Set the trust store resource.
|
void |
setTrustStoreType(java.lang.String trustStoreType) |
|
void |
setUseCipherSuitesOrder(boolean useCipherSuitesOrder) |
|
void |
setValidateCerts(boolean validateCerts) |
|
void |
setValidatePeerCerts(boolean validatePeerCerts) |
|
void |
setWantClientAuth(boolean wantClientAuth) |
|
java.lang.String |
toString() |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
public static final javax.net.ssl.TrustManager[] TRUST_ALL_CERTS
public static final java.lang.String DEFAULT_KEYMANAGERFACTORY_ALGORITHM
public static final java.lang.String DEFAULT_TRUSTMANAGERFACTORY_ALGORITHM
public static final java.lang.String KEYPASSWORD_PROPERTY
public static final java.lang.String PASSWORD_PROPERTY
public SslContextFactory()
public SslContextFactory(boolean trustAll)
trustAll
- whether to blindly trust all certificatessetTrustAll(boolean)
public SslContextFactory(java.lang.String keyStorePath)
keyStorePath
- default keystore locationprotected void doStart() throws java.lang.Exception
doStart
in class AbstractLifeCycle
java.lang.Exception
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
protected void doStop() throws java.lang.Exception
doStop
in class AbstractLifeCycle
java.lang.Exception
@ManagedAttribute(value="The selected TLS protocol versions", readonly=true) public java.lang.String[] getSelectedProtocols()
@ManagedAttribute(value="The selected cipher suites", readonly=true) public java.lang.String[] getSelectedCipherSuites()
public java.util.Comparator<java.lang.String> getCipherComparator()
public void setCipherComparator(java.util.Comparator<java.lang.String> cipherComparator)
public java.util.Set<java.lang.String> getAliases()
public X509 getX509(java.lang.String alias)
@ManagedAttribute("The excluded TLS protocols") public java.lang.String[] getExcludeProtocols()
SSLEngine.setEnabledProtocols(String[])
public void setExcludeProtocols(java.lang.String... protocols)
protocols
- The array of protocol names to exclude from
SSLEngine.setEnabledProtocols(String[])
public void addExcludeProtocols(java.lang.String... protocol)
protocol
- Protocol names to add to SSLEngine.setEnabledProtocols(String[])
@ManagedAttribute("The included TLS protocols") public java.lang.String[] getIncludeProtocols()
SSLEngine.setEnabledProtocols(String[])
public void setIncludeProtocols(java.lang.String... protocols)
protocols
- The array of protocol names to include in
SSLEngine.setEnabledProtocols(String[])
@ManagedAttribute("The excluded cipher suites") public java.lang.String[] getExcludeCipherSuites()
SSLEngine.setEnabledCipherSuites(String[])
public void setExcludeCipherSuites(java.lang.String... cipherSuites)
cipherSuites
- The array of cipher suite names to exclude from
SSLEngine.setEnabledCipherSuites(String[])
public void addExcludeCipherSuites(java.lang.String... cipher)
cipher
- Cipher names to add to SSLEngine.setEnabledCipherSuites(String[])
@ManagedAttribute("The included cipher suites") public java.lang.String[] getIncludeCipherSuites()
SSLEngine.setEnabledCipherSuites(String[])
public void setIncludeCipherSuites(java.lang.String... cipherSuites)
cipherSuites
- The array of cipher suite names to include in
SSLEngine.setEnabledCipherSuites(String[])
@ManagedAttribute("Whether to respect the cipher suites order") public boolean isUseCipherSuitesOrder()
public void setUseCipherSuitesOrder(boolean useCipherSuitesOrder)
@ManagedAttribute("The keyStore path") public java.lang.String getKeyStorePath()
public void setKeyStorePath(java.lang.String keyStorePath)
keyStorePath
- The file or URL of the SSL Key store.@ManagedAttribute("The keyStore provider name") public java.lang.String getKeyStoreProvider()
public void setKeyStoreProvider(java.lang.String keyStoreProvider)
keyStoreProvider
- The provider of the key store@ManagedAttribute("The keyStore type") public java.lang.String getKeyStoreType()
public void setKeyStoreType(java.lang.String keyStoreType)
keyStoreType
- The type of the key store (default "JKS")@ManagedAttribute("The certificate alias") public java.lang.String getCertAlias()
public void setCertAlias(java.lang.String certAlias)
This can be used if there are multiple non-SNI certificates to specify the certificate that should be used, or with SNI certificates to set a certificate to try if no others match
certAlias
- Alias of SSL certificate for the connector@ManagedAttribute("The trustStore path") public java.lang.String getTrustStorePath()
public void setTrustStorePath(java.lang.String trustStorePath)
trustStorePath
- The file name or URL of the trust store location@ManagedAttribute("The trustStore provider name") public java.lang.String getTrustStoreProvider()
public void setTrustStoreProvider(java.lang.String trustStoreProvider)
trustStoreProvider
- The provider of the trust store@ManagedAttribute("The trustStore type") public java.lang.String getTrustStoreType()
public void setTrustStoreType(java.lang.String trustStoreType)
trustStoreType
- The type of the trust store@ManagedAttribute("Whether client authentication is needed") public boolean getNeedClientAuth()
SSLEngine.getNeedClientAuth()
public void setNeedClientAuth(boolean needClientAuth)
needClientAuth
- True if SSL needs client authentication.SSLEngine.getNeedClientAuth()
@ManagedAttribute("Whether client authentication is wanted") public boolean getWantClientAuth()
SSLEngine.getWantClientAuth()
public void setWantClientAuth(boolean wantClientAuth)
wantClientAuth
- True if SSL wants client authentication.SSLEngine.getWantClientAuth()
@ManagedAttribute("Whether certificates are validated") public boolean isValidateCerts()
public void setValidateCerts(boolean validateCerts)
validateCerts
- true if SSL certificates have to be validated@ManagedAttribute("Whether peer certificates are validated") public boolean isValidatePeerCerts()
public void setValidatePeerCerts(boolean validatePeerCerts)
validatePeerCerts
- true if SSL certificates of the peer have to be validatedpublic void setKeyStorePassword(java.lang.String password)
password
- The password for the key store. If null is passed and
a keystore is set, then
the getPassword(String)
is used to
obtain a password either from the
system property or by prompting for manual entry.public void setKeyManagerPassword(java.lang.String password)
password
- The password (if any) for the specific key within the key store.
If null is passed and the system property is set,
then the getPassword(String)
is used to
obtain a password from the system property.public void setTrustStorePassword(java.lang.String password)
password
- The password for the truststore. If null is passed and a truststore is set
that is different from the keystore, then
the getPassword(String)
is used to
obtain a password either from the
system property or by prompting for manual entry.@ManagedAttribute("The provider name") public java.lang.String getProvider()
SSLContext.getInstance(String, String)
public void setProvider(java.lang.String provider)
provider
- The SSL provider name, which if set is passed to
SSLContext.getInstance(String, String)
@ManagedAttribute("The TLS protocol") public java.lang.String getProtocol()
SSLContext.getInstance(String, String)
public void setProtocol(java.lang.String protocol)
protocol
- The SSL protocol (default "TLS") passed to
SSLContext.getInstance(String, String)
@ManagedAttribute("The SecureRandom algorithm") public java.lang.String getSecureRandomAlgorithm()
SecureRandom.getInstance(String)
to obtain the SecureRandom
instance passed to
SSLContext.init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], SecureRandom)
public void setSecureRandomAlgorithm(java.lang.String algorithm)
algorithm
- The algorithm name, which if set is passed to
SecureRandom.getInstance(String)
to obtain the SecureRandom
instance passed to
SSLContext.init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], SecureRandom)
@ManagedAttribute("The KeyManagerFactory algorithm") public java.lang.String getKeyManagerFactoryAlgorithm()
KeyManagerFactory
public void setKeyManagerFactoryAlgorithm(java.lang.String algorithm)
algorithm
- The algorithm name (default "SunX509") used by the KeyManagerFactory
@ManagedAttribute("The TrustManagerFactory algorithm") public java.lang.String getTrustManagerFactoryAlgorithm()
TrustManagerFactory
@ManagedAttribute("Whether certificates should be trusted even if they are invalid") public boolean isTrustAll()
public void setTrustAll(boolean trustAll)
trustAll
- True if all certificates should be trusted if there is no KeyStore or TrustStorepublic void setTrustManagerFactoryAlgorithm(java.lang.String algorithm)
algorithm
- The algorithm name (default "SunX509") used by the TrustManagerFactory
Use the string "TrustAll" to install a trust manager that trusts all.@ManagedAttribute("Whether renegotiation is allowed") public boolean isRenegotiationAllowed()
public void setRenegotiationAllowed(boolean renegotiationAllowed)
renegotiationAllowed
- whether TLS renegotiation is allowed@ManagedAttribute("The max number of renegotiations allowed") public int getRenegotiationLimit()
public void setRenegotiationLimit(int renegotiationLimit)
renegotiationLimit
- The number of renegotions allowed for this connection.
When the limit is 0 renegotiation will be denied. If the limit is less than 0 then no limit is applied.
Default 5.@ManagedAttribute("The path to the certificate revocation list file") public java.lang.String getCrlPath()
public void setCrlPath(java.lang.String crlPath)
crlPath
- Path to file that contains Certificate Revocation List@ManagedAttribute("The maximum number of intermediate certificates") public int getMaxCertPathLength()
public void setMaxCertPathLength(int maxCertPathLength)
maxCertPathLength
- maximum number of intermediate certificates in
the certification path (-1 for unlimited)public javax.net.ssl.SSLContext getSslContext()
public void setSslContext(javax.net.ssl.SSLContext sslContext)
sslContext
- Set a preconfigured SSLContext@ManagedAttribute("The endpoint identification algorithm") public java.lang.String getEndpointIdentificationAlgorithm()
public void setEndpointIdentificationAlgorithm(java.lang.String endpointIdentificationAlgorithm)
endpointIdentificationAlgorithm
- Set the endpointIdentificationAlgorithmpublic java.security.cert.PKIXCertPathChecker getPkixCertPathChecker()
public void setPkixCertPathChecker(java.security.cert.PKIXCertPathChecker pkixCertPatchChecker)
protected java.security.KeyStore loadKeyStore(Resource resource) throws java.lang.Exception
resource
- the resource to load the keystore fromjava.lang.Exception
- if the keystore cannot be loadedprotected java.security.KeyStore loadTrustStore(Resource resource) throws java.lang.Exception
resource
- the resource to load the truststore fromjava.lang.Exception
- if the truststore cannot be loadedprotected java.util.Collection<? extends java.security.cert.CRL> loadCRL(java.lang.String crlPath) throws java.lang.Exception
Required for integrations to be able to override the mechanism used to load CRL in order to provide their own implementation.
crlPath
- path of certificate revocation list filejava.lang.Exception
- if the certificate revocation list cannot be loadedprotected javax.net.ssl.KeyManager[] getKeyManagers(java.security.KeyStore keyStore) throws java.lang.Exception
java.lang.Exception
protected javax.net.ssl.TrustManager[] getTrustManagers(java.security.KeyStore trustStore, java.util.Collection<? extends java.security.cert.CRL> crls) throws java.lang.Exception
java.lang.Exception
protected java.security.cert.PKIXBuilderParameters newPKIXBuilderParameters(java.security.KeyStore trustStore, java.util.Collection<? extends java.security.cert.CRL> crls) throws java.lang.Exception
java.lang.Exception
public void selectProtocols(java.lang.String[] enabledProtocols, java.lang.String[] supportedProtocols)
enabledProtocols
- Array of enabled protocolssupportedProtocols
- Array of supported protocolsprotected void selectCipherSuites(java.lang.String[] enabledCipherSuites, java.lang.String[] supportedCipherSuites)
enabledCipherSuites
- Array of enabled cipher suitessupportedCipherSuites
- Array of supported cipher suitesprotected void processIncludeCipherSuites(java.lang.String[] supportedCipherSuites, java.util.List<java.lang.String> selected_ciphers)
protected void removeExcludedCipherSuites(java.util.List<java.lang.String> selected_ciphers)
@ManagedAttribute("Whether certificate revocation list distribution points is enabled") public boolean isEnableCRLDP()
public void setEnableCRLDP(boolean enableCRLDP)
enableCRLDP
- true - turn on, false - turns off@ManagedAttribute("Whether online certificate status protocol support is enabled") public boolean isEnableOCSP()
public void setEnableOCSP(boolean enableOCSP)
enableOCSP
- true - turn on, false - turn off@ManagedAttribute("The online certificate status protocol URL") public java.lang.String getOcspResponderURL()
public void setOcspResponderURL(java.lang.String ocspResponderURL)
ocspResponderURL
- location of the OCSP Responderpublic void setKeyStore(java.security.KeyStore keyStore)
keyStore
- the key store to setpublic java.security.KeyStore getKeyStore()
public void setTrustStore(java.security.KeyStore trustStore)
trustStore
- the trust store to setpublic java.security.KeyStore getTrustStore()
public void setKeyStoreResource(Resource resource)
resource
- the key store resource to setpublic Resource getKeyStoreResource()
public void setTrustStoreResource(Resource resource)
resource
- the trust store resource to setpublic Resource getTrustStoreResource()
@ManagedAttribute("Whether TLS session caching is enabled") public boolean isSessionCachingEnabled()
public void setSessionCachingEnabled(boolean enableSessionCaching)
SSLContext.createSSLEngine(String, int)
method is
used to pass host and port information as a hint for session reuse. Note that
this is only a hint and session may not be reused. Moreover, the hint is typically
only used on client side implementations and setting this to false does not
stop a server from accepting an offered session ID to reuse.enableSessionCaching
- the value of the flag@ManagedAttribute("The maximum TLS session cache size") public int getSslSessionCacheSize()
SSLSessionContext.setSessionCacheSize(int)
public void setSslSessionCacheSize(int sslSessionCacheSize)
Set the max cache size to be set on SSLSessionContext.setSessionCacheSize(int)
when this factory is started.
sslSessionCacheSize
- SSL session cache size to set. A value of -1 (default) uses
the JVM default, 0 means unlimited and positive number is a max size.@ManagedAttribute("The TLS session cache timeout, in seconds") public int getSslSessionTimeout()
public void setSslSessionTimeout(int sslSessionTimeout)
Set the timeout in seconds to be set on SSLSessionContext.setSessionTimeout(int)
when this factory is started.
sslSessionTimeout
- SSL session timeout to set in seconds. A value of -1 (default) uses
the JVM default, 0 means unlimited and positive number is a timeout in seconds.protected Password getPassword(java.lang.String realm)
realm
- the realmpublic Password newPassword(java.lang.String password)
password
- the password stringpublic javax.net.ssl.SSLServerSocket newSslServerSocket(java.lang.String host, int port, int backlog) throws java.io.IOException
java.io.IOException
public javax.net.ssl.SSLSocket newSslSocket() throws java.io.IOException
java.io.IOException
public javax.net.ssl.SSLEngine newSSLEngine()
SSLEngine
s, usually only used for retrieving configuration
information such as the application buffer size or the list of protocols/ciphers.
This method should not be used for creating SSLEngine
s that are used in actual socket
communication.
SSLEngine
public javax.net.ssl.SSLEngine newSSLEngine(java.lang.String host, int port)
SSLEngine
s, although creation of
SSLEngine
s on the server-side should prefer newSSLEngine(InetSocketAddress)
.host
- the remote hostport
- the remote portSSLEngine
public javax.net.ssl.SSLEngine newSSLEngine(java.net.InetSocketAddress address)
SSLEngine
s.
If the given address
is null, it is equivalent to newSSLEngine()
, otherwise
newSSLEngine(String, int)
is called.
Clients that wish to create SSLEngine
instances must use newSSLEngine(String, int)
.
address
- the remote peer addressSSLEngine
public void customize(javax.net.ssl.SSLEngine sslEngine)
customize(SSLParameters)
sslEngine
- the SSLEngine to customizepublic javax.net.ssl.SSLParameters customize(javax.net.ssl.SSLParameters sslParams)
sslParams
- The parameters to customizepublic void reload(java.util.function.Consumer<SslContextFactory> consumer) throws java.lang.Exception
java.lang.Exception
public static java.security.cert.X509Certificate[] getCertChain(javax.net.ssl.SSLSession sslSession)
public static int deduceKeyLength(java.lang.String cipherSuite)
This is based on the information on effective key lengths in RFC 2246 - The TLS Protocol Version 1.0, Appendix C. CipherSuite definitions:
Effective Cipher Type Key Bits NULL * Stream 0 IDEA_CBC Block 128 RC2_CBC_40 * Block 40 RC4_40 * Stream 40 RC4_128 Stream 128 DES40_CBC * Block 40 DES_CBC Block 56 3DES_EDE_CBC Block 168
cipherSuite
- String name of the TLS cipher suite.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2018 Webtide. All rights reserved.