ScalarSplitParameters.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.Math.EC.Endo
  6. {
  7. public class ScalarSplitParameters
  8. {
  9. private static void CheckVector(BigInteger[] v, string name)
  10. {
  11. if (v == null || v.Length != 2 || v[0] == null || v[1] == null)
  12. throw new ArgumentException("Must consist of exactly 2 (non-null) values", name);
  13. }
  14. protected readonly BigInteger m_v1A, m_v1B, m_v2A, m_v2B;
  15. protected readonly BigInteger m_g1, m_g2;
  16. protected readonly int m_bits;
  17. public ScalarSplitParameters(BigInteger[] v1, BigInteger[] v2, BigInteger g1,
  18. BigInteger g2, int bits)
  19. {
  20. CheckVector(v1, "v1");
  21. CheckVector(v2, "v2");
  22. this.m_v1A = v1[0];
  23. this.m_v1B = v1[1];
  24. this.m_v2A = v2[0];
  25. this.m_v2B = v2[1];
  26. this.m_g1 = g1;
  27. this.m_g2 = g2;
  28. this.m_bits = bits;
  29. }
  30. public virtual BigInteger V1A
  31. {
  32. get { return m_v1A; }
  33. }
  34. public virtual BigInteger V1B
  35. {
  36. get { return m_v1B; }
  37. }
  38. public virtual BigInteger V2A
  39. {
  40. get { return m_v2A; }
  41. }
  42. public virtual BigInteger V2B
  43. {
  44. get { return m_v2B; }
  45. }
  46. public virtual BigInteger G1
  47. {
  48. get { return m_g1; }
  49. }
  50. public virtual BigInteger G2
  51. {
  52. get { return m_g2; }
  53. }
  54. public virtual int Bits
  55. {
  56. get { return m_bits; }
  57. }
  58. }
  59. }
  60. #pragma warning restore
  61. #endif