X509CertificateEntry.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System.Collections.Generic;
  4. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  5. using Best.HTTP.SecureProtocol.Org.BouncyCastle.X509;
  6. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Pkcs
  7. {
  8. public class X509CertificateEntry
  9. : Pkcs12Entry
  10. {
  11. private readonly X509Certificate cert;
  12. public X509CertificateEntry(X509Certificate cert)
  13. : base(new Dictionary<DerObjectIdentifier, Asn1Encodable>())
  14. {
  15. this.cert = cert;
  16. }
  17. public X509CertificateEntry(X509Certificate cert, IDictionary<DerObjectIdentifier, Asn1Encodable> attributes)
  18. : base(attributes)
  19. {
  20. this.cert = cert;
  21. }
  22. public X509Certificate Certificate
  23. {
  24. get { return this.cert; }
  25. }
  26. public override bool Equals(object obj)
  27. {
  28. X509CertificateEntry other = obj as X509CertificateEntry;
  29. if (other == null)
  30. return false;
  31. return cert.Equals(other.cert);
  32. }
  33. public override int GetHashCode()
  34. {
  35. return ~cert.GetHashCode();
  36. }
  37. }
  38. }
  39. #pragma warning restore
  40. #endif