private static IFiniteField BuildField(int m, int k1, int k2, int k3)
 {
     if (k1 == 0)
     {
         throw new ArgumentException("k1 must be > 0");
     }
     if (k2 == 0)
     {
         if (k3 != 0)
         {
             throw new ArgumentException("k3 must be 0 if k2 == 0");
         }
         int[] numArray1 = new int[3];
         numArray1[1] = k1;
         numArray1[2] = m;
         return(FiniteFields.GetBinaryExtensionField(numArray1));
     }
     if (k2 <= k1)
     {
         throw new ArgumentException("k2 must be > k1");
     }
     if (k3 <= k2)
     {
         throw new ArgumentException("k3 must be > k2");
     }
     int[] exponents = new int[5];
     exponents[1] = k1;
     exponents[2] = k2;
     exponents[3] = k3;
     exponents[4] = m;
     return(FiniteFields.GetBinaryExtensionField(exponents));
 }
Exemple #2
0
        private static IFiniteField BuildField(int m, int k1, int k2, int k3)
        {
            if (k1 == 0)
            {
                throw new ArgumentException("k1 must be > 0");
            }

            if (k2 == 0)
            {
                if (k3 != 0)
                {
                    throw new ArgumentException("k3 must be 0 if k2 == 0");
                }

                return(FiniteFields.GetBinaryExtensionField(new int[] { 0, k1, m }));
            }

            if (k2 <= k1)
            {
                throw new ArgumentException("k2 must be > k1");
            }

            if (k3 <= k2)
            {
                throw new ArgumentException("k3 must be > k2");
            }

            return(FiniteFields.GetBinaryExtensionField(new int[] { 0, k1, k2, k3, m }));
        }
 private static IFiniteField BuildField(int m, int k1, int k2, int k3)
 {
     //IL_0008: Unknown result type (might be due to invalid IL or missing references)
     //IL_0019: Unknown result type (might be due to invalid IL or missing references)
     //IL_003e: Unknown result type (might be due to invalid IL or missing references)
     //IL_004d: Unknown result type (might be due to invalid IL or missing references)
     if (k1 == 0)
     {
         throw new ArgumentException("k1 must be > 0");
     }
     if (k2 == 0)
     {
         if (k3 != 0)
         {
             throw new ArgumentException("k3 must be 0 if k2 == 0");
         }
         return(FiniteFields.GetBinaryExtensionField(new int[3] {
             0, k1, m
         }));
     }
     if (k2 <= k1)
     {
         throw new ArgumentException("k2 must be > k1");
     }
     if (k3 <= k2)
     {
         throw new ArgumentException("k3 must be > k2");
     }
     return(FiniteFields.GetBinaryExtensionField(new int[5] {
         0, k1, k2, k3, m
     }));
 }
Exemple #4
0
        public SecP224K1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP224K1Point(this, null, null);

            this.m_a        = FromBigInteger(BigInteger.Zero);
            this.m_b        = FromBigInteger(BigInteger.ValueOf(5));
            this.m_order    = new BigInteger(1, Hex.Decode("010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7"));
            this.m_cofactor = BigInteger.One;
            this.m_coord    = SECP224K1_DEFAULT_COORDS;
        }
Exemple #5
0
        public SecP256K1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP256K1Point(this, null, null);

            this.m_a        = FromBigInteger(BigInteger.Zero);
            this.m_b        = FromBigInteger(BigInteger.ValueOf(7));
            this.m_order    = new BigInteger(1, Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"));
            this.m_cofactor = BigInteger.One;
            this.m_coord    = SECP256K1_DEFAULT_COORDS;
        }
Exemple #6
0
        public SecP192K1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP192K1Point(this, null, null);

            this.m_a        = FromBigInteger(BigInteger.Zero);
            this.m_b        = FromBigInteger(BigInteger.ValueOf(3));
            this.m_order    = new BigInteger(1, Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D"));
            this.m_cofactor = BigInteger.One;
            this.m_coord    = SECP192K1_DEFAULT_COORDS;
        }
Exemple #7
0
        public SecP521R1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP521R1Point(this, null, null);

            this.m_a = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC")));
            this.m_b = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00")));
            this.m_order    = new BigInteger(1, Hex.Decode("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409"));
            this.m_cofactor = BigInteger.One;
            this.m_coord    = SecP521R1_DEFAULT_COORDS;
        }
Exemple #8
0
        public SecP384R1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP384R1Point(this, null, null);

            this.m_a = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC")));
            this.m_b = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF")));
            this.m_order    = new BigInteger(1, Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973"));
            this.m_cofactor = BigInteger.One;
            this.m_coord    = SecP384R1_DEFAULT_COORDS;
        }
Exemple #9
0
        public SecP256R1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP256R1Point(this, null, null);

            this.m_a = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC")));
            this.m_b = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B")));
            this.m_order    = new BigInteger(1, Hex.Decode("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"));
            this.m_cofactor = BigInteger.One;
            this.m_coord    = SecP256R1_DEFAULT_COORDS;
        }
Exemple #10
0
        protected FpCurve(BigInteger q, BigInteger r, ECFieldElement a, ECFieldElement b, BigInteger order, BigInteger cofactor)
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_q        = q;
            this.m_r        = r;
            this.m_infinity = new FpPoint(this, null, null);

            this.m_a        = a;
            this.m_b        = b;
            this.m_order    = order;
            this.m_cofactor = cofactor;
            this.m_coord    = FP_DEFAULT_COORDS;
        }
Exemple #11
0
        public FpCurve(BigInteger q, BigInteger a, BigInteger b, BigInteger order, BigInteger cofactor)
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_q        = q;
            this.m_r        = FpFieldElement.CalculateResidue(q);
            this.m_infinity = new FpPoint(this, null, null);

            this.m_a        = FromBigInteger(a);
            this.m_b        = FromBigInteger(b);
            this.m_order    = order;
            this.m_cofactor = cofactor;
            this.m_coord    = FP_DEFAULT_COORDS;
        }
Exemple #12
0
        public Curve25519()
            :   base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new Curve25519Point(this, null, null);

            this.m_a = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA984914A144")));
            this.m_b = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("7B425ED097B425ED097B425ED097B425ED097B425ED097B4260B5E9C7710C864")));
            this.m_order    = new BigInteger(1, Hex.Decode("1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED"));
            this.m_cofactor = BigInteger.ValueOf(8);
            this.m_coord    = Curve25519_DEFAULT_COORDS;
        }
        public SecP192R1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP192R1Point(this, null, null);

            this.m_a = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC")));
            this.m_b = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1")));
            this.m_order    = new BigInteger(1, Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"));
            this.m_cofactor = BigInteger.One;

            this.m_coord = SecP192R1_DEFAULT_COORDS;
        }
Exemple #14
0
        public SecP224R1Curve()
            : base(FiniteFields.GetPrimeField(q))
        {
            this.m_infinity = new SecP224R1Point(this, null, null);

            this.m_a = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE")));
            this.m_b = FromBigInteger(new BigInteger(1,
                                                     Hex.Decode("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4")));
            this.m_order    = new BigInteger(1, Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"));
            this.m_cofactor = BigInteger.One;

            this.m_coord = SecP224R1_DEFAULT_COORDS;
        }
Exemple #15
0
 protected AbstractFpCurve(BigInteger q)
     : base(FiniteFields.GetPrimeField(q))
 {
 }