DHPublicKeyParameters.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 DHPublicKeyParameters
  8. : DHKeyParameters
  9. {
  10. private readonly BigInteger y;
  11. public DHPublicKeyParameters(
  12. BigInteger y,
  13. DHParameters parameters)
  14. : base(false, parameters)
  15. {
  16. if (y == null)
  17. throw new ArgumentNullException("y");
  18. this.y = y;
  19. }
  20. public DHPublicKeyParameters(
  21. BigInteger y,
  22. DHParameters parameters,
  23. DerObjectIdentifier algorithmOid)
  24. : base(false, parameters, algorithmOid)
  25. {
  26. if (y == null)
  27. throw new ArgumentNullException("y");
  28. this.y = y;
  29. }
  30. public BigInteger Y
  31. {
  32. get { return y; }
  33. }
  34. public override bool Equals(
  35. object obj)
  36. {
  37. if (obj == this)
  38. return true;
  39. DHPublicKeyParameters other = obj as DHPublicKeyParameters;
  40. if (other == null)
  41. return false;
  42. return Equals(other);
  43. }
  44. protected bool Equals(
  45. DHPublicKeyParameters other)
  46. {
  47. return y.Equals(other.y) && base.Equals(other);
  48. }
  49. public override int GetHashCode()
  50. {
  51. return y.GetHashCode() ^ base.GetHashCode();
  52. }
  53. }
  54. }
  55. #endif