Class PlccomMqttTlsOptions


  • public final class PlccomMqttTlsOptions
    extends Object
    TLS options for mqtts:// connections.

    The options are based on standard JDK TLS concepts so the client can be used in applications with simple default TLS needs as well as applications that authenticate with a client certificate. Expert callers can still build an SSLContext with their own trust and key material and pass it here.

    The broker certificate is checked against exactly one trust source: the PKI options, a TrustStore, or an own SSL context. Without any of them the PLCcom PKI store in the pki folder of the working directory decides, so an unknown broker certificate is rejected; the trust store of the JVM is never used implicitly.

    • Method Detail

      • defaults

        public static PlccomMqttTlsOptions defaults()
        Returns default TLS options.

        They check the broker certificate against the PLCcom PKI store in the pki folder of the working directory, which is created at the first TLS connection; see getPkiOptions().

        Returns:
        default TLS options
      • getHostnameVerifier

        public HostnameVerifier getHostnameVerifier()
        Returns the hostname verifier.
        Returns:
        custom verifier, or null to use the JDK default verifier
      • isHostnameVerificationEnabled

        public boolean isHostnameVerificationEnabled()
        Returns whether TLS hostname verification is enabled.
        Returns:
        true when the broker certificate name must match the endpoint host
      • getEnabledProtocols

        public String[] getEnabledProtocols()
        Returns the enabled TLS protocol names.
        Returns:
        defensive copy of protocol names, or null to keep the JDK socket defaults
      • getEnabledCipherSuites

        public String[] getEnabledCipherSuites()
        Returns the enabled TLS cipher suites.
        Returns:
        defensive copy of cipher suite names, or null to keep the JDK socket defaults
      • getHandshakeTimeoutMillis

        public long getHandshakeTimeoutMillis()
        Returns the TLS handshake timeout.
        Returns:
        handshake timeout in milliseconds
      • isPkiTrustDecisionActive

        public boolean isPkiTrustDecisionActive()
        Returns whether the PLCcom folder-based PKI store decides broker certificate trust for this configuration.

        That is the case when no ready PlccomMqttTlsOptions.Builder.sslContext(SSLContext) was supplied and either PlccomMqttTlsOptions.Builder.pkiOptions(PlccomMqttPkiOptions) is configured or the default PKI store applies (see getPkiOptions()), so the TrustManager created from the PKI options makes the trust decision. Per the PLCcom PKI trust rule a certificate that this decision accepts by store - the leaf lies in the trusted store, or it was issued by a certificate authority from the issuer store - is trusted as-is, so the default host-name verification must not veto it.

        Returns:
        true when the PLCcom PKI trust manager validates the broker certificate