CoseMultiSignMessage.TrySignEmbedded 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
對指定內容進行簽名,並將其編碼為帶有內嵌內容的COSE_Sign訊息。
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
參數
- embeddedContent
- ReadOnlySpan<Byte>
要簽署並包含在訊息中的內容。
- signer
- CoseSigner
簽署者資訊用於簽署 embeddedContent。
- bytesWritten
- Int32
成功時,會收到寫入 destination的位元組數。
- protectedHeaders
- CoseHeaderMap
受保護標頭參數可附加到訊息內容層。
- unprotectedHeaders
- CoseHeaderMap
未受保護的標頭參數可附加到訊息內容層。
- associatedData
- ReadOnlySpan<Byte>
與簽名相關的額外資料,這些資料也必須在驗證時提供。
傳回
true 如果 destination 有足夠長度以接收編碼訊息;否則, false。
例外狀況
signer 是 null。
protectedHeaders這些 和 unprotectedHeaders 系列有一個或多個標籤是共同的。
-或-
ProtectedHeaders
UnprotectedHeaders與 系列signer在 中有一個或多個標籤是共同的。
-或-
標頭中指定的 CriticalHeaders 一個或多個標籤缺失。