public static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out Rc2CbcParameters decoded) { decoded = default; AsnValueReader sequenceReader = reader.ReadSequence(expectedTag); ReadOnlySpan <byte> rebindSpan = rebind.Span; int offset; ReadOnlySpan <byte> tmpSpan; if (!sequenceReader.TryReadInt32(out decoded.Rc2Version)) { sequenceReader.ThrowIfNotEmpty(); } if (sequenceReader.TryReadPrimitiveOctetStringBytes(out tmpSpan)) { decoded.Iv = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); } else { decoded.Iv = sequenceReader.ReadOctetString(); } sequenceReader.ThrowIfNotEmpty(); }
public static void Decode(ref AsnValueReader reader, ReadOnlyMemory <byte> rebind, out Rc2CbcParameters decoded) { Decode(ref reader, Asn1Tag.Sequence, rebind, out decoded); }