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

RespID

public class RespID : IEquatable<RespID>
using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Ocsp; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Security; using Org.BouncyCastle.X509; using System; namespace Org.BouncyCastle.Ocsp { public class RespID : IEquatable<RespID> { private readonly ResponderID m_id; public RespID(ResponderID id) { if (id == null) throw new ArgumentNullException("id"); m_id = id; } public RespID(X509Name name) { m_id = new ResponderID(name); } public RespID(AsymmetricKeyParameter publicKey) { try { byte[] bytes = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey).PublicKey.GetBytes(); byte[] contents = DigestUtilities.CalculateDigest("SHA1", bytes); m_id = new ResponderID(new DerOctetString(contents)); } catch (Exception ex) { throw new OcspException("problem creating ID: " + ex?.ToString(), ex); } } public ResponderID ToAsn1Object() { return m_id; } public bool Equals(RespID other) { if (this != other) return m_id.Equals(other?.m_id); return true; } public override bool Equals(object obj) { return Equals(obj as RespID); } public override int GetHashCode() { return m_id.GetHashCode(); } } }