Share via


AsnDecoder.ReadSetOf Method

Definition

Reads a Set-Of value from source with a specified tag under the specified encoding rules.

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)

Parameters

source
ReadOnlySpan<Byte>

The buffer containing encoded data.

ruleSet
AsnEncodingRules

The encoding constraints to use when interpreting the data.

contentOffset
Int32

When this method returns, the offset of the content payload relative to the start of source. This parameter is treated as uninitialized.

contentLength
Int32

When this method returns, the number of bytes in the content payload (which may be 0). This parameter is treated as uninitialized.

bytesConsumed
Int32

When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.

skipSortOrderValidation
Boolean

true to always accept the data in the order it is presented, false to verify that the data is sorted correctly when the encoding rules say sorting was required (CER and DER).

expectedTag
Nullable<Asn1Tag>

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

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 nested content is not evaluated by this method, except for minimal processing to determine the location of an end-of-contents marker or verification of the content sort order. Therefore, the contents may contain data which is not valid under the current encoding rules.

Applies to