use of java.security.spec.ECPoint in project robovm by robovm.
the class ECPublicKeySpecTest method setUp.
protected void setUp() throws Exception {
super.setUp();
ECPoint ecpoint = new ECPoint(BigInteger.valueOf(1), BigInteger.valueOf(1));
EllipticCurve curve = new EllipticCurve(new ECFieldF2m(2), BigInteger.valueOf(1), BigInteger.valueOf(1));
w = new ECPoint(BigInteger.valueOf(1), BigInteger.valueOf(1));
params = new ECParameterSpec(curve, ecpoint, BigInteger.valueOf(1), 1);
ecpks = new ECPublicKeySpec(w, params);
}
use of java.security.spec.ECPoint in project robovm by robovm.
the class ECParameterSpecTest method setUp.
protected void setUp() throws Exception {
super.setUp();
curve = new EllipticCurve(new ECFieldF2m(2), BigInteger.valueOf(1), BigInteger.valueOf(1));
ecpoint = new ECPoint(BigInteger.valueOf(1), BigInteger.valueOf(1));
ecps = new ECParameterSpec(curve, ecpoint, BigInteger.valueOf(1), 1);
}
use of java.security.spec.ECPoint in project robovm by robovm.
the class ECPointTest method testEqualsObject02.
/**
* Test #2 for <code>equals(Object other)</code> method<br>
* Assertion: return false if this and other objects are not equal<br>
* Test preconditions: see test comments<br>
* Expected: all objects in this test must be not equal
*/
public final void testEqualsObject02() {
// test case 1: must be not equal to null
ECPoint p2 = null, p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
assertFalse(p1.equals(p2));
// test case 2: not equal objects - x
p1 = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
assertFalse(p1.equals(p2) || p2.equals(p1));
// test case 3: not equal objects - y
p1 = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ZERO);
assertFalse(p1.equals(p2) || p2.equals(p1));
// test case 4: not equal - some point and POINT_INFINITY
p1 = ECPoint.POINT_INFINITY;
p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ZERO);
assertFalse(p1.equals(p2) || p2.equals(p1));
}
use of java.security.spec.ECPoint in project robovm by robovm.
the class ECPointTest method testGetAffineX01.
/**
* Test #1 for <code>getAffineX()</code> method<br>
* Assertion: returns affine <code>x</code> coordinate<br>
* Test preconditions: <code>ECPoint</code> instance
* created using valid parameters<br>
* Expected: must return affine <code>x</code> coordinate
* which is equal to the one passed to the constructor;
* (both must refer the same object)
*/
public final void testGetAffineX01() {
BigInteger x = BigInteger.valueOf(-23456L);
ECPoint p = new ECPoint(x, BigInteger.valueOf(23456L));
BigInteger xRet = p.getAffineX();
assertEquals(x, xRet);
assertSame(x, xRet);
}
use of java.security.spec.ECPoint in project robovm by robovm.
the class ECPointTest method testEqualsObject01.
/**
* Test #1 for <code>equals(Object other)</code> method<br>
* Assertion: return true if this and other objects are equal<br>
* Test preconditions: see test comments<br>
* Expected: all objects in this test must be equal
*/
public final void testEqualsObject01() {
// test case 1: must be equal to itself
ECPoint p2 = null, p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
assertTrue(p1.equals(p1));
// test case 2: equal objects
p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
assertTrue(p1.equals(p2) && p2.equals(p1));
// test case 3: equal POINT_INFINITY object(s)
p1 = ECPoint.POINT_INFINITY;
p2 = ECPoint.POINT_INFINITY;
assertTrue(p1.equals(p2) && p2.equals(p1));
}
Aggregations