語言

AsnDecoder.ReadSetOf 方法

定義

根據指定的編碼規則,讀取帶有指定標籤的 Set-Of source 值。

public static void ReadSetOf(ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out int contentOffset, out int contentLength, out int bytesConsumed, bool skipSortOrderValidation = false, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member ReadSetOf : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * int * int * int * bool * Nullable<System.Formats.Asn1.Asn1Tag> -> unit
Public Shared Sub ReadSetOf (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef contentOffset As Integer, ByRef contentLength As Integer, ByRef bytesConsumed As Integer, Optional skipSortOrderValidation As Boolean = false, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing)

參數

source
ReadOnlySpan<Byte>

緩衝區內包含編碼資料。

ruleSet
AsnEncodingRules

解讀資料時應使用的編碼約束。

contentOffset
Int32

當此方法返回時,內容有效載荷相對於起 source始點的偏移量。 此參數被視為未初始化。

contentLength
Int32

當此方法回傳時,內容有效載荷中的位元組數(可能是 0)。 此參數被視為未初始化。

bytesConsumed
Int32

當此方法回傳時,會顯示編碼值的總位元組數。 此參數被視為未初始化。

skipSortOrderValidation
Boolean

true 總是依照呈現的順序接受資料, false 並驗證資料在編碼規則規定需要排序時正確排序(如 CER 與 DER)。

expectedTag
Nullable<Asn1Tag>

閱讀前要檢查的標籤,或 null 是預設標籤(Universal 17)。

例外狀況

ruleSet 尚未定義。

下一個值沒有正確的標籤。

-或-

長度編碼在現行編碼規則下不適用。

-或-

內容在現行編碼規則下無效。

expectedTag。TagClass 是 Universal,但 expectedTag。TagValue 對該方法來說並不正確。

備註

此方法不會評估巢狀內容,僅進行最小處理以確定目錄結束標記的位置或驗證內容排序順序。 因此,內容可能包含在現行編碼規則下不具效的資料。

適用於