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

  • 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
    • createSocket

      public SSLSocket createSocket(List<String> alpnProtocols, Socket socket, String tlsPeerHost, int tlsPeerPort)
      Create a TLS socket using a logical peer identity and the configured server names.
      Parameters:
      alpnProtocols - protocol(s) to use (order is significant)
      socket - existing socket
      tlsPeerHost - TLS peer host for SNI and endpoint identification
      tlsPeerPort - TLS peer port for endpoint identification
      Returns:
      a new socket ready for TLS communication
    • createSocket

      public SSLSocket createSocket(List<String> alpnProtocols, Socket socket, String tlsPeerHost, int tlsPeerPort, List<SNIServerName> serverNamesOverride)
      Create a SSLSocket for the chosen protocol and the given socket.
      Parameters:
      alpnProtocols - protocol(s) to use (order is significant)
      socket - existing socket
      tlsPeerHost - TLS peer host for SNI and endpoint identification
      tlsPeerPort - TLS peer port for endpoint identification
      serverNamesOverride - server names to use for this socket
      Returns:
      a new socket ready for TLS communication
    • sslContext

      public SSLContext sslContext()
      Provides the SSL context captured when this TLS instance was created.
      Returns:
      SSL context
    • sslParameters

      public SSLParameters sslParameters()
      SSL parameters. The returned parameters are a copy, and changing them does not modify this TLS configuration.
      Returns:
      SSL parameters copy
    • reload

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

      public void reload(TlsMaterial material)
      Reload reloadable TlsReloadableComponents with new key and trust material.
      Parameters:
      material - new TLS material
    • generation

      public long generation()
      Generation of TLS material changes reported by the configured TlsManager.generation().

      For enabled TLS, this method returns the configured manager's generation. The generation after the manager's first successful initialization is zero. A custom manager that inherits the compatibility default continues to report zero after material changes and may therefore lag behind its current material. When TLS is disabled, this method also returns zero.

      Returns:
      current TLS material generation
    • enabled

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