共用方式為


CoseSign1Message.TrySignEmbedded 方法

定義

嘗試簽署指定的內容,並將其編碼為內嵌內容的COSE_Sign1訊息,並將其編碼至指定的緩衝區。

public static bool TrySignEmbedded(ReadOnlySpan<byte> embeddedContent, Span<byte> destination, System.Security.Cryptography.Cose.CoseSigner signer, out int bytesWritten, ReadOnlySpan<byte> associatedData = default);
static member TrySignEmbedded : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.Cose.CoseSigner * int * 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 associatedData As ReadOnlySpan(Of Byte) = Nothing) As Boolean

參數

embeddedContent
ReadOnlySpan<Byte>

要簽署和包含在訊息中的內容。

destination
Span<Byte>

要在其中寫入編碼位元組的緩衝區。

signer
CoseSigner

用來簽署的簽署 embeddedContent者資訊。

bytesWritten
Int32

成功時,會收到寫入至 destination 的位元組數。

associatedData
ReadOnlySpan<Byte>

與簽章相關聯的額外數據,也必須在驗證期間提供。

傳回

true 如果 destination 有足夠的長度可接收編碼的訊息,則為 ,否則為 false

例外狀況

signernull

ProtectedHeaders中的 signerUnprotectedHeaders 集合具有一或多個通用標籤。

-或-

缺少標頭中指定的 CriticalHeaders 一或多個標籤。

適用於