Class PlccomMqttTlsOptions.Builder

    • Method Detail

      • keyStore

        public PlccomMqttTlsOptions.Builder keyStore​(KeyStore value,
                                                     char[] password)
        Sets the client certificate KeyStore used for mutual TLS.

        This is the convenient Paho-style path for brokers that request or require a client certificate during the TLS handshake. The KeyStore must contain the client's private key and certificate chain. When a ready sslContext(SSLContext) is supplied, that context takes precedence over this KeyStore setting.

        Parameters:
        value - KeyStore containing the client private key and certificate chain
        password - private-key password, or null when the key entry has no password
        Returns:
        this builder
        Throws:
        NullPointerException - if value is null
      • trustStore

        public PlccomMqttTlsOptions.Builder trustStore​(KeyStore value)
        Sets the TrustStore used to validate the broker certificate.

        Supplying a TrustStore is the convenient counterpart to keyStore(KeyStore, char[]). It lets applications trust a private CA or test certificate without creating an SSLContext manually. The TrustStore is the application's own trust decision: the broker certificate is checked with the standard JDK trust manager, the host name as set with hostnameVerificationEnabled(boolean), and the PLCcom PKI store is not used. Configured pkiOptions(PlccomMqttPkiOptions) take precedence. When neither is configured, the PLCcom PKI store in the pki folder of the working directory decides, not the trust store of the JVM.

        Parameters:
        value - TrustStore for broker certificates
        Returns:
        this builder
        Throws:
        NullPointerException - if value is null
      • pkiOptions

        public PlccomMqttTlsOptions.Builder pkiOptions​(PlccomMqttPkiOptions value)
        Sets the PLCcom file-based PKI options for broker certificate validation.

        When PKI options are configured, they provide the TrustManager used during the TLS handshake. A ready sslContext(SSLContext) still takes precedence for expert callers. Without PKI options, a TrustStore or an SSL context, default options with the PKI store in the pki folder of the working directory apply.

        Parameters:
        value - PKI options, or null to use the TrustStore or the default PKI store
        Returns:
        this builder
      • hostnameVerifier

        public PlccomMqttTlsOptions.Builder hostnameVerifier​(HostnameVerifier value)
        Sets the hostname verifier.
        Parameters:
        value - custom verifier, or null to use the JDK default verifier
        Returns:
        this builder
      • hostnameVerificationEnabled

        public PlccomMqttTlsOptions.Builder hostnameVerificationEnabled​(boolean value)
        Enables or disables TLS hostname verification.
        Parameters:
        value - true to verify the broker certificate against the endpoint host
        Returns:
        this builder
      • build

        public PlccomMqttTlsOptions build()
        Builds immutable TLS options.
        Returns:
        TLS options
        Throws:
        NullPointerException - if a configured protocol or cipher suite name is null
        IllegalArgumentException - if the handshake timeout is not positive, or a configured protocol or cipher suite list is empty or contains a blank value