<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.1" />

ContentInfo

public class ContentInfo : Asn1Encodable
using System; namespace Org.BouncyCastle.Asn1.Pkcs { public class ContentInfo : Asn1Encodable { private readonly DerObjectIdentifier m_contentType; private readonly Asn1Encodable m_content; public DerObjectIdentifier ContentType => m_contentType; public Asn1Encodable Content => m_content; public static ContentInfo GetInstance(object obj) { if (obj == null) return null; ContentInfo contentInfo = obj as ContentInfo; if (contentInfo != null) return contentInfo; return new ContentInfo(Asn1Sequence.GetInstance(obj)); } public static ContentInfo GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { return new ContentInfo(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); } public static ContentInfo GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) { return new ContentInfo(Asn1Sequence.GetTagged(taggedObject, declaredExplicit)); } private ContentInfo(Asn1Sequence seq) { int count = seq.Count; if (count < 1 || count > 2) throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq"); m_contentType = DerObjectIdentifier.GetInstance(seq[0]); if (seq.Count > 1) m_content = Asn1TaggedObject.GetInstance(seq[1], 128, 0).GetExplicitBaseObject(); } public ContentInfo(DerObjectIdentifier contentType, Asn1Encodable content) { if (contentType == null) throw new ArgumentNullException("contentType"); m_contentType = contentType; m_content = content; } public override Asn1Object ToAsn1Object() { if (m_content != null) return new BerSequence(m_contentType, new BerTaggedObject(0, m_content)); return new BerSequence(m_contentType); } } }