AsnDecoder.ReadOctetString(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>) 方法

定义

在指定编码规则下,从带有指定标记的 source 中读取八进制字符串值,以返回新数组内容。Reads an Octet String value from source with a specified tag under the specified encoding rules, returning the contents in a new array.

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

参数

source
ReadOnlySpan<Byte>

包含编码数据的缓冲区。The buffer containing encoded data.

ruleSet
AsnEncodingRules

解释数据时要使用的编码约束。The encoding constraints to use when interpreting the data.

bytesConsumed
Int32

此方法返回时,为编码值的字节总数。When this method returns, the total number of bytes for the encoded value. 该参数未经初始化即被处理。This parameter is treated as uninitialized.

expectedTag
Nullable<Asn1Tag>

读取前要检查的标记,或使用 null 作为默认标记(通用 4)。The tag to check for before reading, or null for the default tag (Universal 4).

返回

Byte[]

包含八进制字符串值内容的数组。An array containing the contents of the Octet String value.

例外

未定义 ruleSetruleSet is not defined.

下一个值没有正确的标记。the next value does not have the correct tag. -或- 在当前编码规则下,长度编码无效。-or- the length encoding is not valid under the current encoding rules. -或- 在当前编码规则下,内容无效。-or- the contents are not valid under the current encoding rules.

expectedTag.TagClassexpectedTag.TagClass Universal,但 expectedTag.TagValueis Universal, but expectedTag.TagValue 对于此方法而言是不正确的。is not correct for the method.

适用于