AsnDecoder.ReadEncodedValue Method

Definition

Locates the contents range for the encoded value at the beginning of the source buffer using the specified encoding rules.

public:
 static System::Formats::Asn1::Asn1Tag ReadEncodedValue(ReadOnlySpan<System::Byte> source, System::Formats::Asn1::AsnEncodingRules ruleSet, [Runtime::InteropServices::Out] int % contentOffset, [Runtime::InteropServices::Out] int % contentLength, [Runtime::InteropServices::Out] int % bytesConsumed);
public static System.Formats.Asn1.Asn1Tag ReadEncodedValue (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out int contentOffset, out int contentLength, out int bytesConsumed);
static member ReadEncodedValue : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * int * int * int -> System.Formats.Asn1.Asn1Tag
Public Shared Function ReadEncodedValue (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef contentOffset As Integer, ByRef contentLength As Integer, ByRef bytesConsumed As Integer) As Asn1Tag

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.

Returns

The tag identifying the content.

Exceptions

ruleSet is not defined.

source does not represent a value encoded under the specified encoding rules.

Remarks

This method performs very little validation on the contents. If the encoded value uses a definite length, the contents are not inspected at all. If the encoded value uses an indefinite length, the contents are only inspected as necessary to determine the location of the relevant end-of-contents marker.

When the encoded value uses an indefinite length, the bytesConsumed value will be larger than the sum of contentOffset and contentLength to account for the end-of-contents marker.

Applies to