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

KeySpecificInfo

using System; namespace Org.BouncyCastle.Asn1.X9 { public class KeySpecificInfo : Asn1Encodable { private readonly DerObjectIdentifier m_algorithm; private readonly Asn1OctetString m_counter; public DerObjectIdentifier Algorithm => m_algorithm; public Asn1OctetString Counter => m_counter; public static KeySpecificInfo GetInstance(object obj) { if (obj == null) return null; KeySpecificInfo keySpecificInfo = obj as KeySpecificInfo; if (keySpecificInfo != null) return keySpecificInfo; return new KeySpecificInfo(Asn1Sequence.GetInstance(obj)); } public static KeySpecificInfo GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { return new KeySpecificInfo(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); } public static KeySpecificInfo GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) { return new KeySpecificInfo(Asn1Sequence.GetTagged(taggedObject, declaredExplicit)); } [Obsolete("Use 'GetInstance' instead")] public KeySpecificInfo(Asn1Sequence seq) { int count = seq.Count; if (count != 2) throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq"); m_algorithm = DerObjectIdentifier.GetInstance(seq[0]); m_counter = Asn1OctetString.GetInstance(seq[1]); } public KeySpecificInfo(DerObjectIdentifier algorithm, Asn1OctetString counter) { if (algorithm == null) throw new ArgumentNullException("algorithm"); m_algorithm = algorithm; if (counter == null) throw new ArgumentNullException("counter"); m_counter = counter; } public override Asn1Object ToAsn1Object() { return new DerSequence(m_algorithm, m_counter); } } }