Class AbstractConfig

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.slf4j.Logger LOG
      A logger to be shared with subclasses.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getCertPath()
      Gets the absolute path to the PEM file containing the X.509 certificate chain for the RSA private key that should be used for authentication to peers.
      io.vertx.core.net.KeyCertOptions getKeyCertOptions()
      Gets the key & certificate options derived from the key store properties.
      FileFormat getKeyFormat()
      Get the specified format of the key files.
      String getKeyPath()
      Gets the absolute path to the PEM file containing the RSA private key that will be used for authentication to peers.
      String getKeyStorePassword()
      Gets the password for the PKCS12 key store containing the private key and certificate chain that should be used for authentication to peers.
      String getKeyStorePath()
      Gets the absolute path to the PKCS12 key store containing the private key and certificate chain that will be used for authentication to peers.
      String getPathSeparator()
      Gets the character separating the segments of target addresses.
      List<String> getSecureProtocols()
      Gets the secure protocols that are enabled for TLS connections.
      io.vertx.core.net.TrustOptions getTrustOptions()
      Gets the trust options derived from the trust store properties.
      FileFormat getTrustStoreFormat()
      Get the specified format of the trust store.
      String getTrustStorePassword()
      Gets the password for accessing the PKCS12 key store containing the certificates of trusted CAs.
      String getTrustStorePath()
      Gets the path to the PKCS12 key store to load certificates of trusted CAs from.
      protected boolean isValidPort​(int port)
      Checks if a given port number is valid.
      void setCertPath​(String certPath)
      Sets the absolute path to the PEM file containing the X.509 certificate chain for the RSA private key that should be used for authentication to peers.
      void setKeyFormat​(FileFormat keyFormat)
      Specify the format of the key material explicitly.
      void setKeyPath​(String keyPath)
      Sets the absolute path to the PEM file containing the RSA private key that should be used for authentication to peers.
      void setKeyStorePassword​(String keyStorePassword)
      Sets the password for the PKCS12 key store containing the private key and certificate chain that should be used for authentication to peers.
      void setKeyStorePath​(String keyStorePath)
      Sets the absolute path to the PKCS12 key store containing the private key and certificate chain that should be used for authentication to peers.
      void setPathSeparator​(String pathSeparator)
      Sets the character separating the segments of target addresses.
      void setSecureProtocols​(List<String> enabledProtocols)
      Sets the secure protocols that are enabled for TLS connections.
      void setTrustStoreFormat​(FileFormat trustStoreFormat)
      Specify the format of the trust store explicitly.
      void setTrustStorePassword​(String trustStorePassword)
      Sets the password for accessing the PKCS12 key store containing the certificates of trusted CAs.
      void setTrustStorePath​(String trustStorePath)
      Sets the path to the PKCS12 key store to load certificates of trusted CAs from.
    • Field Detail

      • LOG

        protected final org.slf4j.Logger LOG
        A logger to be shared with subclasses.
    • Constructor Detail

      • AbstractConfig

        public AbstractConfig()
        Creates a new empty instance.
      • AbstractConfig

        public AbstractConfig​(AbstractConfig other)
        Creates a new instance from another instance.
        Parameters:
        other - The other instance. All of the other instance's properties are copied to the newly created instance.
    • Method Detail

      • isValidPort

        protected boolean isValidPort​(int port)
        Checks if a given port number is valid.
        Parameters:
        port - The port number.
        Returns:
        true if port >= 0 and port <= 65535.
      • getPathSeparator

        public final String getPathSeparator()
        Gets the character separating the segments of target addresses.
        Returns:
        The separator.
      • setPathSeparator

        public final void setPathSeparator​(String pathSeparator)
        Sets the character separating the segments of target addresses.

        The default value of this property is Constants.DEFAULT_PATH_SEPARATOR.

        Parameters:
        pathSeparator - The separator to use.
        Throws:
        NullPointerException - if the given character is null.
      • getTrustStorePath

        public final String getTrustStorePath()
        Gets the path to the PKCS12 key store to load certificates of trusted CAs from.
        Returns:
        The absolute path to the key store or null if not set.
      • setTrustStorePath

        public final void setTrustStorePath​(String trustStorePath)
        Sets the path to the PKCS12 key store to load certificates of trusted CAs from.
        Parameters:
        trustStorePath - The absolute path to the key store.
      • getTrustStorePassword

        public final String getTrustStorePassword()
        Gets the password for accessing the PKCS12 key store containing the certificates of trusted CAs.
        Returns:
        The password or null if no password is set.
        See Also:
        getTrustStorePath()
      • setTrustStorePassword

        public final void setTrustStorePassword​(String trustStorePassword)
        Sets the password for accessing the PKCS12 key store containing the certificates of trusted CAs.
        Parameters:
        trustStorePassword - The password to set.
        See Also:
        setTrustStorePath(String)
      • getTrustOptions

        public final io.vertx.core.net.TrustOptions getTrustOptions()
        Gets the trust options derived from the trust store properties.
        Returns:
        The trust options or null if trust store path is not set or not supported.
        Throws:
        IllegalArgumentException - In the case the configured trust store is not present in the file system.
      • getKeyStorePath

        public final String getKeyStorePath()
        Gets the absolute path to the PKCS12 key store containing the private key and certificate chain that will be used for authentication to peers.
        Returns:
        The path or null if no path has been set.
      • setKeyStorePath

        public final void setKeyStorePath​(String keyStorePath)
        Sets the absolute path to the PKCS12 key store containing the private key and certificate chain that should be used for authentication to peers.
        Parameters:
        keyStorePath - The path.
      • getKeyStorePassword

        public final String getKeyStorePassword()
        Gets the password for the PKCS12 key store containing the private key and certificate chain that should be used for authentication to peers.
        Returns:
        The password or null if no password has been set.
      • setKeyStorePassword

        public final void setKeyStorePassword​(String keyStorePassword)
        Sets the password for the PKCS12 key store containing the private key and certificate chain that should be used for authentication to peers.
        Parameters:
        keyStorePassword - The password.
      • getKeyCertOptions

        public final io.vertx.core.net.KeyCertOptions getKeyCertOptions()
        Gets the key & certificate options derived from the key store properties.
        Returns:
        The options or null if key store path or key path and cert path are not set or not supported.
        Throws:
        IllegalArgumentException - In the case any of the configured files is not present in the file system.
      • getCertPath

        public final String getCertPath()
        Gets the absolute path to the PEM file containing the X.509 certificate chain for the RSA private key that should be used for authentication to peers.
        Returns:
        The path or null if no path has been set.
      • setCertPath

        public final void setCertPath​(String certPath)
        Sets the absolute path to the PEM file containing the X.509 certificate chain for the RSA private key that should be used for authentication to peers.

        In order to use a non-RSA type key (e.g. an ECC based key) a PKCS12 key store containing the key and certificate chain should be configured by means of the setKeyStorePath(String) and setKeyStorePassword(String) methods.

        Parameters:
        certPath - The path.
      • getKeyPath

        public final String getKeyPath()
        Gets the absolute path to the PEM file containing the RSA private key that will be used for authentication to peers.
        Returns:
        The path or null if no path has been set.
      • setKeyPath

        public final void setKeyPath​(String keyPath)
        Sets the absolute path to the PEM file containing the RSA private key that should be used for authentication to peers.

        In order to use a non-RSA type key (e.g. an ECC based key) a PKCS12 key store containing the key should be configured by means of the setKeyStorePath(String) and setKeyStorePassword(String) methods.

        Parameters:
        keyPath - The path.
      • setTrustStoreFormat

        public final void setTrustStoreFormat​(FileFormat trustStoreFormat)
        Specify the format of the trust store explicitly.
        Parameters:
        trustStoreFormat - The format to use when reading the trust store, may be null to trigger auto detection.
      • getTrustStoreFormat

        public final FileFormat getTrustStoreFormat()
        Get the specified format of the trust store.
        Returns:
        The format or null if auto-detection should be tried.
      • setKeyFormat

        public final void setKeyFormat​(FileFormat keyFormat)
        Specify the format of the key material explicitly.
        Parameters:
        keyFormat - The format to use when reading the key material, may be null to trigger auto detection.
      • getKeyFormat

        public final FileFormat getKeyFormat()
        Get the specified format of the key files.
        Returns:
        The format or null if auto-detection should be tried.
      • getSecureProtocols

        public final List<String> getSecureProtocols()
        Gets the secure protocols that are enabled for TLS connections.

        By default, only TLSv1.2 is enabled. Please refer to the vert.x documentation for a list of supported values.

        Returns:
        The enabled protocols.
      • setSecureProtocols

        public final void setSecureProtocols​(List<String> enabledProtocols)
        Sets the secure protocols that are enabled for TLS connections.

        By default, only TLSv1.2 is enabled. Please refer to the vert.x documentation for a list of supported values.

        Note that setting this property to an empty list effectively disables TLS altogether.

        Parameters:
        enabledProtocols - The protocols.
        Throws:
        NullPointerException - if protocols is null.