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

ContentHints

public class ContentHints : Asn1Encodable
using System; namespace Org.BouncyCastle.Asn1.Ess { public class ContentHints : Asn1Encodable { private readonly DerUtf8String m_contentDescription; private readonly DerObjectIdentifier m_contentType; public DerObjectIdentifier ContentType => m_contentType; public DerUtf8String ContentDescription => m_contentDescription; public static ContentHints GetInstance(object o) { if (o == null) return null; ContentHints contentHints = o as ContentHints; if (contentHints != null) return contentHints; return new ContentHints(Asn1Sequence.GetInstance(o)); } public static ContentHints GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { return new ContentHints(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); } public static ContentHints GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) { return new ContentHints(Asn1Sequence.GetTagged(taggedObject, declaredExplicit)); } private ContentHints(Asn1Sequence seq) { int count = seq.Count; int sequencePosition = 0; if (count < 1 || count > 2) throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq"); m_contentDescription = Asn1Utilities.ReadOptional(seq, ref sequencePosition, DerUtf8String.GetOptional); m_contentType = DerObjectIdentifier.GetInstance(seq[sequencePosition++]); if (sequencePosition != count) throw new ArgumentException("Unexpected elements in sequence", "seq"); } public ContentHints(DerObjectIdentifier contentType) : this(contentType, null) { } public ContentHints(DerObjectIdentifier contentType, DerUtf8String contentDescription) { if (contentType == null) throw new ArgumentNullException("contentType"); m_contentType = contentType; m_contentDescription = contentDescription; } public override Asn1Object ToAsn1Object() { if (m_contentDescription != null) return new DerSequence(m_contentDescription, m_contentType); return new DerSequence(m_contentType); } } }