Share via


AsnDecoder.TryReadPrimitiveOctetString 方法

定義

如果值包含在單一 (基本) 編碼中,則嘗試在指定的編碼規則下,從 source 取得具有所指定標籤的八位元字串值。

public static bool TryReadPrimitiveOctetString (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out ReadOnlySpan<byte> value, out int bytesConsumed, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member TryReadPrimitiveOctetString : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * ReadOnlySpan * int * Nullable<System.Formats.Asn1.Asn1Tag> -> bool
Public Shared Function TryReadPrimitiveOctetString (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef value As ReadOnlySpan(Of Byte), ByRef bytesConsumed As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Boolean

參數

source
ReadOnlySpan<Byte>

包含編碼資料的緩衝區。

ruleSet
AsnEncodingRules

要在解譯資料時使用的編碼條件約束。

value
ReadOnlySpan<Byte>

成功時,會收到輸入緩衝區的配量,其對應至八位元字串的值。 這個參數會被視為未初始化。

bytesConsumed
Int32

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

expectedTag
Nullable<Asn1Tag>

要在讀取之前檢查的標籤,或預設標籤的 null (Universal 4)。

傳回

如果八位元字串值具有基本編碼,則為 true,否則為 false

例外狀況

未定義ruleSet

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

-或-

目前編碼規則下的長度編碼無效。

-或-

內容在目前的編碼規則下無效。

expectedTagTagClassUniversal,但 expectedTagTagValue 對方法而言不正確。

適用於