internal static void Decode(AsnReader reader, out DigestInfoAsn decoded) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } Decode(reader, Asn1Tag.Sequence, out decoded); }
internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out DigestInfoAsn decoded) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } decoded = default; AsnReader sequenceReader = reader.ReadSequence(expectedTag); System.Security.Cryptography.Asn1.AlgorithmIdentifierAsn.Decode(sequenceReader, out decoded.DigestAlgorithm); if (sequenceReader.TryGetPrimitiveOctetStringBytes(out ReadOnlyMemory <byte> tmpDigest)) { decoded.Digest = tmpDigest; } else { decoded.Digest = sequenceReader.ReadOctetString(); } sequenceReader.ThrowIfNotEmpty(); }