io.undertow.protocols.ssl

## Class ALPNHackSSLEngine

- java.lang.Object
- - javax.net.ssl.SSLEngine
  - - io.undertow.protocols.ssl.ALPNHackSSLEngine

    public class ALPNHackSSLEngine
    extends SSLEngine

SSLEngine wrapper that provides some super hacky ALPN support on JDK8. Even though this is a nasty hack that relies on JDK internals it is still preferable to modifying the boot class path. It is expected to work with all JDK8 versions, however this cannot be guaranteed if the SSL internals are changed in an incompatible way. This class will go away once JDK8 is no longer in use.

Author:
  Stuart Douglas

### Field Summary

Fields
`static boolean` `ENABLED`

### Constructor Summary

Constructors
Constructor and Description
`ALPNHackSSLEngine(SSLEngine delegate)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `beginHandshake()`
`void` `closeInbound()`
`void` `closeOutbound()`
`List<String>` `getApplicationProtocols()` JDK8 ALPN hack support method.
`Runnable` `getDelegatedTask()`
`String[]` `getEnabledCipherSuites()`
`String[]` `getEnabledProtocols()`
`boolean` `getEnableSessionCreation()`
`SSLEngineResult.HandshakeStatus` `getHandshakeStatus()`
`boolean` `getNeedClientAuth()`
`String` `getSelectedApplicationProtocol()` JDK8 ALPN hack support method.
`SSLSession` `getSession()`
`String[]` `getSupportedCipherSuites()`
`String[]` `getSupportedProtocols()`
`boolean` `getUseClientMode()`
`boolean` `getWantClientAuth()`
`static boolean` `isEnabled(SSLEngine engine)`
`boolean` `isInboundDone()`
`boolean` `isOutboundDone()`
`void` `setApplicationProtocols(List<String> applicationProtocols)` JDK8 ALPN hack support method.
`void` `setEnabledCipherSuites(String[] strings)`
`void` `setEnabledProtocols(String[] strings)`
`void` `setEnableSessionCreation(boolean b)`
`void` `setNeedClientAuth(boolean b)`
`void` `setUseClientMode(boolean b)`
`void` `setWantClientAuth(boolean b)`
`SSLEngineResult` `unwrap(ByteBuffer dataToUnwrap, ByteBuffer[] byteBuffers, int i, int i1)`
`SSLEngineResult` `wrap(ByteBuffer[] byteBuffers, int i, int i1, ByteBuffer byteBuffer)`

### Methods inherited from class javax.net.ssl.SSLEngine

`getApplicationProtocol, getHandshakeApplicationProtocol, getHandshakeApplicationProtocolSelector, getHandshakeSession, getPeerHost, getPeerPort, getSSLParameters, setHandshakeApplicationProtocolSelector, setSSLParameters, unwrap, unwrap, wrap, wrap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ENABLED

    public static final boolean ENABLED

### Constructor Detail

#### ALPNHackSSLEngine

    public ALPNHackSSLEngine(SSLEngine delegate)

### Method Detail

#### isEnabled

    public static boolean isEnabled(SSLEngine engine)

#### wrap

    public SSLEngineResult wrap(ByteBuffer[] byteBuffers,
                                int i,
                                int i1,
                                ByteBuffer byteBuffer)
                         throws SSLException

Specified by:
  `wrap` in class `SSLEngine`
Throws:
  `SSLException`

#### unwrap

    public SSLEngineResult unwrap(ByteBuffer dataToUnwrap,
                                  ByteBuffer[] byteBuffers,
                                  int i,
                                  int i1)
                           throws SSLException

Specified by:
  `unwrap` in class `SSLEngine`
Throws:
  `SSLException`

#### getDelegatedTask

    public Runnable getDelegatedTask()

Specified by:
  `getDelegatedTask` in class `SSLEngine`

#### closeInbound

    public void closeInbound()
                      throws SSLException

Specified by:
  `closeInbound` in class `SSLEngine`
Throws:
  `SSLException`

#### isInboundDone

    public boolean isInboundDone()

Specified by:
  `isInboundDone` in class `SSLEngine`

#### closeOutbound

    public void closeOutbound()

Specified by:
  `closeOutbound` in class `SSLEngine`

#### isOutboundDone

    public boolean isOutboundDone()

Specified by:
  `isOutboundDone` in class `SSLEngine`

#### getSupportedCipherSuites

    public String[] getSupportedCipherSuites()

Specified by:
  `getSupportedCipherSuites` in class `SSLEngine`

#### getEnabledCipherSuites

    public String[] getEnabledCipherSuites()

Specified by:
  `getEnabledCipherSuites` in class `SSLEngine`

#### setEnabledCipherSuites

    public void setEnabledCipherSuites(String[] strings)

Specified by:
  `setEnabledCipherSuites` in class `SSLEngine`

#### getSupportedProtocols

    public String[] getSupportedProtocols()

Specified by:
  `getSupportedProtocols` in class `SSLEngine`

#### getEnabledProtocols

    public String[] getEnabledProtocols()

Specified by:
  `getEnabledProtocols` in class `SSLEngine`

#### setEnabledProtocols

    public void setEnabledProtocols(String[] strings)

Specified by:
  `setEnabledProtocols` in class `SSLEngine`

#### getSession

    public SSLSession getSession()

Specified by:
  `getSession` in class `SSLEngine`

#### beginHandshake

    public void beginHandshake()
                        throws SSLException

Specified by:
  `beginHandshake` in class `SSLEngine`
Throws:
  `SSLException`

#### getHandshakeStatus

    public SSLEngineResult.HandshakeStatus getHandshakeStatus()

Specified by:
  `getHandshakeStatus` in class `SSLEngine`

#### setUseClientMode

    public void setUseClientMode(boolean b)

Specified by:
  `setUseClientMode` in class `SSLEngine`

#### getUseClientMode

    public boolean getUseClientMode()

Specified by:
  `getUseClientMode` in class `SSLEngine`

#### setNeedClientAuth

    public void setNeedClientAuth(boolean b)

Specified by:
  `setNeedClientAuth` in class `SSLEngine`

#### getNeedClientAuth

    public boolean getNeedClientAuth()

Specified by:
  `getNeedClientAuth` in class `SSLEngine`

#### setWantClientAuth

    public void setWantClientAuth(boolean b)

Specified by:
  `setWantClientAuth` in class `SSLEngine`

#### getWantClientAuth

    public boolean getWantClientAuth()

Specified by:
  `getWantClientAuth` in class `SSLEngine`

#### setEnableSessionCreation

    public void setEnableSessionCreation(boolean b)

Specified by:
  `setEnableSessionCreation` in class `SSLEngine`

#### getEnableSessionCreation

    public boolean getEnableSessionCreation()

Specified by:
  `getEnableSessionCreation` in class `SSLEngine`

#### setApplicationProtocols

    public void setApplicationProtocols(List<String> applicationProtocols)

JDK8 ALPN hack support method. These methods will be removed once JDK8 ALPN support is no longer required

Parameters:
  `applicationProtocols` -

#### getApplicationProtocols

    public List<String> getApplicationProtocols()

JDK8 ALPN hack support method. These methods will be removed once JDK8 ALPN support is no longer required

#### getSelectedApplicationProtocol

    public String getSelectedApplicationProtocol()

JDK8 ALPN hack support method. These methods will be removed once JDK8 ALPN support is no longer required