# Class SSLHostConfigCertificate

java.lang.Object
org.apache.tomcat.util.net.SSLHostConfigCertificate

All Implemented Interfaces:
  `Serializable`

public class SSLHostConfigCertificate extends Object implements Serializable
Represents 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 enum`
`SSLHostConfigCertificate.Type`
Defines the types of SSL certificates supported.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final SSLHostConfigCertificate.Type`
`DEFAULT_TYPE`
The 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

Modifier and Type
Method
Description
`String`
`getCertificateChainFile()`
Returns the path to the certificate chain file used by OpenSSL.
`String`
`getCertificateFile()`
Returns the path to the certificate file used by OpenSSL.
`String`
`getCertificateKeyAlias()`
Returns the alias of the key entry in the keystore.
`String`
`getCertificateKeyFile()`
Returns the path to the private key file used by OpenSSL.
`X509KeyManager`
`getCertificateKeyManager()`
Returns the X509KeyManager for this certificate configuration.
`String`
`getCertificateKeyPassword()`
Returns the password for the certificate's private key.
`String`
`getCertificateKeyPasswordFile()`
Returns the path to the file containing the certificate key password.
`KeyStore`
`getCertificateKeystore()`
Returns the Java KeyStore for this certificate.
`String`
`getCertificateKeystoreFile()`
Returns the path to the keystore file.
`String`
`getCertificateKeystorePassword()`
Returns the password used to access the keystore.
`String`
`getCertificateKeystorePasswordFile()`
Returns the path to the file containing the keystore password.
`String`
`getCertificateKeystoreProvider()`
Returns the provider of the keystore.
`String`
`getCertificateKeystoreType()`
Returns the type of the keystore (e.g., JKS, PKCS12).
`ObjectName`
`getObjectName()`
Returns the JMX ObjectName for this certificate configuration.
`SSLContext`
`getSslContext()`
Returns the SSLContext for this certificate.
`SSLContext`
`getSslContextGenerated()`
Returns the SSLContext generated from the certificate configuration.
`SSLHostConfig`
`getSSLHostConfig()`
Returns the SSLHostConfig that owns this certificate configuration.
`SSLHostConfigCertificate.Type`
`getType()`
Returns the type of this certificate configuration.
`void`
`setCertificateChainFile(String certificateChainFile)`
Sets the path to the certificate chain file used by OpenSSL.
`void`
`setCertificateFile(String certificateFile)`
Sets the path to the certificate file used by OpenSSL.
`void`
`setCertificateKeyAlias(String certificateKeyAlias)`
Sets the alias of the key entry in the keystore.
`void`
`setCertificateKeyFile(String certificateKeyFile)`
Sets the path to the private key file used by OpenSSL.
`void`
`setCertificateKeyManager(X509KeyManager certificateKeyManager)`
Sets the X509KeyManager for this certificate configuration.
`void`
`setCertificateKeyPassword(String certificateKeyPassword)`
Sets the password for the certificate's private key.
`void`
`setCertificateKeyPasswordFile(String certificateKeyPasswordFile)`
Sets the path to the file containing the certificate key password.
`void`
`setCertificateKeystore(KeyStore certificateKeystore)`
Sets the Java KeyStore for this certificate.
`void`
`setCertificateKeystoreFile(String certificateKeystoreFile)`
Sets the path to the keystore file.
`void`
`setCertificateKeystorePassword(String certificateKeystorePassword)`
Sets the password used to access the keystore.
`void`
`setCertificateKeystorePasswordFile(String certificateKeystorePasswordFile)`
Sets the path to the file containing the keystore password.
`void`
`setCertificateKeystoreProvider(String certificateKeystoreProvider)`
Sets the provider of the keystore.
`void`
`setCertificateKeystoreType(String certificateKeystoreType)`
Sets the type of the keystore (e.g., JKS, PKCS12).
`void`
`setObjectName(ObjectName oname)`
Sets the JMX ObjectName for this certificate configuration.
`void`
`setSslContext(SSLContext sslContext)`
Sets the provided SSLContext for this certificate configuration.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_TYPE

public static final SSLHostConfigCertificate.Type DEFAULT_TYPE
The default certificate type when none is explicitly specified.

## Constructor Details

### 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 configuration
  `type` - the type of this certificate

## Method Details

### 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 ObjectName getObjectName()
Returns the JMX ObjectName for this certificate configuration.

Returns:
  the JMX ObjectName

### setObjectName

