public void TestIsElementForPointAtInfinity()
        {
            var curve = new CurveGroupAlgebra(curveParameters);

            Assert.IsTrue(curve.IsPotentialElement(CurvePoint.PointAtInfinity), "IsPotentialElement not true for point at infinity!");
            Assert.IsFalse(curve.IsSafeElement(CurvePoint.PointAtInfinity), "IsSafeElement not false for point at infinity!");
        }
        public void TestIsElementForLowOrderCurvePoint()
        {
            var curve = new CurveGroupAlgebra(curveParameters);
            var point = new CurvePoint(10, 0);

            Assert.IsTrue(curve.IsPotentialElement(point), "IsPotentialElement not true for low order point!");
            Assert.IsFalse(curve.IsSafeElement(point), "IsSafeElement not false for low order point!");
        }
        public void TestIsElementForPointNotOnCurve(int rawX, int rawY)
        {
            var curve = new CurveGroupAlgebra(curveParameters);
            var point = new CurvePoint(rawX, rawY);

            Assert.IsFalse(curve.IsPotentialElement(point), "IsPotentialElement not true for point not on curve!");
            Assert.IsFalse(curve.IsSafeElement(point), "IsSafeElement not true for point not on curve!");
        }
        public void TestIsElementForValidPoint(int rawX, int rawY)
        {
            var curve = new CurveGroupAlgebra(curveParameters);
            var point = new CurvePoint(rawX, rawY);

            Assert.IsTrue(curve.IsPotentialElement(point), "IsPotentialElement not true for valid element!");
            Assert.IsTrue(curve.IsSafeElement(point), "IsSafeElement not true for valid element!");
        }
        public void TestIsElementForPointNotOnCurve(int xRaw, int yRaw)
        {
            var curveAlgebra = new CurveGroupAlgebra(curveParameters);
            var point        = new CurvePoint(xRaw, yRaw);

            Assert.IsFalse(curveAlgebra.IsPotentialElement(point), "IsPotentialElement not true for point not on curve!");
            Assert.IsFalse(curveAlgebra.IsSafeElement(point), "IsSafeElement not true for point not on curve!");
        }
        public void TestIsElementForValidPoint(int xRaw, int yRaw)
        {
            var curveAlgebra = new CurveGroupAlgebra(curveParameters);
            var point        = new CurvePoint(xRaw, yRaw);

            Assert.IsTrue(curveAlgebra.IsPotentialElement(point), "IsPotentialElement not true for valid element!");
            Assert.IsTrue(curveAlgebra.IsSafeElement(point), "IsSafeElement not true for valid element!");
        }
예제 #7
0
        public void TestIsElementForPointAtInfinity()
        {
            var curve = new CurveGroupAlgebra(curveParameters);

            curveEquationMock.Setup(eq => eq.Add(It.IsAny <CurvePoint>(), It.IsAny <CurvePoint>())).Returns(CurvePoint.PointAtInfinity);
            Assert.IsTrue(curve.IsPotentialElement(CurvePoint.PointAtInfinity), "IsPotentialElement not true for point at infinity!");
            Assert.IsFalse(curve.IsSafeElement(CurvePoint.PointAtInfinity), "IsSafeElement not false for point at infinity!");
        }
예제 #8
0
        public void TestIsElementForPointNotOnCurve()
        {
            var curve = new CurveGroupAlgebra(curveParameters);

            curveEquationMock.Setup(eq => eq.IsPointOnCurve(It.IsAny <CurvePoint>())).Returns(false);
            var point = new CurvePoint(16, 1);

            Assert.IsFalse(curve.IsPotentialElement(point), "IsPotentialElement not true for point not on curve!");
            Assert.IsFalse(curve.IsSafeElement(point), "IsSafeElement not true for point not on curve!");
        }
예제 #9
0
        public void TestIsElementForPointAtInfinityCofactorOne()
        {
            var parameters = new CurveParameters(
                curveParameters.Equation,
                curveParameters.Generator,
                curveParameters.Order,
                BigInteger.One
                );
            var curve = new CurveGroupAlgebra(parameters);

            curveEquationMock.Setup(eq => eq.Add(It.IsAny <CurvePoint>(), It.IsAny <CurvePoint>())).Returns(CurvePoint.PointAtInfinity);
            Assert.IsTrue(curve.IsPotentialElement(CurvePoint.PointAtInfinity), "IsPotentialElement not true for point at infinity!");
            Assert.IsFalse(curve.IsSafeElement(CurvePoint.PointAtInfinity), "IsSafeElement not false for point at infinity!");
        }