Bewerken

Delen via


CoseMultiSignMessage.SignDetachedAsync Method

Definition

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

public static System.Threading.Tasks.Task<byte[]> SignDetachedAsync (System.IO.Stream detachedContent, System.Security.Cryptography.Cose.CoseSigner signer, System.Security.Cryptography.Cose.CoseHeaderMap? protectedHeaders = default, System.Security.Cryptography.Cose.CoseHeaderMap? unprotectedHeaders = default, ReadOnlyMemory<byte> associatedData = default, System.Threading.CancellationToken cancellationToken = default);
static member SignDetachedAsync : System.IO.Stream * System.Security.Cryptography.Cose.CoseSigner * System.Security.Cryptography.Cose.CoseHeaderMap * System.Security.Cryptography.Cose.CoseHeaderMap * ReadOnlyMemory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<byte[]>
Public Shared Function SignDetachedAsync (detachedContent As Stream, signer As CoseSigner, Optional protectedHeaders As CoseHeaderMap = Nothing, Optional unprotectedHeaders As CoseHeaderMap = Nothing, 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.

protectedHeaders
CoseHeaderMap

The protected header parameters to append to the message's content layer.

unprotectedHeaders
CoseHeaderMap

The unprotected header parameters to append to the message's content layer.

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 have one or more labels in common.

-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