SSLEngine wrapper, used by Jsse SSL conduits.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private final JsseSslStreamConnection | |
| private static final ByteBuffer | |
| private final SSLEngine | engine
The SSL engine. |
| private static final int | |
| private ByteBuffer | expandedSendBuffer
An expanded non-final buffer from which outbound SSL data is sent when large fragments handling is enabled in the underlying SSL Engine. |
| private int | |
| private static final int | |
| private static final String | |
| private static final Logger | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private final Pooled | readBuffer
References Deprecated
The buffer into which inbound clear data is written.
Pooled is deprecated or references (maybe indirectly) at least one deprecated element.
|
| private volatile Thread | |
| private static final AtomicReferenceFieldUpdater | |
| private final Pooled | receiveBuffer
References Deprecated
The buffer into which incoming SSL data is written.
Pooled is deprecated or references (maybe indirectly) at least one deprecated element.
|
| private final Pooled | sendBuffer
References Deprecated
The buffer from which outbound SSL data is sent.
Pooled is deprecated or references (maybe indirectly) at least one deprecated element.
|
| private final StreamSinkConduit | |
| private final StreamSourceConduit | |
| private volatile int | |
| private static final AtomicIntegerFieldUpdater | |
| private static final int | |
| private static final int | |
| private static final int | |
| private volatile Thread | |
| private static final AtomicReferenceFieldUpdater |
| Access | Constructor and Description |
|---|---|
| pack-priv | JsseSslConduitEngine(final JsseSslStreamConnection
the ssl connection associated with this engine connection, final StreamSinkConduit the sink channel to use for write operations sinkConduit, final StreamSourceConduit the source channel to use for read operations sourceConduit, final SSLEngine the SSL engine to use engine, final Pool<ByteBuffer> the socket buffer pool socketBufferPool, final Pool<ByteBuffer> the application buffer pool applicationBufferPool)
References Deprecated
Pool is deprecated or references (maybe indirectly) at least one deprecated element.
Construct a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | awaitCanUnwrap(long
timeout for blocking time, TimeUnit timeout unit timeUnit)Block until this engine can unwrap messages. |
| public void | |
| public void | awaitCanWrap(long
timeout for blocking time, TimeUnit timeout unit timeUnit)Block until this engine can wrap messages. |
| public void | |
| private int | |
| private void | clearNeedUnwrap()
Indicate that the engine no longer requires a successful unwrap to proceed with wrap operations. |
| private void | clearNeedWrap()
Indicate that the engine no longer requires a successful wrap to proceed with unwrap operations. |
| pack-priv void | close()
Closes the engine for both inbound and outbound connection, and discards this engine's internal resources immediately without handshaking if this engine has not been used. |
| private void | |
| public void | |
| public void | |
| private int | Returns: the amount of copied bytesdestine of copy dsts, final int offset offset, final int length length, ByteBuffer source from where byte will be copied unwrappedBuffer)Copy unwrapped data from |
| private boolean | Returns: true if all data available has been flushedFlushes all data in the wrapped bytes buffer. |
| private SSLEngineResult | engineUnwrap(final ByteBuffer buffer, final ByteBuffer unwrappedBuffer)
Invoke inner SSL engine to unwrap. |
| private SSLEngineResult | engineWrap(final ByteBuffer[] srcs, final int offset, final int length, final ByteBuffer dest)
Invoke inner SSL engine to wrap. |
| private SSLEngineResult | |
| public boolean | Returns: true if there is no left data to be flushed; false if for some reason the engine was
unable to flush all dataFlush any data needed for handshaking into the |
| pack-priv SSLEngine | |
| private final ByteBuffer | |
| public SSLSession | |
| public ByteBuffer | Returns: the buffer containing bytes to be unwrappedReturns the buffer that contains the data to be unwrapped. |
| public Object | Returns: lock for protecting access to the unwrap bufferReturns the unwrap lock, that must be used whenever the |
| public Object | Returns: lock for protecting access to the unwrapped bufferReturns the wrap lock, that must be used whenever the |
| public ByteBuffer | Returns: the buffer containing wrapped bytesReturns the buffer that contains the wrapped data. |
| private boolean | Returns: true to indicate that caller should rerun the previous wrap or unwrap operation, hence
producing a new result; false to indicate otherwisethe wrap/unwrap result result, boolean if write)true, indicates caller executed a wrap operation; if false, indicates
caller executed an unwrap operationHandle handshake process, after a wrap or an unwrap operation. |
| private int | Returns: the amount of bytes consumed by unwrap. If the engine is closed and no bytes were consumed, returns-1.the unwrap result result)Handles the unwrap result, indicating how many bytes have been consumed. |
| private boolean | Returns: true if a new attempt to wrap should be madethe wrap result result, boolean is a closed engine result expected closeExpected)Handles the wrap result, indicating if caller should perform a new attempt to wrap. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| private boolean | isUnderflow()
Indicates that even though there is data available there is not enough to form a complete packet |
| private boolean | |
| private boolean | |
| private void | |
| private void | |
| private int | |
| public int | Returns: the amount of resulting unwrapped byteswhere the resulting unwrapped bytes will be copied to dst)Unwraps the bytes contained in |
| public long | Returns: the amount of resulting unwrapped byteswhere the resulting unwrapped bytes will be copied to dsts, final int offset offset, final int length length)Unwraps the bytes contained in |
| public int | Returns: the amount of wrapped bytes.the bytes to be wrapped src)Attempt to wrap the bytes in |
| public long | Returns: the amount of wrapped bytes.contains the bytes to be wrapped srcs, final int offset offset, final int length length)Attempt to wrap the bytes in |
| private int | Returns: the amount of resulting wrapped bytescontains the bytes to be wrapped src, boolean indicates if close is expected, information that is used to perform special handling
when closing the engine isCloseExpected)Wrap operation used internally. |
| private boolean | Returns: true only if all bytes concerning close handshake messages have been wrapped.Attempt to finish wrapping close handshake bytes. |
| BUFFER_UNDERFLOW | back to summary |
|---|---|
| private static final int BUFFER_UNDERFLOW | |
| connection | back to summary |
|---|---|
| private final JsseSslStreamConnection connection | |
| EMPTY_BUFFER | back to summary |
|---|---|
| private static final ByteBuffer EMPTY_BUFFER | |
| engine | back to summary |
|---|---|
| private final SSLEngine engine The SSL engine. | |
| ENGINE_CLOSED | back to summary |
|---|---|
| private static final int ENGINE_CLOSED | |
| expandedSendBuffer | back to summary |
|---|---|
| private ByteBuffer expandedSendBuffer An expanded non-final buffer from which outbound SSL data is sent when large fragments handling is enabled in the underlying SSL Engine. When this happens, we need a specific buffer with expanded capacity. | |
| failureCount | back to summary |
|---|---|
| private int failureCount | |
| FIRST_HANDSHAKE | back to summary |
|---|---|
| private static final int FIRST_HANDSHAKE | |
| FQCN | back to summary |
|---|---|
| private static final String FQCN | |
| log | back to summary |
|---|---|
| private static final Logger log | |
| NEED_UNWRAP | back to summary |
|---|---|
| private static final int NEED_UNWRAP | |
| NEED_WRAP | back to summary |
|---|---|
| private static final int NEED_WRAP | |
| READ_FLAGS | back to summary |
|---|---|
private static final int READ_FLAGS
| |
| READ_SHUT_DOWN | back to summary |
|---|---|
| private static final int READ_SHUT_DOWN | |
| readBuffer | back to summary |
|---|---|
| private final Pooled<ByteBuffer> readBuffer
References Deprecated
See corresponding docs for further information. The buffer into which inbound clear data is written. | |
| readWaiter | back to summary |
|---|---|
private volatile Thread readWaiter
| |
| readWaiterUpdater | back to summary |
|---|---|
| private static final AtomicReferenceFieldUpdater<JsseSslConduitEngine, Thread> readWaiterUpdater | |
| receiveBuffer | back to summary |
|---|---|
| private final Pooled<ByteBuffer> receiveBuffer
References Deprecated
See corresponding docs for further information. The buffer into which incoming SSL data is written. | |
| sendBuffer | back to summary |
|---|---|
| private final Pooled<ByteBuffer> sendBuffer
References Deprecated
See corresponding docs for further information. The buffer from which outbound SSL data is sent. | |
| sinkConduit | back to summary |
|---|---|
| private final StreamSinkConduit sinkConduit | |
| sourceConduit | back to summary |
|---|---|
| private final StreamSourceConduit sourceConduit | |
| state | back to summary |
|---|---|
| private volatile int state | |
| stateUpdater | back to summary |
|---|---|
| private static final AtomicIntegerFieldUpdater<JsseSslConduitEngine> stateUpdater | |
| WRITE_COMPLETE | back to summary |
|---|---|
| private static final int WRITE_COMPLETE | |
| WRITE_FLAGS | back to summary |
|---|---|
private static final int WRITE_FLAGS
| |
| WRITE_SHUT_DOWN | back to summary |
|---|---|
| private static final int WRITE_SHUT_DOWN | |
| writeWaiter | back to summary |
|---|---|
private volatile Thread writeWaiter
| |
| writeWaiterUpdater | back to summary |
|---|---|
| private static final AtomicReferenceFieldUpdater<JsseSslConduitEngine, Thread> writeWaiterUpdater | |
| JsseSslConduitEngine | back to summary |
|---|---|
| pack-priv JsseSslConduitEngine(final JsseSslStreamConnection connection, final StreamSinkConduit sinkConduit, final StreamSourceConduit sourceConduit, final SSLEngine engine, final Pool<ByteBuffer> socketBufferPool, final Pool<ByteBuffer> applicationBufferPool)
References Deprecated
See corresponding docs for further information. Construct a new instance.
| |
| awaitCanUnwrap | back to summary |
|---|---|
| public void awaitCanUnwrap() throws IOException Block until this engine can unwrap messages.
| |
| awaitCanUnwrap | back to summary |
|---|---|
| public void awaitCanUnwrap(long time, TimeUnit timeUnit) throws IOException Block until this engine can unwrap messages.
| |
| awaitCanWrap | back to summary |
|---|---|
| public void awaitCanWrap() throws IOException Block until this engine can wrap messages. The engine may be unable to wrap if a handshake message needs to be unwrapped first. In this case, this thread will be awakened as soon as the message is made available for reading by the internal source conduit.
| |
| awaitCanWrap | back to summary |
|---|---|
| public void awaitCanWrap(long time, TimeUnit timeUnit) throws IOException Block until this engine can wrap messages. The engine may be unable to wrap if a handshake message needs to be unwrapped first. In this case, this thread will be awakened as soon as the message is made available for reading by the internal source conduit.
| |
| beginHandshake | back to summary |
|---|---|
| public void beginHandshake() throws IOException Begins handshake.
| |
| clearFlags | back to summary |
|---|---|
| private int clearFlags(int flags) | |
| clearNeedUnwrap | back to summary |
|---|---|
| private void clearNeedUnwrap() Indicate that the engine no longer requires a successful unwrap to proceed with wrap operations. | |
| clearNeedWrap | back to summary |
|---|---|
| private void clearNeedWrap() Indicate that the engine no longer requires a successful wrap to proceed with unwrap operations. | |
| close | back to summary |
|---|---|
| pack-priv void close() throws IOException Closes the engine for both inbound and outbound connection, and discards this engine's internal resources immediately without handshaking if this engine has not been used. | |
| closeEngine | back to summary |
|---|---|
| private void closeEngine() throws IOException Closes this engine for both inbound and outbound, clearing the buffers. | |
| closeInbound | back to summary |
|---|---|
| public void closeInbound() throws IOException Signals that no inbound data will be read
| |
| closeOutbound | back to summary |
|---|---|
| public void closeOutbound() throws IOException Signals that no outbound data will be sent.
| |
| copyUnwrappedData | back to summary |
|---|---|
| private int copyUnwrappedData(final ByteBuffer[] dsts, final int offset, final int length, ByteBuffer unwrappedBuffer) Copy unwrapped data from
| |
| doFlush | back to summary |
|---|---|
| private boolean doFlush() throws IOException Flushes all data in the wrapped bytes buffer.
| |
| engineUnwrap | back to summary |
|---|---|
| private SSLEngineResult engineUnwrap(final ByteBuffer buffer, final ByteBuffer unwrappedBuffer) throws IOException Invoke inner SSL engine to unwrap. | |
| engineWrap | back to summary |
|---|---|
| private SSLEngineResult engineWrap(final ByteBuffer[] srcs, final int offset, final int length, final ByteBuffer dest) throws SSLException Invoke inner SSL engine to wrap. | |
| engineWrap | back to summary |
|---|---|
| private SSLEngineResult engineWrap(final ByteBuffer src, final ByteBuffer dest) throws SSLException Invoke inner SSL engine to wrap. | |
| flush | back to summary |
|---|---|
| public boolean flush() throws IOException Flush any data needed for handshaking into the The flushed data can later be retrieved by reading the buffer. If the engine is closed, this method can be used to flush all data associated to engine close messages.
| |
| getEngine | back to summary |
|---|---|
| pack-priv SSLEngine getEngine() | |
| getSendBuffer | back to summary |
|---|---|
| private final ByteBuffer getSendBuffer() | |
| getSession | back to summary |
|---|---|
| public SSLSession getSession() Returns the engine's session. | |
| getUnwrapBuffer | back to summary |
|---|---|
| public ByteBuffer getUnwrapBuffer() Returns the buffer that contains the data to be unwrapped.
Retrieval and manipulation of this buffer should always be protected by the
| |
| getUnwrapLock | back to summary |
|---|---|
| public Object getUnwrapLock() Returns the unwrap lock, that must be used whenever the This lock is also used internally by unwrapping operations, thus guaranteeing safe concurrent execution of both wrap and unwrap operations, specially during handshake handling.
| |
| getWrapLock | back to summary |
|---|---|
| public Object getWrapLock() Returns the wrap lock, that must be used whenever the This lock is also used internally by wrapping operations, thus guaranteeing safe concurrent execution of both wrap and unwrap operations, specially during handshake handling.
| |
| getWrappedBuffer | back to summary |
|---|---|
| public ByteBuffer getWrappedBuffer() Returns the buffer that contains the wrapped data.
Retrieval and manipulation of this buffer should always be protected by the
| |
| handleHandshake | back to summary |
|---|---|
| private boolean handleHandshake(SSLEngineResult result, boolean write) throws IOException Handle handshake process, after a wrap or an unwrap operation.
| |
| handleUnwrapResult | back to summary |
|---|---|
| private int handleUnwrapResult(final SSLEngineResult result) throws IOException Handles the unwrap result, indicating how many bytes have been consumed.
| |
| handleWrapResult | back to summary |
|---|---|
| private boolean handleWrapResult(SSLEngineResult result, boolean closeExpected) throws IOException Handles the wrap result, indicating if caller should perform a new attempt to wrap.
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Indicates if engine is closed. | |
| isDataAvailable | back to summary |
|---|---|
| public boolean isDataAvailable() | |
| isFirstHandshake | back to summary |
|---|---|
| public boolean isFirstHandshake() | |
| isInboundClosed | back to summary |
|---|---|
| public boolean isInboundClosed() Indicates if inbound is closed.
| |
| isOutboundClosed | back to summary |
|---|---|
| public boolean isOutboundClosed() Indicates if outbound is closed.
| |
| isUnderflow | back to summary |
|---|---|
| private boolean isUnderflow() Indicates that even though there is data available there is not enough to form a complete packet | |
| isUnwrapNeeded | back to summary |
|---|---|
| private boolean isUnwrapNeeded() Indicate if the engine can wrap. | |
| isWrapNeeded | back to summary |
|---|---|
| private boolean isWrapNeeded() Indicate if the engine can unwrap. | |
| needUnwrap | back to summary |
|---|---|
| private void needUnwrap() Indicate that the engine will not be able wrap before a successful unwrap is performed. | |
| needWrap | back to summary |
|---|---|
| private void needWrap() Indicate that the engine will not be able unwrap before a successful wrap is performed. | |
| setFlags | back to summary |
|---|---|
| private int setFlags(int flags) | |
| unwrap | back to summary |
|---|---|
| public int unwrap(final ByteBuffer dst) throws IOException Unwraps the bytes contained in If the engine is performing handshake during this request, not all bytes could be unwrapped. In this case, a later call can be performed to attempt to unwrap more bytes.
This method must not be invoked inside the
| |
| unwrap | back to summary |
|---|---|
| public long unwrap(final ByteBuffer[] dsts, final int offset, final int length) throws IOException Unwraps the bytes contained in If the engine is performing handshake during this request, not all bytes could be unwrapped. In this case, a later call can be performed to attempt to unwrap more bytes.
This method must not be invoked inside the
| |
| wrap | back to summary |
|---|---|
| public int wrap(final ByteBuffer src) throws IOException Attempt to wrap the bytes in If the engine is performing handshake during this request, not all bytes could be wrapped. In this case, a later call can be performed to attempt to wrap more bytes.
This method must not be invoked inside the
| |
| wrap | back to summary |
|---|---|
| public long wrap(final ByteBuffer[] srcs, final int offset, final int length) throws IOException Attempt to wrap the bytes in If the engine is performing handshake during this request, not all bytes could be wrapped. In this case, a later call can be performed to attempt to wrap more bytes.
This method must not be invoked inside the
| |
| wrap | back to summary |
|---|---|
| private int wrap(final ByteBuffer src, boolean isCloseExpected) throws IOException Wrap operation used internally.
| |
| wrapCloseMessage | back to summary |
|---|---|
| private boolean wrapCloseMessage() throws IOException Attempt to finish wrapping close handshake bytes.
| |