DHPrivateKeyParameters.cs 1.2 KB

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