public void setObjectName(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 String getCertificateKeyPassword()
Returns the password for the certificate's private key.

Returns:
  the certificate key password

### setCertificateKeyPassword

public void setCertificateKeyPassword(String certificateKeyPassword)
Sets the password for the certificate's private key.

Parameters:
  `certificateKeyPassword` - the certificate key password

### getCertificateKeyPasswordFile

public String getCertificateKeyPasswordFile()
Returns the path to the file containing the certificate key password.

Returns:
  the key password file path

### setCertificateKeyPasswordFile

public void setCertificateKeyPasswordFile(String certificateKeyPasswordFile)
Sets the path to the file containing the certificate key password.

Parameters:
  `certificateKeyPasswordFile` - the key password file path

### setCertificateKeyAlias

public void setCertificateKeyAlias(String certificateKeyAlias)
Sets the alias of the key entry in the keystore.

Parameters:
  `certificateKeyAlias` - the key alias

### getCertificateKeyAlias

public String getCertificateKeyAlias()
Returns the alias of the key entry in the keystore.

Returns:
  the key alias

### setCertificateKeystoreFile

public void setCertificateKeystoreFile(String certificateKeystoreFile)
Sets the path to the keystore file.

Parameters:
  `certificateKeystoreFile` - the keystore file path

### getCertificateKeystoreFile

public String getCertificateKeystoreFile()
Returns the path to the keystore file.

Returns:
  the keystore file path

### setCertificateKeystorePassword

public void setCertificateKeystorePassword(String certificateKeystorePassword)
Sets the password used to access the keystore.

Parameters:
  `certificateKeystorePassword` - the keystore password

### getCertificateKeystorePassword

public String getCertificateKeystorePassword()
Returns the password used to access the keystore.

Returns:
  the keystore password

### setCertificateKeystorePasswordFile

public void setCertificateKeystorePasswordFile(String certificateKeystorePasswordFile)
Sets the path to the file containing the keystore password.

Parameters:
  `certificateKeystorePasswordFile` - the keystore password file path

### getCertificateKeystorePasswordFile

public String getCertificateKeystorePasswordFile()
Returns the path to the file containing the keystore password.

Returns:
  the keystore password file path

### setCertificateKeystoreProvider

public void setCertificateKeystoreProvider(String certificateKeystoreProvider)
Sets the provider of the keystore.

Parameters:
  `certificateKeystoreProvider` - the keystore provider name

### getCertificateKeystoreProvider

public String getCertificateKeystoreProvider()
Returns the provider of the keystore.

Returns:
  the keystore provider name

### setCertificateKeystoreType

public void setCertificateKeystoreType(String certificateKeystoreType)
Sets the type of the keystore (e.g., JKS, PKCS12).

Parameters:
  `certificateKeystoreType` - the keystore type

### getCertificateKeystoreType

public String getCertificateKeystoreType()
Returns the type of the keystore (e.g., JKS, PKCS12).

Returns:
  the keystore type

### setCertificateKeystore

public void setCertificateKeystore(KeyStore certificateKeystore)
Sets the Java KeyStore for this certificate.

Parameters:
  `certificateKeystore` - the KeyStore instance

### getCertificateKeystore

public KeyStore getCertificateKeystore() throws IOException
Returns the Java KeyStore for this certificate. If not previously set, loads it from the configured keystore file.

Returns:
  the KeyStore instance
Throws:
  `IOException` - if the keystore cannot be loaded

### setCertificateKeyManager

public void setCertificateKeyManager(X509KeyManager certificateKeyManager)
Sets the X509KeyManager for this certificate configuration.

Parameters:
  `certificateKeyManager` - the X509KeyManager instance

### getCertificateKeyManager

public X509KeyManager getCertificateKeyManager()
Returns the X509KeyManager for this certificate configuration.

Returns:
  the X509KeyManager instance

### setCertificateChainFile

public void setCertificateChainFile(String certificateChainFile)
Sets the path to the certificate chain file used by OpenSSL.

Parameters:
  `certificateChainFile` - the path to the certificate chain file

### getCertificateChainFile

public String getCertificateChainFile()
Returns the path to the certificate chain file used by OpenSSL.

Returns:
  the certificate chain file path

### setCertificateFile

public void setCertificateFile(String certificateFile)
Sets the path to the certificate file used by OpenSSL.

Parameters:
  `certificateFile` - the path to the certificate file

### getCertificateFile

public String getCertificateFile()
Returns the path to the certificate file used by OpenSSL.

Returns:
  the certificate file path

### setCertificateKeyFile

public void setCertificateKeyFile(String certificateKeyFile)
Sets the path to the private key file used by OpenSSL.

Parameters:
  `certificateKeyFile` - the path to the private key file

### getCertificateKeyFile

public String getCertificateKeyFile()
Returns the path to the private key file used by OpenSSL.

Returns:
  the private key file path