RsaKeyGenerationParameters.cs 1.4 KB

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