Package java.security.spec

Examples of java.security.spec.ECFieldF2m


     * Test #2 for <code>getReductionPolynomial()</code> method.<br>
     *
     * Assertion: returns null for normal basis
     */
    public final void testGetReductionPolynomial02() {
        assertNull(new ECFieldF2m(2000).getReductionPolynomial());
    }
View Full Code Here


        // reference array
        int[] a = new int[] {367};
        // reference array copy
        int[] aCopy = a.clone();
        // create obj using copy
        ECFieldF2m f = new ECFieldF2m(1999, aCopy);
        // modify copy
        aCopy[0] = 5;
        // compare reference with returned array
        assertTrue(Arrays.equals(a, f.getMidTermsOfReductionPolynomial()));       
    }
View Full Code Here

        // 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()));       
    }
View Full Code Here

        byte[] seed = new byte[24];
        // perform test case 1
        new EllipticCurve(f, a, b, seed);

        // test case 2 parameters set
        ECFieldF2m f1 = new ECFieldF2m(5);
        a = BigInteger.ZERO;
        b = BigInteger.valueOf(23L);
        // perform test case 2
        new EllipticCurve(f1, a, b, seed);
View Full Code Here

     * Expected: must throw <code>IllegalArgumentException</code>
     */
    public final void testEllipticCurveECFieldBigIntegerBigIntegerbyteArray04() {
        // test case 1 parameters set,
        // a is not in field
        ECFieldF2m f = new ECFieldF2m(5);
        BigInteger a = BigInteger.valueOf(32L);
        BigInteger b = BigInteger.valueOf(19L);
        byte[] seed = new byte[24];

        // perform test case 1
        try {
            new EllipticCurve(f, a, b, seed);
            fail("#1: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {}

        // test case 2 parameters set,
        // b is not in field
        f = new ECFieldF2m(5);
        a = BigInteger.valueOf(19L);
        b = BigInteger.valueOf(32L);
        seed = new byte[24];
        // perform test case 2
        try {
            new EllipticCurve(f, a, b, seed);
            fail("#2: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {}

        // test case 3 parameters set,
        // both a and b are not in field
        f = new ECFieldF2m(5);
        a = BigInteger.valueOf(32L);
        b = BigInteger.valueOf(43L);
        seed = new byte[24];
        // perform test case 3
        try {
View Full Code Here

     * Assertion: array <code>seed</code> is copied to prevent subsequent modification<br>
     * Test preconditions: pass <code>seed</code> to the ctor then modify it<br>
     * Expected: getSeed() must return unmodified array
     */
    public final void testEllipticCurveECFieldBigIntegerBigIntegerbyteArray05() {
        ECFieldF2m f = new ECFieldF2m(5);
        BigInteger a = BigInteger.valueOf(0L);
        BigInteger b = BigInteger.valueOf(19L);
        byte[] seed = new byte[24];
        byte[] seedCopy = seed.clone();
        EllipticCurve c = new EllipticCurve(f, a, b, seedCopy);
View Full Code Here

        BigInteger b = BigInteger.valueOf(19L);
        // perform test case 1
        new EllipticCurve(f, a, b);

        // test case 2 parameters set
        ECFieldF2m f1 = new ECFieldF2m(5);
        a = BigInteger.ZERO;
        b = BigInteger.valueOf(23L);
        // perform test case 2
        new EllipticCurve(f1, a, b);
View Full Code Here

     * Expected: must throw <code>IllegalArgumentException</code>
     */
    public final void testEllipticCurveECFieldBigIntegerBigInteger04() {
        // test case 1 parameters set,
        // a is not in field
        ECFieldF2m f = new ECFieldF2m(5);
        BigInteger a = BigInteger.valueOf(32L);
        BigInteger b = BigInteger.valueOf(19L);
        // perform test case 1
        try {
            new EllipticCurve(f, a, b);
            fail("#1: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {}

        // test case 2 parameters set,
        // b is not in field
        f = new ECFieldF2m(5);
        a = BigInteger.valueOf(19L);
        b = BigInteger.valueOf(32L);
        // perform test case 2
        try {
            new EllipticCurve(f, a, b);
            fail("#2: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {}

        // test case 3 parameters set,
        // both a and b are not in field
        f = new ECFieldF2m(5);
        a = BigInteger.valueOf(32L);
        b = BigInteger.valueOf(43L);
        // perform test case 3
        try {
            new EllipticCurve(f, a, b);
View Full Code Here

     * Expected: must return coefficient <code>a</code> which is equal
     * to the one passed to the constructor; (both must refer
     * the same object)
     */
    public final void testGetA() {
        ECFieldF2m f = new ECFieldF2m(5);
        BigInteger a = BigInteger.valueOf(5L);
        BigInteger b = BigInteger.valueOf(19L);
        EllipticCurve c = new EllipticCurve(f, a, b);
        assertEquals(a, c.getA());
        assertSame(a, c.getA());
View Full Code Here

     * Expected: must return coefficient <code>b</code> which is equal
     * to the one passed to the constructor; (both must refer
     * the same object)
     */
    public final void testGetB() {
        ECFieldF2m f = new ECFieldF2m(5);
        BigInteger a = BigInteger.valueOf(5L);
        BigInteger b = BigInteger.valueOf(19L);
        EllipticCurve c = new EllipticCurve(f, a, b);
        assertEquals(b, c.getB());
        assertSame(b, c.getB());
View Full Code Here

TOP

Related Classes of java.security.spec.ECFieldF2m

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.