예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CurveParameters"/> struct
 /// with the given values.
 /// </summary>
 /// <returns><see cref="CurveParameters"/> instance with the given
 /// parameters.</returns>
 /// <param name="curveEquation">The <see cref="CurveEquation"/> describing the curve.</param>
 /// <param name="generator">Curve generator point.</param>
 /// <param name="order">Generator order.</param>
 /// <param name="cofactor">Curve cofactor.</param>
 public CurveParameters(
     CurveEquation curveEquation,
     CurvePoint generator,
     BigPrime order,
     BigInteger cofactor
     )
 {
     Equation  = curveEquation;
     Generator = generator;
     Order     = order;
     Cofactor  = cofactor;
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CurveGroupAlgebra"/> class.
 /// </summary>
 /// <param name="parameters">The parameters of the elliptic curve.</param>
 public CurveGroupAlgebra(CurveParameters parameters)
     : base(
         parameters.Generator,
         parameters.Order,
         parameters.Cofactor,
         CurvePoint.PointAtInfinity,
         2 * NumberLength.GetLength(parameters.Equation.Field.Modulo).InBits
         )
 {
     _curveEquation = parameters.Equation;
     if (!IsSafeElement(Generator))
     {
         throw new ArgumentException("The point given as generator is " +
                                     "not a valid point on the curve.", nameof(parameters));
     }
 }