Search in sources :

Example 21 with ECFieldF2m

use of java.security.spec.ECFieldF2m in project robovm by robovm.

the class ECFieldF2mTest method testGetMidTermsOfReductionPolynomial03.

/**
     * Test #3 for <code>getMidTermsOfReductionPolynomial()</code> method.<br>
     *
     * Assertion: returns mid terms of reduction polynomial
     */
public final void testGetMidTermsOfReductionPolynomial03() {
    int[] a = new int[] { 367 };
    int[] b = new ECFieldF2m(1999, a).getMidTermsOfReductionPolynomial();
    assertTrue(Arrays.equals(a, b));
}
Also used : ECFieldF2m(java.security.spec.ECFieldF2m)

Example 22 with ECFieldF2m

use of java.security.spec.ECFieldF2m in project robovm by robovm.

the class ECFieldF2mTest method testIsStatePreserved02.

/**
     * Tests that object state is preserved against
     * modifications through array reference returned by
     * <code>getMidTermsOfReductionPolynomial()</code> method.
     */
public final void testIsStatePreserved02() {
    // reference array
    int[] a = new int[] { 981, 2, 1 };
    // reference array copy
    int[] aCopy = a.clone();
    // create obj using copy
    ECFieldF2m f = new ECFieldF2m(2000, aCopy);
    // get array reference and modify returned array
    f.getMidTermsOfReductionPolynomial()[0] = 1532;
    // compare reference with returned for the second time array
    assertTrue(Arrays.equals(a, f.getMidTermsOfReductionPolynomial()));
}
Also used : ECFieldF2m(java.security.spec.ECFieldF2m)

Example 23 with ECFieldF2m

use of java.security.spec.ECFieldF2m in project robovm by robovm.

the class ECFieldF2mTest method testEqualsObject04.

/**
     * Test #4 for <code>equals()</code> method.<br>
     *
     * Assertion: pentanomial basis - objects equal if their m, and rp
     * are mutually equal.
     */
public final void testEqualsObject04() {
    ECFieldF2m f1 = new ECFieldF2m(2000, new int[] { 981, 2, 1 });
    ECFieldF2m f2 = new ECFieldF2m(2000, BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).setBit(981).setBit(2000));
    assertTrue(f1.equals(f2) && f2.equals(f1));
}
Also used : ECFieldF2m(java.security.spec.ECFieldF2m)

Example 24 with ECFieldF2m

use of java.security.spec.ECFieldF2m in project robovm by robovm.

the class ECFieldF2mTest method testEqualsObject01.

/**
     * Test #1 for <code>equals()</code> method.<br>
     *
     * Assertion: object equals to itself.
     */
public final void testEqualsObject01() {
    ECFieldF2m obj = new ECFieldF2m(1999, new int[] { 367 });
    assertTrue(obj.equals(obj));
}
Also used : ECFieldF2m(java.security.spec.ECFieldF2m)

Example 25 with ECFieldF2m

use of java.security.spec.ECFieldF2m in project j2objc by google.

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);
}
Also used : EllipticCurve(java.security.spec.EllipticCurve) ECParameterSpec(java.security.spec.ECParameterSpec) ECFieldF2m(java.security.spec.ECFieldF2m) ECPoint(java.security.spec.ECPoint) ECPublicKeySpec(java.security.spec.ECPublicKeySpec)

Aggregations

ECFieldF2m (java.security.spec.ECFieldF2m)50 EllipticCurve (java.security.spec.EllipticCurve)28 BigInteger (java.math.BigInteger)22 ECFieldFp (java.security.spec.ECFieldFp)12 ECPoint (java.security.spec.ECPoint)10 ECParameterSpec (java.security.spec.ECParameterSpec)7 ECField (java.security.spec.ECField)4 ECCurve (org.bouncycastle.math.ec.ECCurve)4 ECPrivateKeySpec (java.security.spec.ECPrivateKeySpec)2 ECPublicKeySpec (java.security.spec.ECPublicKeySpec)2 InvalidParameterException (java.security.InvalidParameterException)1