PemHeader.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem
  5. {
  6. public class PemHeader
  7. {
  8. private string name;
  9. private string val;
  10. public PemHeader(string name, string val)
  11. {
  12. this.name = name;
  13. this.val = val;
  14. }
  15. public virtual string Name
  16. {
  17. get { return name; }
  18. }
  19. public virtual string Value
  20. {
  21. get { return val; }
  22. }
  23. public override int GetHashCode()
  24. {
  25. return GetHashCode(this.name) + 31 * GetHashCode(this.val);
  26. }
  27. public override bool Equals(object obj)
  28. {
  29. if (obj == this)
  30. return true;
  31. if (!(obj is PemHeader))
  32. return false;
  33. PemHeader other = (PemHeader)obj;
  34. return BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.Equals(this.name, other.name)
  35. && BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.Equals(this.val, other.val);
  36. }
  37. private int GetHashCode(string s)
  38. {
  39. if (s == null)
  40. {
  41. return 1;
  42. }
  43. return s.GetHashCode();
  44. }
  45. public override string ToString()
  46. {
  47. return name + ":" + val;
  48. }
  49. }
  50. }
  51. #pragma warning restore
  52. #endif