Package org.apache.tomcat.util.net
Class SSLHostConfigCertificate
- java.lang.Object
-
- org.apache.tomcat.util.net.SSLHostConfigCertificate
-
- All Implemented Interfaces:
java.io.Serializable
public class SSLHostConfigCertificate extends java.lang.Object implements java.io.SerializableRepresents the SSL certificate configuration for a virtual host. Holds the certificate details for either JSSE or OpenSSL implementations.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSSLHostConfigCertificate.TypeDefines the types of SSL certificates supported.
-
Field Summary
Fields Modifier and Type Field Description static SSLHostConfigCertificate.TypeDEFAULT_TYPEThe default certificate type when none is explicitly specified.
-
Constructor Summary
Constructors Constructor Description SSLHostConfigCertificate()Creates a new certificate configuration with default settings.SSLHostConfigCertificate(SSLHostConfig sslHostConfig, SSLHostConfigCertificate.Type type)Creates a new certificate configuration for the given host and type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCertificateChainFile()Returns the path to the certificate chain file used by OpenSSL.java.lang.StringgetCertificateFile()Returns the path to the certificate file used by OpenSSL.java.lang.StringgetCertificateKeyAlias()Returns the alias of the key entry in the keystore.java.lang.StringgetCertificateKeyFile()Returns the path to the private key file used by OpenSSL.javax.net.ssl.X509KeyManagergetCertificateKeyManager()Returns the X509KeyManager for this certificate configuration.java.lang.StringgetCertificateKeyPassword()Returns the password for the certificate's private key.java.lang.StringgetCertificateKeyPasswordFile()Returns the path to the file containing the certificate key password.java.security.KeyStoregetCertificateKeystore()Returns the Java KeyStore for this certificate.java.lang.StringgetCertificateKeystoreFile()Returns the path to the keystore file.java.lang.StringgetCertificateKeystorePassword()Returns the password used to access the keystore.java.lang.StringgetCertificateKeystorePasswordFile()Returns the path to the file containing the keystore password.java.lang.StringgetCertificateKeystoreProvider()Returns the provider of the keystore.java.lang.StringgetCertificateKeystoreType()Returns the type of the keystore (e.g., JKS, PKCS12).javax.management.ObjectNamegetObjectName()Returns the JMX ObjectName for this certificate configuration.SSLContextgetSslContext()Returns the SSLContext for this certificate.SSLContextgetSslContextGenerated()Returns the SSLContext generated from the certificate configuration.SSLHostConfiggetSSLHostConfig()Returns the SSLHostConfig that owns this certificate configuration.SSLHostConfigCertificate.TypegetType()Returns the type of this certificate configuration.voidsetCertificateChainFile(java.lang.String certificateChainFile)Sets the path to the certificate chain file used by OpenSSL.voidsetCertificateFile(java.lang.String certificateFile)Sets the path to the certificate file used by OpenSSL.voidsetCertificateKeyAlias(java.lang.String certificateKeyAlias)Sets the alias of the key entry in the keystore.voidsetCertificateKeyFile(java.lang.String certificateKeyFile)Sets the path to the private key file used by OpenSSL.voidsetCertificateKeyManager(javax.net.ssl.X509KeyManager certificateKeyManager)Sets the X509KeyManager for this certificate configuration.voidsetCertificateKeyPassword(java.lang.String certificateKeyPassword)Sets the password for the certificate's private key.voidsetCertificateKeyPasswordFile(java.lang.String certificateKeyPasswordFile)Sets the path to the file containing the certificate key password.voidsetCertificateKeystore(java.security.KeyStore certificateKeystore)Sets the Java KeyStore for this certificate.voidsetCertificateKeystoreFile(java.lang.String certificateKeystoreFile)Sets the path to the keystore file.voidsetCertificateKeystorePassword(java.lang.String certificateKeystorePassword)Sets the password used to access the keystore.voidsetCertificateKeystorePasswordFile(java.lang.String certificateKeystorePasswordFile)Sets the path to the file containing the keystore password.voidsetCertificateKeystoreProvider(java.lang.String certificateKeystoreProvider)Sets the provider of the keystore.voidsetCertificateKeystoreType(java.lang.String certificateKeystoreType)Sets the type of the keystore (e.g., JKS, PKCS12).voidsetObjectName(javax.management.ObjectName oname)Sets the JMX ObjectName for this certificate configuration.voidsetSslContext(SSLContext sslContext)Sets the provided SSLContext for this certificate configuration.
-
-
-
Field Detail
-
DEFAULT_TYPE
public static final SSLHostConfigCertificate.Type DEFAULT_TYPE
The default certificate type when none is explicitly specified.
-
-
Constructor Detail
-
SSLHostConfigCertificate
public SSLHostConfigCertificate()
Creates a new certificate configuration with default settings.
-
SSLHostConfigCertificate
public SSLHostConfigCertificate(SSLHostConfig sslHostConfig, SSLHostConfigCertificate.Type type)
Creates a new certificate configuration for the given host and type.- Parameters:
sslHostConfig- the parent SSL host configurationtype- the type of this certificate
-
-
Method Detail
-
getSslContext
public SSLContext getSslContext()
Returns the SSLContext for this certificate. Returns the provided context if set, otherwise returns the generated context.- Returns:
- the SSLContext instance
-
setSslContext
public void setSslContext(SSLContext sslContext)
Sets the provided SSLContext for this certificate configuration.- Parameters:
sslContext- the SSLContext to use
-
getSslContextGenerated
public SSLContext getSslContextGenerated()
Returns the SSLContext generated from the certificate configuration.- Returns:
- the generated SSLContext, or null if not yet generated
-
getSSLHostConfig
public SSLHostConfig getSSLHostConfig()
Returns the SSLHostConfig that owns this certificate configuration.- Returns:
- the parent SSLHostConfig
-
getObjectName
public javax.management.ObjectName getObjectName()
Returns the JMX ObjectName for this certificate configuration.- Returns:
- the JMX ObjectName
-
setObjectName
public void setObjectName(javax.management.ObjectName oname)
Sets the JMX ObjectName for this certificate configuration.- Parameters:
oname- the JMX ObjectName
-
getType
public SSLHostConfigCertificate.Type getType()
Returns the type of this certificate configuration.- Returns:
- the certificate type
-
getCertificateKeyPassword
public java.lang.String getCertificateKeyPassword()
Returns the password for the certificate's private key.- Returns:
- the certificate key password
-
setCertificateKeyPassword
public void setCertificateKeyPassword(java.lang.String certificateKeyPassword)
Sets the password for the certificate's private key.- Parameters:
certificateKeyPassword- the certificate key password
-
getCertificateKeyPasswordFile
public java.lang.String getCertificateKeyPasswordFile()
Returns the path to the file containing the certificate key password.- Returns:
- the key password file path
-
setCertificateKeyPasswordFile
public void setCertificateKeyPasswordFile(java.lang.String certificateKeyPasswordFile)
Sets the path to the file containing the certificate key password.- Parameters:
certificateKeyPasswordFile- the key password file path
-
setCertificateKeyAlias
public void setCertificateKeyAlias(java.lang.String certificateKeyAlias)
Sets the alias of the key entry in the keystore.- Parameters:
certificateKeyAlias- the key alias
-
getCertificateKeyAlias
public java.lang.String getCertificateKeyAlias()
Returns the alias of the key entry in the keystore.- Returns:
- the key alias
-
setCertificateKeystoreFile
public void setCertificateKeystoreFile(java.lang.String certificateKeystoreFile)
Sets the path to the keystore file.- Parameters:
certificateKeystoreFile- the keystore file path
-
getCertificateKeystoreFile
public java.lang.String getCertificateKeystoreFile()
Returns the path to the keystore file.- Returns:
- the keystore file path
-
setCertificateKeystorePassword
public void setCertificateKeystorePassword(java.lang.String certificateKeystorePassword)
Sets the password used to access the keystore.- Parameters:
certificateKeystorePassword- the keystore password
-
getCertificateKeystorePassword
public java.lang.String getCertificateKeystorePassword()
Returns the password used to access the keystore.- Returns:
- the keystore password
-
setCertificateKeystorePasswordFile
public void setCertificateKeystorePasswordFile(java.lang.String certificateKeystorePasswordFile)
Sets the path to the file containing the keystore password.- Parameters:
certificateKeystorePasswordFile- the keystore password file path
-
getCertificateKeystorePasswordFile
public java.lang.String getCertificateKeystorePasswordFile()
Returns the path to the file containing the keystore password.- Returns:
- the keystore password file path
-
setCertificateKeystoreProvider
public void setCertificateKeystoreProvider(java.lang.String certificateKeystoreProvider)
Sets the provider of the keystore.- Parameters:
certificateKeystoreProvider- the keystore provider name
-
getCertificateKeystoreProvider
public java.lang.String getCertificateKeystoreProvider()
Returns the provider of the keystore.- Returns:
- the keystore provider name
-
setCertificateKeystoreType
public void setCertificateKeystoreType(java.lang.String certificateKeystoreType)
Sets the type of the keystore (e.g., JKS, PKCS12).- Parameters:
certificateKeystoreType- the keystore type
-
getCertificateKeystoreType
public java.lang.String getCertificateKeystoreType()
Returns the type of the keystore (e.g., JKS, PKCS12).- Returns:
- the keystore type
-
setCertificateKeystore
public void setCertificateKeystore(java.security.KeyStore certificateKeystore)
Sets the Java KeyStore for this certificate.- Parameters:
certificateKeystore- the KeyStore instance
-
getCertificateKeystore
public java.security.KeyStore getCertificateKeystore() throws java.io.IOExceptionReturns the Java KeyStore for this certificate. If not previously set, loads it from the configured keystore file.- Returns:
- the KeyStore instance
- Throws:
java.io.IOException- if the keystore cannot be loaded
-
setCertificateKeyManager
public void setCertificateKeyManager(javax.net.ssl.X509KeyManager certificateKeyManager)
Sets the X509KeyManager for this certificate configuration.- Parameters:
certificateKeyManager- the X509KeyManager instance
-
getCertificateKeyManager
public javax.net.ssl.X509KeyManager getCertificateKeyManager()
Returns the X509KeyManager for this certificate configuration.- Returns:
- the X509KeyManager instance
-
setCertificateChainFile
public void setCertificateChainFile(java.lang.String certificateChainFile)
Sets the path to the certificate chain file used by OpenSSL.- Parameters:
certificateChainFile- the path to the certificate chain file
-
getCertificateChainFile
public java.lang.String getCertificateChainFile()
Returns the path to the certificate chain file used by OpenSSL.- Returns:
- the certificate chain file path
-
setCertificateFile
public void setCertificateFile(java.lang.String certificateFile)
Sets the path to the certificate file used by OpenSSL.- Parameters:
certificateFile- the path to the certificate file
-
getCertificateFile
public java.lang.String getCertificateFile()
Returns the path to the certificate file used by OpenSSL.- Returns:
- the certificate file path
-
setCertificateKeyFile
public void setCertificateKeyFile(java.lang.String certificateKeyFile)
Sets the path to the private key file used by OpenSSL.- Parameters:
certificateKeyFile- the path to the private key file
-
getCertificateKeyFile
public java.lang.String getCertificateKeyFile()
Returns the path to the private key file used by OpenSSL.- Returns:
- the private key file path
-
-