public void TestIsElementForPointAtInfinity() { var algebra = new EllipticCurveAlgebra(EllipticCurveID.Prime256v1); Assert.That(algebra.IsPotentialElement(algebra.NeutralElement), "point at infinity not accepted by IsPotentialElement!"); Assert.That(!algebra.IsSafeElement(algebra.NeutralElement), "point at infinity accepted by IsSafeElement!"); }
public void TestIsElement() { var algebra = new EllipticCurveAlgebra(EllipticCurveID.Prime256v1); var groupHandle = algebra.Handle; var ctx = BigNumberContextHandle.Create(); var index = new BigInteger(3); var point = new ECPoint(groupHandle); ECPointHandle.Multiply(groupHandle, point.Handle, new BigNumber(index).Handle, ECPointHandle.Null, BigNumberHandle.Null, ctx); Assert.That(algebra.IsPotentialElement(point), "valid point not accepted by IsPotentialElement!"); Assert.That(algebra.IsSafeElement(point), "valid point not accepted by IsSafeElement!"); }