ElGamalKeyParameters.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using Org.BouncyCastle.Utilities;
  4. namespace Org.BouncyCastle.Crypto.Parameters
  5. {
  6. public class ElGamalKeyParameters
  7. : AsymmetricKeyParameter
  8. {
  9. private readonly ElGamalParameters parameters;
  10. protected ElGamalKeyParameters(
  11. bool isPrivate,
  12. ElGamalParameters parameters)
  13. : base(isPrivate)
  14. {
  15. // TODO Should we allow 'parameters' to be null?
  16. this.parameters = parameters;
  17. }
  18. public ElGamalParameters Parameters
  19. {
  20. get { return parameters; }
  21. }
  22. public override bool Equals(
  23. object obj)
  24. {
  25. if (obj == this)
  26. return true;
  27. ElGamalKeyParameters other = obj as ElGamalKeyParameters;
  28. if (other == null)
  29. return false;
  30. return Equals(other);
  31. }
  32. protected bool Equals(
  33. ElGamalKeyParameters other)
  34. {
  35. return Org.BouncyCastle.Utilities.Platform.Equals(parameters, other.parameters)
  36. && base.Equals(other);
  37. }
  38. public override int GetHashCode()
  39. {
  40. int hc = base.GetHashCode();
  41. if (parameters != null)
  42. {
  43. hc ^= parameters.GetHashCode();
  44. }
  45. return hc;
  46. }
  47. }
  48. }
  49. #endif