SSLEngine.Wrap Method

Definition

Overloads

Wrap(ByteBuffer, ByteBuffer)

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

Wrap(ByteBuffer[], ByteBuffer)

Attempts to encode plaintext bytes from a sequence of data buffers into SSL/TLS network data.

Wrap(ByteBuffer[], Int32, Int32, ByteBuffer)

Attempts to encode plaintext bytes from a subsequence of data buffers into SSL/TLS network data.

Wrap(ByteBuffer, ByteBuffer)

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

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

Parameters

src
ByteBuffer

a ByteBuffer containing outbound application data

dst
ByteBuffer

a ByteBuffer to hold outbound network data

Returns

an SSLEngineResult describing the result of this operation.

Attributes

Exceptions

if a problem occurred while processing the data.

if the destination buffer is readonly.

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 encode a buffer of plaintext application data into SSL/TLS network data.

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

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

</blockquote>

Java documentation for javax.net.ssl.SSLEngine.wrap(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

Wrap(ByteBuffer[], ByteBuffer)

Attempts to encode plaintext bytes from a sequence of data buffers into SSL/TLS network data.

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

Parameters

srcs
ByteBuffer[]

an array of ByteBuffers containing the outbound application data

dst
ByteBuffer

a ByteBuffer to hold outbound network data

Returns

an SSLEngineResult describing the result of this operation.

Attributes

Exceptions

if a problem occurred while processing the data.

if the destination buffer is readonly.

if srcs or dst is null.

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

Remarks

Attempts to encode plaintext bytes from a sequence of data buffers into SSL/TLS network data.

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

{@link #wrap(ByteBuffer [], int, int, ByteBuffer)
                engine.wrap(srcs, 0, srcs.length, dst);}

</blockquote>

Java documentation for javax.net.ssl.SSLEngine.wrap(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

Wrap(ByteBuffer[], Int32, Int32, ByteBuffer)

Attempts to encode plaintext bytes from a subsequence of data buffers into SSL/TLS network data.

[Android.Runtime.Register("wrap", "([Ljava/nio/ByteBuffer;IILjava/nio/ByteBuffer;)Ljavax/net/ssl/SSLEngineResult;", "GetWrap_arrayLjava_nio_ByteBuffer_IILjava_nio_ByteBuffer_Handler")]
public abstract Javax.Net.Ssl.SSLEngineResult? Wrap (Java.Nio.ByteBuffer[]? srcs, int offset, int length, Java.Nio.ByteBuffer? dst);
[<Android.Runtime.Register("wrap", "([Ljava/nio/ByteBuffer;IILjava/nio/ByteBuffer;)Ljavax/net/ssl/SSLEngineResult;", "GetWrap_arrayLjava_nio_ByteBuffer_IILjava_nio_ByteBuffer_Handler")>]
abstract member Wrap : Java.Nio.ByteBuffer[] * int * int * Java.Nio.ByteBuffer -> Javax.Net.Ssl.SSLEngineResult

Parameters

srcs
ByteBuffer[]

an array of ByteBuffers containing the outbound application data

offset
Int32

The 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 srcs.length

length
Int32

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

dst
ByteBuffer

a ByteBuffer to hold outbound network data

Returns

an SSLEngineResult describing the result of this operation.

Attributes

Exceptions

if a problem occurred while processing the data.

if length is greater than srcs.length - offset.

if the destination buffer is readonly.

if srcs, dst, or one the entries in srcs is null.

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

Remarks

Attempts to encode plaintext bytes from a subsequence of data buffers into SSL/TLS 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 java.nio.channels.GatheringByteChannel for more information on gathering, and java.nio.channels.GatheringByteChannel#write(ByteBuffer[], int, int) for more information on the subsequence behavior.

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

This method will attempt to produce SSL/TLS 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 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 srcs and dst ByteBuffers must not be the same.

See the class description for more information on engine closure.

Java documentation for javax.net.ssl.SSLEngine.wrap(java.nio.ByteBuffer[], int, int, 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