internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out EncryptedContentInfoAsn decoded) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } decoded = default; AsnReader sequenceReader = reader.ReadSequence(expectedTag); decoded.ContentType = sequenceReader.ReadObjectIdentifierAsString(); System.Security.Cryptography.Asn1.AlgorithmIdentifierAsn.Decode(sequenceReader, out decoded.ContentEncryptionAlgorithm); if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 0))) { if (sequenceReader.TryReadPrimitiveOctetStringBytes(new Asn1Tag(TagClass.ContextSpecific, 0), out ReadOnlyMemory <byte> tmpEncryptedContent)) { decoded.EncryptedContent = tmpEncryptedContent; } else { decoded.EncryptedContent = sequenceReader.ReadOctetString(new Asn1Tag(TagClass.ContextSpecific, 0)); } } sequenceReader.ThrowIfNotEmpty(); }
internal static void Decode(AsnReader reader, out EncryptedContentInfoAsn decoded) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } Decode(reader, Asn1Tag.Sequence, out decoded); }