AsnDecoder.ReadNamedBitList Method

Definition

Reads a NamedBitList from source with a specified tag under the specified encoding rules.

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

Parameters

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>

The tag to check for before reading, or null for the default tag (Universal 3).

Returns

The bits from the encoded value.

Exceptions

ruleSet 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.TagClass is Universal, but expectedTag.TagValue is not correct for the method.

Remarks

The bit alignment performed by this method is to interpret the most significant bit in the first byte of the value as bit 0, with bits increasing in value until the least significant bit of the first byte, proceeding with the most significant bit of the second byte, and so on. This means that the number used in an ASN.1 NamedBitList construction is the index in the return value.

Applies to