public class SSLEngineResult extends Object
SSLEngine
I/O calls. A SSLEngine
provides a means for establishing secure communication sessions between two peers. SSLEngine
operations typically consume bytes from an input buffer and produce bytes in an output buffer. This class provides operational result values describing the state of the SSLEngine
, including indications of what operations are needed to finish an ongoing handshake. Lastly, it reports the number of bytes consumed and produced as a result of this operation.
Modifier and Type | Class | Description |
---|---|---|
static enum |
SSLEngineResult.HandshakeStatus |
An SSLEngineResult enum describing the current handshaking state of this SSLEngine . |
static enum |
SSLEngineResult.Status |
An SSLEngineResult enum describing the overall result of the SSLEngine operation. |
Constructor | Description |
---|---|
SSLEngineResult |
Initializes a new instance of this class. |
SSLEngineResult |
Initializes a new instance of this class. |
Modifier and Type | Method | Description |
---|---|---|
final int |
bytesConsumed() |
Returns the number of bytes consumed from the input buffer. |
final int |
bytesProduced() |
Returns the number of bytes written to the output buffer. |
final SSLEngineResult.HandshakeStatus |
getHandshakeStatus() |
Gets the handshake status of this SSLEngine operation. |
final SSLEngineResult.Status |
getStatus() |
Gets the return value of this SSLEngine operation. |
final long |
sequenceNumber() |
Returns the sequence number of the produced or consumed SSL/TLS/DTLS record (optional operation). |
String |
toString() |
Returns a String representation of this object. |
public SSLEngineResult(SSLEngineResult.Status status, SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced)
status
- the return value of the operation.handshakeStatus
- the current handshaking status.bytesConsumed
- the number of bytes consumed from the source ByteBufferbytesProduced
- the number of bytes placed into the destination ByteBufferIllegalArgumentException
- if the status
or handshakeStatus
arguments are null, or if bytesConsumed
or bytesProduced
is negative.public SSLEngineResult(SSLEngineResult.Status status, SSLEngineResult.HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced, long sequenceNumber)
status
- the return value of the operation.handshakeStatus
- the current handshaking status.bytesConsumed
- the number of bytes consumed from the source ByteBufferbytesProduced
- the number of bytes placed into the destination ByteBuffersequenceNumber
- the sequence number (unsigned long) of the produced or consumed SSL/TLS/DTLS record, or -1L
if no record produced or consumedIllegalArgumentException
- if the status
or handshakeStatus
arguments are null, or if bytesConsumed
or bytesProduced
is negativepublic final SSLEngineResult.Status getStatus()
SSLEngine
operation.public final SSLEngineResult.HandshakeStatus getHandshakeStatus()
SSLEngine
operation.public final int bytesConsumed()
public final int bytesProduced()
public final long sequenceNumber()
-1L
. It is desired to use the unsigned long comparing mode for comparison of unsigned long values (see also Long.compareUnsigned()
). For DTLS protocols, the first 16 bits of the sequence number is a counter value (epoch) that is incremented on every cipher state change. The remaining 48 bits on the right side of the sequence number represents the sequence of the record, which is maintained separately for each epoch.
-1L
. If the sequence number is close to wrapping, renegotiate should be requested, otherwise the connection should be closed immediately. This should be carried on automatically by the underlying implementation.-1L
if no record is produced or consumed, or this operation is not supported by the underlying providerpublic String toString()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/javax/net/ssl/SSLEngineResult.html