Sdílet prostřednictvím


SSLEngine.Unwrap Method

Definition

Overloads

Unwrap(ByteBuffer, ByteBuffer)

Attempts to decode SSL/TLS network data into a plaintext application data buffer.

Unwrap(ByteBuffer, ByteBuffer[])

Attempts to decode SSL/TLS network data into a sequence of plaintext application data buffers.

Unwrap(ByteBuffer, ByteBuffer[], Int32, Int32)

Attempts to decode SSL/TLS network data into a subsequence of plaintext application data buffers.

Unwrap(ByteBuffer, ByteBuffer)

Attempts to decode SSL/TLS network data into a plaintext application data buffer.

[Android.Runtime.Register("unwrap", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Ljavax/net/ssl/SSLEngineResult;", "GetUnwrap_Ljava_nio_ByteBuffer_Ljava_nio_ByteBuffer_Handler")]
public virtual Javax.Net.Ssl.SSLEngineResult? Unwrap (Java.Nio.ByteBuffer? src, Java.Nio.ByteBuffer? dst);
[<Android.Runtime.Register("unwrap", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Ljavax/net/ssl/SSLEngineResult;", "GetUnwrap_Ljava_nio_ByteBuffer_Ljava_nio_ByteBuffer_Handler")>]
abstract member Unwrap : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer -> Javax.Net.Ssl.SSLEngineResult
override this.Unwrap : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer -> Javax.Net.Ssl.SSLEngineResult

Parameters

src
ByteBuffer

a ByteBuffer containing inbound network data.

dst
ByteBuffer

a ByteBuffer to hold inbound application data.

Returns

an SSLEngineResult describing the result of this operation.

Attributes

Exceptions

if a problem occurred while processing the data.

if one of the destination buffers is read-only.

if src or dst is null.

if the engine does not have all the needed settings (e.g. client/server mode not set).

Remarks

Attempts to decode SSL/TLS network data into a plaintext application data buffer.

An invocation of this method behaves in exactly the same manner as the invocation: <blockquote>

{@link #unwrap(ByteBuffer, ByteBuffer [], int, int)
                engine.unwrap(src, new ByteBuffer [] { dst }, 0, 1);}

</blockquote>

Java documentation for javax.net.ssl.SSLEngine.unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Unwrap(ByteBuffer, ByteBuffer[])

Attempts to decode SSL/TLS network data into a sequence of plaintext application data buffers.

[Android.Runtime.Register("unwrap", "(Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;)Ljavax/net/ssl/SSLEngineResult;", "GetUnwrap_Ljava_nio_ByteBuffer_arrayLjava_nio_ByteBuffer_Handler")]
public virtual Javax.Net.Ssl.SSLEngineResult? Unwrap (Java.Nio.ByteBuffer? src, Java.Nio.ByteBuffer[]? dsts);
[<Android.Runtime.Register("unwrap", "(Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;)Ljavax/net/ssl/SSLEngineResult;", "GetUnwrap_Ljava_nio_ByteBuffer_arrayLjava_nio_ByteBuffer_Handler")>]
abstract member Unwrap : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer[] -> Javax.Net.Ssl.SSLEngineResult
override this.Unwrap : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer[] -> Javax.Net.Ssl.SSLEngineResult

Parameters

src
ByteBuffer

a ByteBuffer containing inbound network data.

dsts
ByteBuffer[]

an array of ByteBuffers to hold inbound application data.

Returns

an SSLEngineResult describing the result of this operation.

Attributes

Exceptions

if a problem occurred while processing the data.

if one of the destination buffers is read-only.

if src or dsts is null.

if the engine does not have all the needed settings (e.g. client/server mode not set).

Remarks

Attempts to decode SSL/TLS network data into a sequence of plaintext application data buffers.

An invocation of this method behaves in exactly the same manner as the invocation: <blockquote>

{@link #unwrap(ByteBuffer, ByteBuffer [], int, int)
                engine.unwrap(src, dsts, 0, dsts.length);}

</blockquote>

Java documentation for javax.net.ssl.SSLEngine.unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Unwrap(ByteBuffer, ByteBuffer[], Int32, Int32)

Attempts to decode SSL/TLS network data into a subsequence of plaintext application data buffers.

[Android.Runtime.Register("unwrap", "(Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;II)Ljavax/net/ssl/SSLEngineResult;", "GetUnwrap_Ljava_nio_ByteBuffer_arrayLjava_nio_ByteBuffer_IIHandler")]
public abstract Javax.Net.Ssl.SSLEngineResult? Unwrap (Java.Nio.ByteBuffer? src, Java.Nio.ByteBuffer[]? dsts, int offset, int length);
[<Android.Runtime.Register("unwrap", "(Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;II)Ljavax/net/ssl/SSLEngineResult;", "GetUnwrap_Ljava_nio_ByteBuffer_arrayLjava_nio_ByteBuffer_IIHandler")>]
abstract member Unwrap : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer[] * int * int -> Javax.Net.Ssl.SSLEngineResult

Parameters

src
ByteBuffer

a ByteBuffer containing inbound network data.

dsts
ByteBuffer[]

an array of ByteBuffers to hold inbound application data.

offset
Int32

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 dsts.length.

length
Int32

The maximum number of buffers to be accessed; it must be non-negative and no larger than dsts.length&nbsp;-&nbsp;offset.

Returns

an SSLEngineResult describing the result of this operation.

Attributes

Exceptions

if a problem occurred while processing the data.

if length is greater than dsts.length - offset.

if one of the destination buffers is read-only.

if src, dsts, or one of the entries in dsts is null.

if the engine does not have all the needed settings (e.g. client/server mode not set).

Remarks

Attempts to decode SSL/TLS 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 java.nio.channels.ScatteringByteChannel for more information on scattering, and java.nio.channels.ScatteringByteChannel#read(ByteBuffer[], int, int) for more information on the subsequence behavior.

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 SSLEngine has not yet started its initial handshake, this method will automatically start the handshake.

This method will attempt to consume one complete SSL/TLS network packet, but will never consume more than the sum of the bytes remaining in the buffers. Each ByteBuffer's position is updated to reflect the amount of data consumed or produced. The limits remain the same.

The underlying memory used by the src and dsts ByteBuffers must not be the same.

The inbound network buffer may be modified as a result of this call: therefore if the network data packet is required for some secondary purpose, the data should be duplicated before calling this method. Note: the network data will not be useful to a second SSLEngine, as each SSLEngine contains unique random state which influences the SSL/TLS messages.

See the class description for more information on engine closure.

Java documentation for javax.net.ssl.SSLEngine.unwrap(java.nio.ByteBuffer, java.nio.ByteBuffer[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to