In theory this is not a perfect solution to the HTTP/2 cipher strength issue, but in practice it should be sufficient as any RFC compliant implementation should be able to negotiate TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
| Modifier and Type | Field and Description |
|---|---|
| private final SSLEngine | |
| private boolean | |
| private final Runnable | |
| private static final SSLEngineResult |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | beginHandshake()
Implements abstract javax. Initiates handshaking (initial or renegotiation) on this SSLEngine. |
| public void | closeInbound()
Implements abstract javax. Signals that no more inbound network data will be sent
to this |
| public void | closeOutbound()
Implements abstract javax. Signals that no more outbound application data will be sent
on this |
| public Runnable | getDelegatedTask()
Implements abstract javax. Returns a delegated |
| public String[] | getEnabledCipherSuites()
Implements abstract javax. Returns the names of the SSL cipher suites which are currently enabled for use on this engine. |
| public String[] | getEnabledProtocols()
Implements abstract javax. Returns the names of the protocol versions which are currently
enabled for use with this |
| public boolean | getEnableSessionCreation()
Implements abstract javax. Returns true if new SSL sessions may be established by this engine. |
| public SSLSession | getHandshakeSession()
Overrides javax. Returns the |
| public SSLEngineResult. | getHandshakeStatus()
Implements abstract javax. Returns the current handshake status for this |
| public boolean | getNeedClientAuth()
Implements abstract javax. Returns true if the engine will require client authentication. |
| public String | |
| public int | |
| public SSLSession | getSession()
Implements abstract javax. Returns the |
| public SSLParameters | getSSLParameters()
Overrides javax. Returns the SSLParameters in effect for this SSLEngine. |
| public String[] | getSupportedCipherSuites()
Implements abstract javax. Returns the names of the cipher suites which could be enabled for use on this engine. |
| public String[] | getSupportedProtocols()
Implements abstract javax. Returns the names of the protocols which could be enabled for use
with this |
| public boolean | getUseClientMode()
Implements abstract javax. Returns true if the engine is set to use client mode when handshaking. |
| public boolean | getWantClientAuth()
Implements abstract javax. Returns true if the engine will request client authentication. |
| public boolean | isInboundDone()
Implements abstract javax. Returns whether |
| public boolean | isOutboundDone()
Implements abstract javax. Returns whether |
| private void | |
| public void | setEnabledCipherSuites(final String[]
Names of all the cipher suites to enable strings)Implements abstract javax. Sets the cipher suites enabled for use on this engine. |
| public void | setEnabledProtocols(final String[]
Names of all the protocols to enable. strings)Implements abstract javax. Set the protocol versions enabled for use on this engine. |
| public void | setEnableSessionCreation(final boolean
true indicates that sessions may be created; this
is the default. false indicates that an existing session
must be resumed b)Implements abstract javax. Controls whether new SSL sessions may be established by this engine. |
| public void | setNeedClientAuth(final boolean
set to true if client authentication is required,
or false if no client authentication is desired. b)Implements abstract javax. Configures the engine to require client authentication. |
| public void | setSSLParameters(final SSLParameters
the parameters sslParameters)Overrides javax. Applies SSLParameters to this engine. |
| public void | setUseClientMode(boolean
true if the engine should start its handshaking
in "client" mode b)Implements abstract javax. Configures the engine to use client (or server) mode when handshaking. |
| public void | setWantClientAuth(final boolean
set to true if client authentication is requested,
or false if no client authentication is desired. b)Implements abstract javax. Configures the engine to request client authentication. |
| public SSLEngineResult | unwrap(ByteBuffer
a src, ByteBuffer ByteBuffer containing inbound network data.a dst)ByteBuffer to hold inbound application data.Overrides javax. Attempts to decode SSL/TLS/DTLS network data into a plaintext application data buffer. |
| public SSLEngineResult | unwrap(ByteBuffer
a src, ByteBuffer[] ByteBuffer containing inbound network data.an array of dsts)ByteBuffers to hold inbound
application data.Overrides javax. Attempts to decode SSL/TLS/DTLS network data into a sequence of plaintext application data buffers. |
| public SSLEngineResult | unwrap(ByteBuffer
a byteBuffer, ByteBuffer[] ByteBuffer containing inbound network data.an array of byteBuffers, int ByteBuffers to hold inbound
application data.The offset within the buffer array of the first buffer from
which bytes are to be transferred; it must be non-negative
and no larger than i, int dsts.length.The maximum number of buffers to be accessed; it must be
non-negative and no larger than
i1)dsts.length - offset.Implements abstract javax. Attempts to decode SSL/TLS/DTLS network data into a subsequence of plaintext application data buffers. |
| public SSLEngineResult | wrap(ByteBuffer
a src, ByteBuffer ByteBuffer containing outbound application dataa dst)ByteBuffer to hold outbound network dataOverrides javax. Attempts to encode a buffer of plaintext application data into SSL/TLS/DTLS network data. |
| public SSLEngineResult | wrap(ByteBuffer[]
an array of srcs, ByteBuffer ByteBuffers containing the
outbound application dataa dst)ByteBuffer to hold outbound network dataOverrides javax. Attempts to encode plaintext bytes from a sequence of data buffers into SSL/TLS/DTLS network data. |
| public SSLEngineResult | wrap(ByteBuffer[]
an array of srcs, int ByteBuffers containing the
outbound application dataThe offset within the buffer array of the first buffer from
which bytes are to be retrieved; it must be non-negative
and no larger than off, int srcs.lengthThe maximum number of buffers to be accessed; it must be
non-negative and no larger than
len, ByteBuffer srcs.length - offseta dst)ByteBuffer to hold outbound network dataImplements abstract javax. Attempts to encode plaintext bytes from a subsequence of data buffers into SSL/TLS/DTLS network data. |
| delegate | back to summary |
|---|---|
| private final SSLEngine delegate | |
| done | back to summary |
|---|---|
| private boolean done | |
| invalidAlpnRunnable | back to summary |
|---|---|
| private final Runnable invalidAlpnRunnable | |
| UNDERFLOW_RESULT | back to summary |
|---|---|
| private static final SSLEngineResult UNDERFLOW_RESULT | |
| ALPNLimitingSSLEngine | back to summary |
|---|---|
| public ALPNLimitingSSLEngine(SSLEngine delegate, Runnable invalidAlpnRunnable) | |
| beginHandshake | back to summary |
|---|---|
| public void beginHandshake() throws SSLException Implements abstract javax. Doc from javax. Initiates handshaking (initial or renegotiation) on this SSLEngine.
This method is not needed for the initial handshake, as the
Note that the peer may also request a session renegotiation with
this
Unlike the To force a complete SSL/TLS/DTLS session renegotiation, the current session should be invalidated prior to calling this method.
Some protocols may not support multiple handshakes on an existing
engine and may throw an
| |
| closeInbound | back to summary |
|---|---|
| public void closeInbound() throws SSLException Implements abstract javax. Doc from javax. Signals that no more inbound network data will be sent
to this
If the application initiated the closing process by calling
But if the application did not initiate the closure process, or if the circumstances above do not apply, this method should be called whenever the end of the SSL/TLS/DTLS data stream is reached. This ensures closure of the inbound side, and checks that the peer followed the SSL/TLS/DTLS close procedure properly, thus detecting possible truncation attacks. This method is idempotent: if the inbound side has already been closed, this method does not do anything.
| |
| closeOutbound | back to summary |
|---|---|
| public void closeOutbound() Implements abstract javax. Doc from javax. Signals that no more outbound application data will be sent
on this This method is idempotent: if the outbound side has already been closed, this method does not do anything.
| |
| getDelegatedTask | back to summary |
|---|---|
| public Runnable getDelegatedTask() Implements abstract javax. Doc from javax. Returns a delegated
Delegated tasks run in the A call to this method will return each outstanding task exactly once. Multiple delegated tasks can be run in parallel. | |
| getEnabledCipherSuites | back to summary |
|---|---|
| public String[] getEnabledCipherSuites() Implements abstract javax. Doc from javax. Returns the names of the SSL cipher suites which are currently enabled for use on this engine. When an SSLEngine is first created, all enabled cipher suites support a minimum quality of service. Thus, in some environments this value might be empty. Note that even if a suite is enabled, it may never be used. This can occur if the peer does not support it, or its use is restricted, or the requisite certificates (and private keys) for the suite are not available, or an anonymous suite is enabled but authentication is required. The returned array includes cipher suites from the list of standard cipher suite names in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification, and may also include other cipher suites that the provider supports. | |
| getEnabledProtocols | back to summary |
|---|---|
| public String[] getEnabledProtocols() Implements abstract javax. Doc from javax. Returns the names of the protocol versions which are currently
enabled for use with this Note that even if a protocol is enabled, it may never be used. This can occur if the peer does not support the protocol, or its use is restricted, or there are no enabled cipher suites supported by the protocol. | |
| getEnableSessionCreation | back to summary |
|---|---|
| public boolean getEnableSessionCreation() Implements abstract javax. Doc from javax. Returns true if new SSL sessions may be established by this engine.
| |
| getHandshakeSession | back to summary |
|---|---|
| public SSLSession getHandshakeSession() Overrides javax. Doc from javax. Returns the
TLS/DTLS protocols may negotiate parameters that are needed when using
an instance of this class, but before the
This method provides early access to the
| |
| getHandshakeStatus | back to summary |
|---|---|
| public SSLEngineResult. Implements abstract javax. Doc from javax. Returns the current handshake status for this
| |
| getNeedClientAuth | back to summary |
|---|---|
| public boolean getNeedClientAuth() Implements abstract javax. Doc from javax. Returns true if the engine will require client authentication. This option is only useful to engines in the server mode.
| |
| getPeerHost | back to summary |
|---|---|
| public String getPeerHost() Overrides javax. Doc from javax. Returns the host name of the peer. Note that the value is not authenticated, and should not be relied upon. | |
| getPeerPort | back to summary |
|---|---|
| public int getPeerPort() Overrides javax. Doc from javax. Returns the port number of the peer. Note that the value is not authenticated, and should not be relied upon.
| |
| getSession | back to summary |
|---|---|
| public SSLSession getSession() Implements abstract javax. Doc from javax. Returns the These can be long-lived, and frequently correspond to an entire login session for some user. The session specifies a particular cipher suite which is being actively used by all connections in that session, as well as the identities of the session's client and server.
Unlike Until the initial handshake has completed, this method returns a session object which reports an invalid cipher suite of "SSL_NULL_WITH_NULL_NULL".
| |
| getSSLParameters | back to summary |
|---|---|
| public SSLParameters getSSLParameters() Overrides javax. Doc from javax. Returns the SSLParameters in effect for this SSLEngine. The ciphersuites and protocols of the returned SSLParameters are always non-null.
| |
| getSupportedCipherSuites | back to summary |
|---|---|
| public String[] getSupportedCipherSuites() Implements abstract javax. Doc from javax. Returns the names of the cipher suites which could be enabled for use on this engine. Normally, only a subset of these will actually be enabled by default, since this list may include cipher suites which do not meet quality of service requirements for those defaults. Such cipher suites might be useful in specialized applications. The returned array includes cipher suites from the list of standard cipher suite names in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification, and may also include other cipher suites that the provider supports. | |
| getSupportedProtocols | back to summary |
|---|---|
| public String[] getSupportedProtocols() Implements abstract javax. Doc from javax. Returns the names of the protocols which could be enabled for use
with this | |
| getUseClientMode | back to summary |
|---|---|
| public boolean getUseClientMode() Implements abstract javax. Doc from javax. Returns true if the engine is set to use client mode when handshaking.
| |
| getWantClientAuth | back to summary |
|---|---|
| public boolean getWantClientAuth() Implements abstract javax. Doc from javax. Returns true if the engine will request client authentication. This option is only useful for engines in the server mode.
| |
| isInboundDone | back to summary |
|---|---|
| public boolean isInboundDone() Implements abstract javax. Doc from javax. Returns whether
| |
| isOutboundDone | back to summary |
|---|---|
| public boolean isOutboundDone() Implements abstract javax. Doc from javax. Returns whether
Note that during the closure phase, a
| |
| limitCiphers | back to summary |
|---|---|
| private void limitCiphers(List<Integer> clientCiphers) | |
| setEnabledCipherSuites | back to summary |
|---|---|
| public void setEnabledCipherSuites(final String[] strings) Implements abstract javax. Doc from javax. Sets the cipher suites enabled for use on this engine.
Each cipher suite in the Note that the standard list of cipher suite names may be found in the JSSE Cipher Suite Names section of the Java Security Standard Algorithm Names Specification. Providers may support cipher suite names not found in this list or might not use the recommended name for a certain cipher suite.
See | |
| setEnabledProtocols | back to summary |
|---|---|
| public void setEnabledProtocols(final String[] strings) Implements abstract javax. Doc from javax. Set the protocol versions enabled for use on this engine.
The protocols must have been listed by getSupportedProtocols()
as being supported. Following a successful call to this method,
only protocols listed in the | |
| setEnableSessionCreation | back to summary |
|---|---|
| public void setEnableSessionCreation(final boolean b) Implements abstract javax. Doc from javax. Controls whether new SSL sessions may be established by this engine. If session creations are not allowed, and there are no existing sessions to resume, there will be no successful handshaking.
| |
| setNeedClientAuth | back to summary |
|---|---|
| public void setNeedClientAuth(final boolean b) Implements abstract javax. Doc from javax. Configures the engine to require client authentication. This option is only useful for engines in the server mode. An engine's client authentication setting is one of the following:
Unlike
Calling this method overrides any previous setting made by
this method or
| |
| setSSLParameters | back to summary |
|---|---|
| public void setSSLParameters(final SSLParameters sslParameters) Overrides javax. Doc from javax. Applies SSLParameters to this engine. This means:
| |
| setUseClientMode | back to summary |
|---|---|
| public void setUseClientMode(boolean b) Implements abstract javax. Doc from javax. Configures the engine to use client (or server) mode when handshaking. This method must be called before any handshaking occurs. Once handshaking has begun, the mode can not be reset for the life of this engine. Servers normally authenticate themselves, and clients are not required to do so.
| |
| setWantClientAuth | back to summary |
|---|---|
| public void setWantClientAuth(final boolean b) Implements abstract javax. Doc from javax. Configures the engine to request client authentication. This option is only useful for engines in the server mode. An engine's client authentication setting is one of the following:
Unlike
Calling this method overrides any previous setting made by
this method or
| |
| unwrap | back to summary |
|---|---|
| public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer dst) throws SSLException Overrides javax. Doc from javax. Attempts to decode SSL/TLS/DTLS network data into a plaintext application data buffer. An invocation of this method behaves in exactly the same manner as the invocation:
| |
| unwrap | back to summary |
|---|---|
| public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts) throws SSLException Overrides javax. Doc from javax. Attempts to decode SSL/TLS/DTLS network data into a sequence of plaintext application data buffers. An invocation of this method behaves in exactly the same manner as the invocation:
| |
| unwrap | back to summary |
|---|---|
| public SSLEngineResult unwrap(ByteBuffer byteBuffer, ByteBuffer[] byteBuffers, int i, int i1) throws SSLException Implements abstract javax. Doc from javax. Attempts to decode SSL/TLS/DTLS network data into a subsequence of
plaintext application data buffers. This "scattering"
operation decodes, in a single invocation, a sequence of bytes
into one or more of a given sequence of buffers. Scattering
unwraps are often useful when implementing network protocols or
file formats that, for example, group data into segments
consisting of one or more fixed-length headers followed by a
variable-length body. See
Depending on the state of the SSLEngine, this method may consume network data without producing any application data (for example, it may consume handshake data.) The application is responsible for reliably obtaining the network data from the peer, and for invoking unwrap() on the data in the order it was received. The application must properly synchronize multiple calls to this method.
If this
This method will attempt to consume one complete SSL/TLS/DTLS network
packet, but will never consume more than the sum of the bytes
remaining in the buffers. Each
The underlying memory used by the
The inbound network buffer, Note the network data will not be useful to a second SSLEngine, as each SSLEngine contains unique random state which influences the SSL/TLS/DTLS messages. See the class description for more information on engine closure.
| |
| wrap | back to summary |
|---|---|
| public SSLEngineResult wrap(ByteBuffer src, ByteBuffer dst) throws SSLException Overrides javax. Doc from javax. Attempts to encode a buffer of plaintext application data into SSL/TLS/DTLS network data. An invocation of this method behaves in exactly the same manner as the invocation:
| |
| wrap | back to summary |
|---|---|
| public SSLEngineResult wrap(ByteBuffer[] srcs, ByteBuffer dst) throws SSLException Overrides javax. Doc from javax. Attempts to encode plaintext bytes from a sequence of data buffers into SSL/TLS/DTLS network data. An invocation of this method behaves in exactly the same manner as the invocation:
| |
| wrap | back to summary |
|---|---|
| public SSLEngineResult wrap(ByteBuffer[] srcs, int off, int len, ByteBuffer dst) throws SSLException Implements abstract javax. Doc from javax. Attempts to encode plaintext bytes from a subsequence of data
buffers into SSL/TLS/DTLS network data. This "gathering"
operation encodes, in a single invocation, a sequence of bytes
from one or more of a given sequence of buffers. Gathering
wraps are often useful when implementing network protocols or
file formats that, for example, group data into segments
consisting of one or more fixed-length headers followed by a
variable-length body. See
Depending on the state of the SSLEngine, this method may produce network data without consuming any application data (for example, it may generate handshake data.) The application is responsible for reliably transporting the network data to the peer, and for ensuring that data created by multiple calls to wrap() is transported in the same order in which it was generated. The application must properly synchronize multiple calls to this method.
If this
This method will attempt to produce SSL/TLS/DTLS records, and will
consume as much source data as possible, but will never consume
more than the sum of the bytes remaining in each buffer. Each
The underlying memory used by the See the class description for more information on engine closure.
| |