RsaKeyGenerationParameters.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using Org.BouncyCastle.Crypto;
  4. using Org.BouncyCastle.Math;
  5. using Org.BouncyCastle.Security;
  6. namespace Org.BouncyCastle.Crypto.Parameters
  7. {
  8. public class RsaKeyGenerationParameters
  9. : KeyGenerationParameters
  10. {
  11. private readonly BigInteger publicExponent;
  12. private readonly int certainty;
  13. public RsaKeyGenerationParameters(
  14. BigInteger publicExponent,
  15. SecureRandom random,
  16. int strength,
  17. int certainty)
  18. : base(random, strength)
  19. {
  20. this.publicExponent = publicExponent;
  21. this.certainty = certainty;
  22. }
  23. public BigInteger PublicExponent
  24. {
  25. get { return publicExponent; }
  26. }
  27. public int Certainty
  28. {
  29. get { return certainty; }
  30. }
  31. public override bool Equals(
  32. object obj)
  33. {
  34. RsaKeyGenerationParameters other = obj as RsaKeyGenerationParameters;
  35. if (other == null)
  36. {
  37. return false;
  38. }
  39. return certainty == other.certainty
  40. && publicExponent.Equals(other.publicExponent);
  41. }
  42. public override int GetHashCode()
  43. {
  44. return certainty.GetHashCode() ^ publicExponent.GetHashCode();
  45. }
  46. }
  47. }
  48. #endif