Class SSLHostConfig
java.lang.Object
org.apache.tomcat.util.net.SSLHostConfig
- All Implemented Interfaces:
Serializable
Represents the TLS configuration for a virtual host.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCertificate verification levels.static enumSSL configuration type. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCertificate(SSLHostConfigCertificate certificate) Adds a certificate to this SSL host configuration.static StringadjustRelativePath(String path) Adjusts a relative path to an absolute path based on the CATALINA_BASE property.Returns the set of certificates that expire before the given date.Returns the CA certificate file.Returns the CA certificate path.Returns the certificate revocation list file.Returns the certificate revocation list path.Returns the set of certificates.getCertificates(boolean createDefaultIfEmpty) Returns the set of certificates, optionally creating a default if empty.Returns the certificate verification mode.Returns the certificate verification mode as a string.intReturns the certificate verification depth.Returns the list of configured ciphers.Returns the cipher (TLSv1.2 and below) configuration.Obtain the current cipher suite (TLSv1.3) configuration.Expose in String form for JMX.booleanReturns whether compression is disabled.booleanReturns whether session tickets are disabled.String[]Returns the ciphers enabled for this TLS virtual host.String[]Returns the protocols enabled for this TLS virtual host.Returns the parsed group list.Returns the configured named groups.booleanReturns whether to honor the cipher order.Returns the host name associated with this SSL configuration.booleanReturns whether insecure renegotiation is allowed.Obtain the list of JSSE cipher names for the current configuration.Returns the key manager algorithm.Returns the JMX object name.booleanReturns whether OCSP is enabled.booleanReturns whether OCSP soft fail is enabled.intReturns the OCSP timeout.intReturns the OCSP verify flags.Returns the OpenSSL configuration.Returns the OpenSSL configuration context pointer.Returns the OpenSSL context pointer.Returns the configured protocols.booleanReturns whether revocation checking is enabled.intReturns the session cache size.intReturns the session timeout.Returns the SSL protocol.Returns the trust manager class name.Returns the truststore.Returns the truststore algorithm.Returns the truststore file.Returns the truststore password.Returns the truststore provider.Returns the truststore type.booleanReturns whether the certificate verification depth has been configured.booleanReturns whether TLS 1.3 renegotiation is available.voidsetCaCertificateFile(String caCertificateFile) Sets the CA certificate file.voidsetCaCertificatePath(String caCertificatePath) Sets the CA certificate path.voidsetCertificateRevocationListFile(String certificateRevocationListFile) Sets the certificate revocation list file.voidsetCertificateRevocationListPath(String certificateRevocationListPath) Sets the certificate revocation list path.voidsetCertificateVerification(String certificateVerification) Sets the certificate verification mode.voidsetCertificateVerificationAsString(String certificateVerification) Sets the certificate verification mode as a string.voidsetCertificateVerificationDepth(int certificateVerificationDepth) Sets the certificate verification depth.voidsetCiphers(String ciphersList) Set the new cipher (TLSv1.2 and below) configuration.voidsetCipherSuites(String cipherSuites) Set the cipher suite (TLSv1.3) configuration.voidsetDisableCompression(boolean disableCompression) Sets whether compression is disabled.voidsetDisableSessionTickets(boolean disableSessionTickets) Sets whether session tickets are disabled.voidsetEnabledCiphers(String[] enabledCiphers) Sets the ciphers enabled for this TLS virtual host.voidsetEnabledProtocols(String[] enabledProtocols) Sets the protocols enabled for this TLS virtual host.voidSet the enabled named groups.voidsetHonorCipherOrder(boolean honorCipherOrder) Sets whether to honor the cipher order.voidsetHostName(String hostName) Sets the host name.voidsetInsecureRenegotiation(boolean insecureRenegotiation) Sets whether insecure renegotiation is allowed.voidsetKeyManagerAlgorithm(String keyManagerAlgorithm) Sets the key manager algorithm.voidsetObjectName(ObjectName oname) Sets the JMX object name.voidsetOcspEnabled(boolean ocspEnabled) Sets whether OCSP is enabled.voidsetOcspSoftFail(boolean ocspSoftFail) Sets whether OCSP soft fail is enabled.voidsetOcspTimeout(int ocspTimeout) Sets the OCSP timeout.voidsetOcspVerifyFlags(int ocspVerifyFlags) Sets the OCSP verify flags.voidsetOpenSslConf(OpenSSLConf conf) Sets the OpenSSL configuration.voidsetOpenSslConfContext(Long openSslConfContext) Sets the OpenSSL configuration context pointer.voidsetOpenSslContext(Long openSslContext) Sets the OpenSSL context pointer.voidsetProtocols(String input) Sets the protocols to be used.voidsetRevocationEnabled(boolean revocationEnabled) Sets whether revocation checking is enabled.voidsetSessionCacheSize(int sessionCacheSize) Sets the session cache size.voidsetSessionTimeout(int sessionTimeout) Sets the session timeout.voidsetSslProtocol(String sslProtocol) Sets the SSL protocol.voidsetTls13RenegotiationAvailable(boolean tls13RenegotiationAvailable) Sets whether TLS 1.3 renegotiation is available.voidsetTrustManagerClassName(String trustManagerClassName) Sets the trust manager class name.voidsetTrustStore(KeyStore truststore) Sets the truststore.voidsetTruststoreAlgorithm(String truststoreAlgorithm) Sets the truststore algorithm.voidsetTruststoreFile(String truststoreFile) Sets the truststore file.voidsetTruststorePassword(String truststorePassword) Sets the truststore password.voidsetTruststoreProvider(String truststoreProvider) Sets the truststore provider.voidsetTruststoreType(String truststoreType) Sets the truststore type.
-
Field Details
-
DEFAULT_SSL_HOST_NAME
-
SSL_PROTO_ALL_SET
-
DEFAULT_TLS_CIPHERS_12
Default cipher list for TLS 1.2 and below.- See Also:
-
DEFAULT_TLS_CIPHERS_13
-
DEFAULT_TLS_CIPHERS
-
-
Constructor Details
-
SSLHostConfig
public SSLHostConfig()Default constructor.
-
-
Method Details
-
isTls13RenegotiationAvailable
public boolean isTls13RenegotiationAvailable()Returns whether TLS 1.3 renegotiation is available.- Returns:
trueif TLS 1.3 renegotiation is available
-
setTls13RenegotiationAvailable
public void setTls13RenegotiationAvailable(boolean tls13RenegotiationAvailable) Sets whether TLS 1.3 renegotiation is available.- Parameters:
tls13RenegotiationAvailable-trueif TLS 1.3 renegotiation is available
-
getOpenSslConfContext
Returns the OpenSSL configuration context pointer.- Returns:
- the OpenSSL configuration context pointer
-
setOpenSslConfContext
Sets the OpenSSL configuration context pointer.- Parameters:
openSslConfContext- the OpenSSL configuration context pointer
-
getOpenSslContext
Returns the OpenSSL context pointer.- Returns:
- the OpenSSL context pointer
-
setOpenSslContext
Sets the OpenSSL context pointer.- Parameters:
openSslContext- the OpenSSL context pointer
-
getConfigType
Expose in String form for JMX.- Returns:
- the configuration type as a string
-
getEnabledProtocols
Returns the protocols enabled for this TLS virtual host.- Returns:
- The protocols enabled for this TLS virtual host
- See Also:
-
setEnabledProtocols
Sets the protocols enabled for this TLS virtual host.- Parameters:
enabledProtocols- the protocols to enable
-
getEnabledCiphers
Returns the ciphers enabled for this TLS virtual host.- Returns:
- The ciphers enabled for this TLS virtual host
- See Also:
-
setEnabledCiphers
Sets the ciphers enabled for this TLS virtual host.- Parameters:
enabledCiphers- the ciphers to enable
-
getObjectName
-
setObjectName
Sets the JMX object name.- Parameters:
oname- the object name
-
addCertificate
Adds a certificate to this SSL host configuration.- Parameters:
certificate- the certificate to add
-
getOpenSslConf
Returns the OpenSSL configuration.- Returns:
- the OpenSSL configuration
-
setOpenSslConf
Sets the OpenSSL configuration.- Parameters:
conf- the OpenSSL configuration
-
getCertificates
Returns the set of certificates.- Returns:
- the certificates
-
getCertificates
Returns the set of certificates, optionally creating a default if empty.- Parameters:
createDefaultIfEmpty-trueto create a default certificate if the set is empty- Returns:
- the certificates
-
setCertificateRevocationListFile
Sets the certificate revocation list file.- Parameters:
certificateRevocationListFile- the certificate revocation list file
-
getCertificateRevocationListFile
Returns the certificate revocation list file.- Returns:
- the certificate revocation list file
-
setCertificateVerification
Sets the certificate verification mode.- Parameters:
certificateVerification- the certificate verification mode
-
getCertificateVerification
Returns the certificate verification mode.- Returns:
- the certificate verification mode
-
setCertificateVerificationAsString
Sets the certificate verification mode as a string.- Parameters:
certificateVerification- the certificate verification mode
-
getCertificateVerificationAsString
Returns the certificate verification mode as a string.- Returns:
- the certificate verification mode as a string
-
setCertificateVerificationDepth
public void setCertificateVerificationDepth(int certificateVerificationDepth) Sets the certificate verification depth.- Parameters:
certificateVerificationDepth- the certificate verification depth
-
getCertificateVerificationDepth
public int getCertificateVerificationDepth()Returns the certificate verification depth.- Returns:
- the certificate verification depth
-
isCertificateVerificationDepthConfigured
public boolean isCertificateVerificationDepthConfigured()Returns whether the certificate verification depth has been configured.- Returns:
trueif the certificate verification depth has been configured
-
setCiphers
Set the new cipher (TLSv1.2 and below) configuration. Note: Regardless of the format used to set the configuration, it is always stored in OpenSSL format.- Parameters:
ciphersList- The new cipher configuration in OpenSSL or JSSE format
-
getCiphers
Returns the cipher (TLSv1.2 and below) configuration.- Returns:
- An OpenSSL cipher string for the current configuration.
-
getCipherList
Returns the list of configured ciphers.- Returns:
- the cipher list
-
getJsseCipherNames
-
setCipherSuites
Set the cipher suite (TLSv1.3) configuration.- Parameters:
cipherSuites- The cipher suites to use in a colon-separated, preference order list
-
getCipherSuites
Obtain the current cipher suite (TLSv1.3) configuration.- Returns:
- An OpenSSL cipher suite string for the current configuration.
-
setHonorCipherOrder
public void setHonorCipherOrder(boolean honorCipherOrder) Sets whether to honor the cipher order.- Parameters:
honorCipherOrder-trueto honor the cipher order
-
getHonorCipherOrder
public boolean getHonorCipherOrder()Returns whether to honor the cipher order.- Returns:
trueto honor the cipher order
-
setHostName
-
getHostName
Returns the host name associated with this SSL configuration.- Returns:
- The host name associated with this SSL configuration - always in lower case.
-
getOcspEnabled
public boolean getOcspEnabled()Returns whether OCSP is enabled.- Returns:
trueif OCSP is enabled
-
setOcspEnabled
public void setOcspEnabled(boolean ocspEnabled) Sets whether OCSP is enabled.- Parameters:
ocspEnabled-trueif OCSP is enabled
-
getOcspSoftFail
public boolean getOcspSoftFail()Returns whether OCSP soft fail is enabled.- Returns:
trueif OCSP soft fail is enabled
-
setOcspSoftFail
public void setOcspSoftFail(boolean ocspSoftFail) Sets whether OCSP soft fail is enabled.- Parameters:
ocspSoftFail-trueif OCSP soft fail is enabled
-
getOcspTimeout
public int getOcspTimeout()Returns the OCSP timeout.- Returns:
- the OCSP timeout
-
setOcspTimeout
public void setOcspTimeout(int ocspTimeout) Sets the OCSP timeout.- Parameters:
ocspTimeout- the OCSP timeout
-
getOcspVerifyFlags
public int getOcspVerifyFlags()Returns the OCSP verify flags.- Returns:
- the OCSP verify flags
-
setOcspVerifyFlags
public void setOcspVerifyFlags(int ocspVerifyFlags) Sets the OCSP verify flags.- Parameters:
ocspVerifyFlags- the OCSP verify flags
-
setProtocols
Sets the protocols to be used.- Parameters:
input- the protocol string
-
getProtocols
-
setSessionCacheSize
public void setSessionCacheSize(int sessionCacheSize) Sets the session cache size.- Parameters:
sessionCacheSize- the session cache size
-
getSessionCacheSize
public int getSessionCacheSize()Returns the session cache size.- Returns:
- the session cache size
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout) Sets the session timeout.- Parameters:
sessionTimeout- the session timeout
-
getSessionTimeout
public int getSessionTimeout()Returns the session timeout.- Returns:
- the session timeout
-
getGroups
-
setGroups
Set the enabled named groups.- Parameters:
groups- the case sensitive comma separated list of groups
-
getGroupList
-
setKeyManagerAlgorithm
Sets the key manager algorithm.- Parameters:
keyManagerAlgorithm- the key manager algorithm
-
getKeyManagerAlgorithm
Returns the key manager algorithm.- Returns:
- the key manager algorithm
-
setRevocationEnabled
public void setRevocationEnabled(boolean revocationEnabled) Sets whether revocation checking is enabled.- Parameters:
revocationEnabled-trueif revocation checking is enabled
-
getRevocationEnabled
public boolean getRevocationEnabled()Returns whether revocation checking is enabled.- Returns:
trueif revocation checking is enabled
-
setSslProtocol
Sets the SSL protocol.- Parameters:
sslProtocol- the SSL protocol
-
getSslProtocol
-
setTrustManagerClassName
Sets the trust manager class name.- Parameters:
trustManagerClassName- the trust manager class name
-
getTrustManagerClassName
Returns the trust manager class name.- Returns:
- the trust manager class name
-
setTruststoreAlgorithm
Sets the truststore algorithm.- Parameters:
truststoreAlgorithm- the truststore algorithm
-
getTruststoreAlgorithm
Returns the truststore algorithm.- Returns:
- the truststore algorithm
-
setTruststoreFile
Sets the truststore file.- Parameters:
truststoreFile- the truststore file
-
getTruststoreFile
-
setTruststorePassword
Sets the truststore password.- Parameters:
truststorePassword- the truststore password
-
getTruststorePassword
Returns the truststore password.- Returns:
- the truststore password
-
setTruststoreProvider
Sets the truststore provider.- Parameters:
truststoreProvider- the truststore provider
-
getTruststoreProvider
Returns the truststore provider.- Returns:
- the truststore provider
-
setTruststoreType
Sets the truststore type.- Parameters:
truststoreType- the truststore type
-
getTruststoreType
-
setTrustStore
Sets the truststore.- Parameters:
truststore- the truststore
-
getTruststore
Returns the truststore.- Returns:
- the truststore
- Throws:
IOException- if an I/O error occurs
-
setCertificateRevocationListPath
Sets the certificate revocation list path.- Parameters:
certificateRevocationListPath- the certificate revocation list path
-
getCertificateRevocationListPath
Returns the certificate revocation list path.- Returns:
- the certificate revocation list path
-
setCaCertificateFile
Sets the CA certificate file.- Parameters:
caCertificateFile- the CA certificate file
-
getCaCertificateFile
Returns the CA certificate file.- Returns:
- the CA certificate file
-
setCaCertificatePath
Sets the CA certificate path.- Parameters:
caCertificatePath- the CA certificate path
-
getCaCertificatePath
Returns the CA certificate path.- Returns:
- the CA certificate path
-
setDisableCompression
public void setDisableCompression(boolean disableCompression) Sets whether compression is disabled.- Parameters:
disableCompression-trueif compression is disabled
-
getDisableCompression
public boolean getDisableCompression()Returns whether compression is disabled.- Returns:
trueif compression is disabled
-
setDisableSessionTickets
public void setDisableSessionTickets(boolean disableSessionTickets) Sets whether session tickets are disabled.- Parameters:
disableSessionTickets-trueif session tickets are disabled
-
getDisableSessionTickets
public boolean getDisableSessionTickets()Returns whether session tickets are disabled.- Returns:
trueif session tickets are disabled
-
setInsecureRenegotiation
public void setInsecureRenegotiation(boolean insecureRenegotiation) Sets whether insecure renegotiation is allowed.- Parameters:
insecureRenegotiation-trueif insecure renegotiation is allowed
-
getInsecureRenegotiation
public boolean getInsecureRenegotiation()Returns whether insecure renegotiation is allowed.- Returns:
trueif insecure renegotiation is allowed
-
certificatesExpiringBefore
Returns the set of certificates that expire before the given date.- Parameters:
date- the date to check against- Returns:
- the set of certificates expiring before the given date
-
adjustRelativePath
Adjusts a relative path to an absolute path based on the CATALINA_BASE property.- Parameters:
path- the path to adjust- Returns:
- the adjusted path
- Throws:
FileNotFoundException- if the file does not exist
-
DEFAULT_TLS_CIPHERS_12