SecT131R1Curve.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using Org.BouncyCastle.Utilities.Encoders;
  4. namespace Org.BouncyCastle.Math.EC.Custom.Sec
  5. {
  6. internal class SecT131R1Curve
  7. : AbstractF2mCurve
  8. {
  9. private const int SecT131R1_DEFAULT_COORDS = COORD_LAMBDA_PROJECTIVE;
  10. protected readonly SecT131R1Point m_infinity;
  11. public SecT131R1Curve()
  12. : base(131, 2, 3, 8)
  13. {
  14. this.m_infinity = new SecT131R1Point(this, null, null);
  15. this.m_a = FromBigInteger(new BigInteger(1, Hex.Decode("07A11B09A76B562144418FF3FF8C2570B8")));
  16. this.m_b = FromBigInteger(new BigInteger(1, Hex.Decode("0217C05610884B63B9C6C7291678F9D341")));
  17. this.m_order = new BigInteger(1, Hex.Decode("0400000000000000023123953A9464B54D"));
  18. this.m_cofactor = BigInteger.Two;
  19. this.m_coord = SecT131R1_DEFAULT_COORDS;
  20. }
  21. protected override ECCurve CloneCurve()
  22. {
  23. return new SecT131R1Curve();
  24. }
  25. public override bool SupportsCoordinateSystem(int coord)
  26. {
  27. switch (coord)
  28. {
  29. case COORD_LAMBDA_PROJECTIVE:
  30. return true;
  31. default:
  32. return false;
  33. }
  34. }
  35. public override ECPoint Infinity
  36. {
  37. get { return m_infinity; }
  38. }
  39. public override int FieldSize
  40. {
  41. get { return 131; }
  42. }
  43. public override ECFieldElement FromBigInteger(BigInteger x)
  44. {
  45. return new SecT131FieldElement(x);
  46. }
  47. protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression)
  48. {
  49. return new SecT131R1Point(this, x, y, withCompression);
  50. }
  51. protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression)
  52. {
  53. return new SecT131R1Point(this, x, y, zs, withCompression);
  54. }
  55. public override bool IsKoblitz
  56. {
  57. get { return false; }
  58. }
  59. public virtual int M
  60. {
  61. get { return 131; }
  62. }
  63. public virtual bool IsTrinomial
  64. {
  65. get { return false; }
  66. }
  67. public virtual int K1
  68. {
  69. get { return 2; }
  70. }
  71. public virtual int K2
  72. {
  73. get { return 3; }
  74. }
  75. public virtual int K3
  76. {
  77. get { return 8; }
  78. }
  79. }
  80. }
  81. #endif