Closed
Description
When reading ASN.1 BER/CER/DER content from a Stream it's not currently possible to know how far ahead one needs to buffer in order to read the next item.
namespace System.Formats.Asn1
{
public static partial class AsnDecoder
{
// returns null for "indefinite length"
// (local length 0, but keep seeking until you find the "end of indefinite length" marker)
public static int? DecodeLength(
ReadOnlySpan<byte> source,
AsnEncodingRules ruleSet,
out int bytesConsumed);
public static bool TryDecodeLength(
ReadOnlySpan<byte> source,
AsnEncodingRules ruleSet,
out int? decodedLength,
out int bytesConsumed);
}
}