Enum SSLMode

java.lang.Object
java.lang.Enum<SSLMode>
com.clickhouse.client.api.enums.SSLMode
All Implemented Interfaces:
Serializable, Comparable<SSLMode>, java.lang.constant.Constable

public enum SSLMode extends Enum<SSLMode>
Defines how strictly the client verifies a server identity when a secure protocol is used.

The mode affects only connections that are already using a secure transport (for example, an https:// endpoint). It does not enable encryption for plain protocols - an http:// endpoint stays unencrypted whatever the mode is.

Modes from the least to the most strict:

  • DISABLED - SSL is not used. Plain protocols only.
  • TRUST - the hostname is not verified and any server certificate is accepted, which is susceptible to MITM attacks - use that only for testing or in fully trusted environments. A configured trust store or CA certificate has no effect in this mode and is ignored (a warning is logged); a configured client certificate/key is still applied for mTLS.
  • VERIFY_CA - the server certificate chain is validated against the trust material (default JVM trust store, configured trust store, or a CA certificate), but the hostname is not checked against the certificate.
  • STRICT - full verification (default): certificate chain is validated and the hostname must match the certificate.
  • Enum Constant Details

    • DISABLED

      public static final SSLMode DISABLED
      SSL is not used. Connection is not encrypted. Doesn't work with HTTPS. Reserved for TCP where protocol doesn't define encryption.
    • TRUST

      public static final SSLMode TRUST
      The hostname is not verified and any server certificate is accepted. A configured trust store or CA certificate has no effect in this mode and is ignored (a warning is logged). A configured client certificate/key is still applied for mTLS.
    • VERIFY_CA

      public static final SSLMode VERIFY_CA
      Server certificate chain is validated, but the hostname is not verified.
    • STRICT

      public static final SSLMode STRICT
      Full verification: certificate chain is validated and the hostname must match the certificate. Default mode for HTTPs.
  • Method Details

    • values

      public static SSLMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static SSLMode valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • fromValue

      public static SSLMode fromValue(String value)
      Case-insensitive variant of valueOf(String).
      Parameters:
      value - mode name in any case
      Returns:
      matching mode
      Throws:
      IllegalArgumentException - when the value does not match any mode