Class Tls

java.lang.Object
io.helidon.common.tls.Tls
All Implemented Interfaces:
RuntimeType.Api<TlsConfig>

public class Tls extends Object implements RuntimeType.Api<TlsConfig>
TLS configuration - common for server and client.
  • Field Details

    • ENDPOINT_IDENTIFICATION_HTTPS

      public static final String ENDPOINT_IDENTIFICATION_HTTPS
      HTTPS endpoint identification algorithm, verifies certificate cn against host name.
      See Also:
    • ENDPOINT_IDENTIFICATION_NONE

      public static final String ENDPOINT_IDENTIFICATION_NONE
      Disable host name verification.
      See Also:
  • Method Details

    • builder

      public static TlsConfig.Builder builder()
      A new fluent API builder.
      Returns:
      builder
    • create

      public static Tls create(Config config)
      Create TLS configuration from config.
      Parameters:
      config - located on the node of the tls configuration (usually this is ssl)
      Returns:
      a new TLS configuration
    • create

      public static Tls create(TlsConfig tlsConfig)
      Create TLS with custom configuration.
      Parameters:
      tlsConfig - TLS configuration
      Returns:
      a new TLS instance
    • create

      public static Tls create(Consumer<TlsConfig.Builder> consumer)
      Create TLS customizing its configuration.
      Parameters:
      consumer - configuration builder consumer
      Returns:
      a new TLS instance
    • prototype

      public TlsConfig prototype()
      Description copied from interface: RuntimeType.Api
      The prototype as it was received when creating this runtime object instance.
      Specified by:
      prototype in interface RuntimeType.Api<TlsConfig>
      Returns:
      prototype object used to create this instance
    • newEngine

      public final SSLEngine newEngine()
      SSL engine from this configuration.
      Returns:
      SSL Engine
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • createServerSocket

      public SSLServerSocket createServerSocket()
      Create a TLS socket for a server.
      Returns:
      a new server socket ready for TLS communication
    • createSocket

      public SSLSocket createSocket(List<String> alpnProtocols, Socket socket, InetSocketAddress address)
      Create a SSLSocket for the chosen protocol and the given socket.
      Parameters:
      alpnProtocols - protocol(s) to use (order is significant)
      socket - existing socket
      address - where SSL socket will connect
      Returns:
      a new socket ready for TLS communication
    • sslContext

      public SSLContext sslContext()
      Provides the SSL context.
      Returns:
      SSL context
    • sslParameters

      public SSLParameters sslParameters()
      SSL parameters.
      Returns:
      SSL parameters
    • reload

      public void reload(Tls tls)
      Reload reloadable TlsReloadableComponents with the new configuration.
      Parameters:
      tls - new TLS configuration
    • enabled

      public boolean enabled()
      Whether this TLS configuration is enabled or not.
      Returns:
      whether TLS is enabled