Class SslContextProvider.Builder
java.lang.Object
com.clickhouse.client.api.internal.SslContextProvider.Builder
- Enclosing class:
- SslContextProvider
Assembles an
SSLContext from independently configured key and trust material.
The two are orthogonal:
clientCertificate(String, String)sets the client certificate/key applied for mTLS; it is independent of how the server certificate is verified.trustAllCertificates(),trustStore(String, String, String)androotCertificate(String)are mutually exclusive trust strategies; the last one set wins. When none is set, the JVM default trust store is used.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the SSL context from the configured key and trust material.clientCertificate(String clientCert, String clientKey) Sets the client certificate and key applied for mutual TLS.rootCertificate(String rootCertificate) Trust strategy: validate the server certificate against the given CA certificate.Trust strategy: accept any server certificate without validating it (no server identity check).trustStore(String path, String password, String type) Trust strategy: validate the server certificate against the given trust store.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
clientCertificate
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 nullclientKey- client private key, file path or PEM content; may be null- Returns:
- this builder
-
trustAllCertificates
Trust strategy: accept any server certificate without validating it (no server identity check).- Returns:
- this builder
-
trustStore
Trust strategy: validate the server certificate against the given trust store.- Parameters:
path- trust store file pathpassword- trust store password; may be nulltype- trust store type; when null or empty the JVM default type is used- Returns:
- this builder
-
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
Builds the SSL context from the configured key and trust material.- Returns:
- SSL context
- Throws:
ClientMisconfigurationException- when the context cannot be created
-