Class SslContextProvider.Builder

java.lang.Object
com.clickhouse.client.api.internal.SslContextProvider.Builder
Enclosing class:
SslContextProvider

public class SslContextProvider.Builder extends Object
Assembles an SSLContext from independently configured key and trust material.

The two are orthogonal:

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • clientCertificate

      public SslContextProvider.Builder clientCertificate(String clientCert, String clientKey)
      Sets the client certificate and key applied for mutual TLS. Independent of the trust strategy.
      Parameters:
      clientCert - client certificate, file path or PEM content; may be null
      clientKey - client private key, file path or PEM content; may be null
      Returns:
      this builder
    • trustAllCertificates

      public SslContextProvider.Builder trustAllCertificates()
      Trust strategy: accept any server certificate without validating it (no server identity check).
      Returns:
      this builder
    • trustStore

      public SslContextProvider.Builder trustStore(String path, String password, String type)
      Trust strategy: validate the server certificate against the given trust store.
      Parameters:
      path - trust store file path
      password - trust store password; may be null
      type - trust store type; when null or empty the JVM default type is used
      Returns:
      this builder
    • rootCertificate

      public SslContextProvider.Builder rootCertificate(String rootCertificate)
      Trust strategy: validate the server certificate against the given CA certificate.
      Parameters:
      rootCertificate - CA certificate, file path or PEM content; may be null
      Returns:
      this builder
    • build

      public SSLContext build()
      Builds the SSL context from the configured key and trust material.
      Returns:
      SSL context
      Throws:
      ClientMisconfigurationException - when the context cannot be created