DHPrivateKeyParameters.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
  7. {
  8. public class DHPrivateKeyParameters
  9. : DHKeyParameters
  10. {
  11. private readonly BigInteger x;
  12. public DHPrivateKeyParameters(
  13. BigInteger x,
  14. DHParameters parameters)
  15. : base(true, parameters)
  16. {
  17. this.x = x;
  18. }
  19. public DHPrivateKeyParameters(
  20. BigInteger x,
  21. DHParameters parameters,
  22. DerObjectIdentifier algorithmOid)
  23. : base(true, parameters, algorithmOid)
  24. {
  25. this.x = x;
  26. }
  27. public BigInteger X
  28. {
  29. get { return x; }
  30. }
  31. public override bool Equals(
  32. object obj)
  33. {
  34. if (obj == this)
  35. return true;
  36. DHPrivateKeyParameters other = obj as DHPrivateKeyParameters;
  37. if (other == null)
  38. return false;
  39. return Equals(other);
  40. }
  41. protected bool Equals(
  42. DHPrivateKeyParameters other)
  43. {
  44. return x.Equals(other.x) && base.Equals(other);
  45. }
  46. public override int GetHashCode()
  47. {
  48. return x.GetHashCode() ^ base.GetHashCode();
  49. }
  50. }
  51. }
  52. #pragma warning restore
  53. #endif