AsnDecoder.TryDecodeLength Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to decode the data in source
as a length value under the specified
encoding rules.
public:
static bool TryDecodeLength(ReadOnlySpan<System::Byte> source, System::Formats::Asn1::AsnEncodingRules ruleSet, [Runtime::InteropServices::Out] Nullable<int> % decodedLength, [Runtime::InteropServices::Out] int % bytesConsumed);
public static bool TryDecodeLength (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out int? decodedLength, out int bytesConsumed);
static member TryDecodeLength : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * Nullable * int -> bool
Public Shared Function TryDecodeLength (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef decodedLength As Nullable(Of Integer), ByRef bytesConsumed As Integer) As Boolean
Parameters
- source
- ReadOnlySpan<Byte>
The buffer containing encoded data.
- ruleSet
- AsnEncodingRules
The encoding constraints to use when interpreting the data.
When this method returns, contains the decoded value of the length, or null
if the
encoded length represents the indefinite length.
This parameter is treated as uninitialized.
- bytesConsumed
- Int32
When this method returns, contains the number of bytes from the beginning of source
that contributed to the length.
This parameter is treated as uninitialized.
Returns
true
if the buffer represents a valid length under the specified encoding rules;
otherwise, false
Exceptions
ruleSet
is not a known AsnEncodingRules value.
Remarks
This method only processes the length portion of an ASN.1/BER Tag-Length-Value triplet, so source
needs to have already sliced off the encoded tag.