java.lang.Object
org.apache.qpid.protonj2.client.transport.netty4.SslSupport

public final class SslSupport extends Object
Static class that provides various utility methods used by Transport implementations.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static SSLContext
    Create a new SSLContext using the options specific in the given TransportOptions instance.
    static SSLEngine
    createJdkSslEngine(String host, int port, SSLContext context, SslOptions options)
    Create a new JDK SSLEngine instance in client mode from the given SSLContext and TransportOptions instances.
    static io.netty.handler.ssl.SslContext
    Create a new Netty SslContext using the options specific in the given TransportOptions instance.
    static SSLEngine
    createOpenSslEngine(io.netty.buffer.ByteBufAllocator allocator, String host, int port, io.netty.handler.ssl.SslContext context, SslOptions options)
    Create a new OpenSSL SSLEngine instance in client mode from the given SSLContext and TransportOptions instances.
    static io.netty.handler.ssl.SslHandler
    createSslHandler(io.netty.buffer.ByteBufAllocator allocator, String host, int port, SslOptions options)
    Creates a Netty SslHandler instance for use in Transports that require an SSL encoder / decoder.
    static boolean
    Determines if Netty OpenSSL support is available and applicable based on the configuration in the given TransportOptions instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SslSupport

      public SslSupport()
  • Method Details

    • isOpenSSLPossible

      public static boolean isOpenSSLPossible(SslOptions options)
      Determines if Netty OpenSSL support is available and applicable based on the configuration in the given TransportOptions instance.
      Parameters:
      options - The configuration of the Transport being created.
      Returns:
      true if OpenSSL support is available and usable given the requested configuration.
    • createSslHandler

      public static io.netty.handler.ssl.SslHandler createSslHandler(io.netty.buffer.ByteBufAllocator allocator, String host, int port, SslOptions options) throws Exception
      Creates a Netty SslHandler instance for use in Transports that require an SSL encoder / decoder. If the given options contain an SSLContext override, this will be used directly when creating the handler. If they do not, an SSLContext will first be created using the other option values.
      Parameters:
      allocator - The Netty Buffer Allocator to use when Netty resources need to be created.
      host - the host name or IP address that this transport connects to.
      port - the port on the given host that this transport connects to.
      options - The SSL options object to build the SslHandler instance from.
      Returns:
      a new SslHandler that is configured from the given options.
      Throws:
      Exception - if an error occurs while creating the SslHandler instance.
    • createJdkSslContext

      public static SSLContext createJdkSslContext(SslOptions options) throws Exception
      Create a new SSLContext using the options specific in the given TransportOptions instance.
      Parameters:
      options - the configured options used to create the SSLContext.
      Returns:
      a new SSLContext instance.
      Throws:
      Exception - if an error occurs while creating the context.
    • createJdkSslEngine

      public static SSLEngine createJdkSslEngine(String host, int port, SSLContext context, SslOptions options) throws Exception
      Create a new JDK SSLEngine instance in client mode from the given SSLContext and TransportOptions instances.
      Parameters:
      host - the host name or IP address that this transport connects to.
      port - the port on the given host that this transport connects to.
      context - the SSLContext to use when creating the engine.
      options - the TransportOptions to use to configure the new SSLEngine.
      Returns:
      a new SSLEngine instance in client mode.
      Throws:
      Exception - if an error occurs while creating the new SSLEngine.
    • createOpenSslContext

      public static io.netty.handler.ssl.SslContext createOpenSslContext(SslOptions options) throws Exception
      Create a new Netty SslContext using the options specific in the given TransportOptions instance.
      Parameters:
      options - the configured options used to create the SslContext.
      Returns:
      a new SslContext instance.
      Throws:
      Exception - if an error occurs while creating the context.
    • createOpenSslEngine

      public static SSLEngine createOpenSslEngine(io.netty.buffer.ByteBufAllocator allocator, String host, int port, io.netty.handler.ssl.SslContext context, SslOptions options) throws Exception
      Create a new OpenSSL SSLEngine instance in client mode from the given SSLContext and TransportOptions instances.
      Parameters:
      allocator - the Netty ByteBufAllocator to use to create the OpenSSL engine
      host - the host name or IP address that this transport connects to.
      port - the port on the given host that this transport connects to.
      context - the Netty SslContext to use when creating the engine.
      options - the TransportOptions to use to configure the new SSLEngine.
      Returns:
      a new Netty managed SSLEngine instance in client mode.
      Throws:
      Exception - if an error occurs while creating the new SSLEngine.