CoseSign1Message.SignDetachedAsync Method

Definition

Asynchronously signs the specified content and encodes it as a COSE_Sign1 message with detached content.

public static System.Threading.Tasks.Task<byte[]> SignDetachedAsync (System.IO.Stream detachedContent, System.Security.Cryptography.Cose.CoseSigner signer, ReadOnlyMemory<byte> associatedData = default, System.Threading.CancellationToken cancellationToken = default);
static member SignDetachedAsync : System.IO.Stream * System.Security.Cryptography.Cose.CoseSigner * ReadOnlyMemory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<byte[]>
Public Shared Function SignDetachedAsync (detachedContent As Stream, signer As CoseSigner, Optional associatedData As ReadOnlyMemory(Of Byte) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Byte())

Parameters

detachedContent
Stream

The content to sign.

signer
CoseSigner

The signer information used to sign detachedContent.

associatedData
ReadOnlyMemory<Byte>

The extra data associated with the signature, which must also be provided during verification.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

Task<Byte[]>

A task that represents the asynchronous operation. The value of its Result property contains the encoded message.

Exceptions

detachedContent or signer is null.

detachedContent does not support reading or seeking.

-or-

The ProtectedHeaders and UnprotectedHeaders collections in signer have one or more labels in common.

-or-

One or more of the labels specified in a CriticalHeaders header is missing.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to