DHGroup.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto
  6. {
  7. /// <summary>Carrier class for Diffie-Hellman group parameters.</summary>
  8. public class DHGroup
  9. {
  10. private readonly BigInteger g, p, q;
  11. private readonly int l;
  12. /// <summary>Base constructor with the prime factor of (p - 1).</summary>
  13. /// <param name="p">the prime modulus.</param>
  14. /// <param name="q">specifies the prime factor of (p - 1).</param>
  15. /// <param name="g">the base generator.</param>
  16. /// <param name="l"></param>
  17. public DHGroup(BigInteger p, BigInteger q, BigInteger g, int l)
  18. {
  19. this.p = p;
  20. this.g = g;
  21. this.q = q;
  22. this.l = l;
  23. }
  24. public virtual BigInteger G
  25. {
  26. get { return g; }
  27. }
  28. public virtual int L
  29. {
  30. get { return l; }
  31. }
  32. public virtual BigInteger P
  33. {
  34. get { return p; }
  35. }
  36. public virtual BigInteger Q
  37. {
  38. get { return q; }
  39. }
  40. }
  41. }
  42. #pragma warning restore
  43. #endif