Edit

Share via


CoseMultiSignMessage.TrySignEmbedded Method

Definition

Signs the specified content and encodes it as a COSE_Sign message with embedded content.

public static bool TrySignEmbedded (ReadOnlySpan<byte> embeddedContent, Span<byte> destination, System.Security.Cryptography.Cose.CoseSigner signer, out int bytesWritten, System.Security.Cryptography.Cose.CoseHeaderMap? protectedHeaders = default, System.Security.Cryptography.Cose.CoseHeaderMap? unprotectedHeaders = default, ReadOnlySpan<byte> associatedData = default);
static member TrySignEmbedded : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.Cose.CoseSigner * int * System.Security.Cryptography.Cose.CoseHeaderMap * System.Security.Cryptography.Cose.CoseHeaderMap * ReadOnlySpan<byte> -> bool
Public Shared Function TrySignEmbedded (embeddedContent As ReadOnlySpan(Of Byte), destination As Span(Of Byte), signer As CoseSigner, ByRef bytesWritten As Integer, Optional protectedHeaders As CoseHeaderMap = Nothing, Optional unprotectedHeaders As CoseHeaderMap = Nothing, Optional associatedData As ReadOnlySpan(Of Byte) = Nothing) As Boolean

Parameters

embeddedContent
ReadOnlySpan<Byte>

The content to sign and to include in the message.

destination
Span<Byte>

The buffer in which to write the encoded bytes.

signer
CoseSigner

The signer information used to sign embeddedContent.

bytesWritten
Int32

On success, receives the number of bytes written to destination.

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
ReadOnlySpan<Byte>

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

Returns

true if destination had sufficient length to receive the encoded message; otherwise, false.

Exceptions

signer is null.

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.

Applies to