ElGamalPrivateKeyParameters.cs 1.0 KB

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