public static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out AttributeAsn decoded) { decoded = default; AsnValueReader sequenceReader = reader.ReadSequence(expectedTag); AsnValueReader collectionReader; ReadOnlySpan <byte> rebindSpan = rebind.Span; int offset; ReadOnlySpan <byte> tmpSpan; decoded.AttrType = sequenceReader.ReadObjectIdentifier(); // Decode SEQUENCE OF for AttrValues { collectionReader = sequenceReader.ReadSetOf(); var tmpList = new List <ReadOnlyMemory <byte> >(); ReadOnlyMemory <byte> tmpItem; while (collectionReader.HasData) { tmpSpan = collectionReader.ReadEncodedValue(); tmpItem = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); tmpList.Add(tmpItem); } decoded.AttrValues = tmpList.ToArray(); } sequenceReader.ThrowIfNotEmpty(); }
public static void Decode(ref AsnValueReader reader, ReadOnlyMemory <byte> rebind, out AttributeAsn decoded) { Decode(ref reader, Asn1Tag.Sequence, rebind, out decoded); }