Package java.security.spec

Examples of java.security.spec.EllipticCurve


      * as mentioned parameter value<br>
      * Expected: must throw <code>IllegalArgumentException</code>
      */
     public final void testECPublicKeySpec03() {
         // Valid (see note below) parameters set
         EllipticCurve c =
             new EllipticCurve(new ECFieldFp(BigInteger.valueOf(5L)),
                               BigInteger.ZERO,
                               BigInteger.valueOf(4L));
         ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));

         try {
View Full Code Here


     * to the one passed to the constructor; (both must refer
     * the same object)
     */
    public final void testGetParams() {
        // Valid (see note below) parameters set
        EllipticCurve c =
            new EllipticCurve(new ECFieldFp(BigInteger.valueOf(5L)),
                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        ECParameterSpec params =
            new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10);
View Full Code Here

     * to the one passed to the constructor; (both must refer
     * the same object)
     */
    public final void testGetW() {
        // Valid (see note below) parameters set
        EllipticCurve c =
            new EllipticCurve(new ECFieldFp(BigInteger.valueOf(5L)),
                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        ECParameterSpec params =
            new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10);
View Full Code Here

    public final void testGetSeed01() {
        ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
        BigInteger a = BigInteger.ONE;
        BigInteger b = BigInteger.valueOf(19L);
        byte[] seed = new byte[24];
        EllipticCurve c = new EllipticCurve(f, a, b, seed);
        byte[] seedRet = c.getSeed();
        assertNotNull(seedRet);
        assertTrue(Arrays.equals(seed, seedRet));
    }
View Full Code Here

    public final void testGetSeed02() {
        ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
        BigInteger a = BigInteger.ONE;
        BigInteger b = BigInteger.valueOf(19L);
        byte[] seed = new byte[24];
        EllipticCurve c = new EllipticCurve(f, a, b, seed.clone());
        byte[] seedRet = c.getSeed();
        // modify returned array
        seedRet[0] = (byte) 1;
        // check that above modification did not changed
        // internal state of test object
        assertTrue(Arrays.equals(seed, c.getSeed()));
    }
View Full Code Here

    public final void testGetSeed03() {
        ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
        BigInteger a = BigInteger.ONE;
        BigInteger b = BigInteger.valueOf(19L);
        byte[] seed = new byte[24];
        EllipticCurve c = new EllipticCurve(f, a, b, seed);
        c.getSeed();
        assertNotSame(c.getSeed(), c.getSeed());
    }
View Full Code Here

     */
    public final void testGetSeed04() {
        //Regression for HARMONY-732
        ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
        BigInteger a = BigInteger.ONE;
        assertNull(new EllipticCurve(f, a, a).getSeed());
    }
View Full Code Here

     * 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
        EllipticCurve c2 = null, c1 = new EllipticCurve(new ECFieldFp(
                BigInteger.valueOf(23L)), BigInteger.ONE, BigInteger
                .valueOf(19L));
        assertTrue(c1.equals(c1));

        // test case 2: equal objects
        c1 = new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.ONE, BigInteger.valueOf(19L));
        c2 = new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.valueOf(1L), BigInteger.valueOf(19L));
        assertTrue(c1.equals(c2) && c2.equals(c1));

        // test case 3: equal objects with seed not null
        c1 = new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.ONE, BigInteger.valueOf(19L), new byte[24]);
        c2 = new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.valueOf(1L), BigInteger.valueOf(19L), new byte[24]);
        assertTrue(c1.equals(c2) && c2.equals(c1));

        // test case 4: equal object and subclass object
        c1 = new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.ONE, BigInteger.valueOf(19L), new byte[24]);
        MyEllipticCurve c3 = new MyEllipticCurve(new ECFieldFp(BigInteger
                .valueOf(23L)), BigInteger.ONE, BigInteger.valueOf(19L),
                new byte[24]);
        assertTrue(c1.equals(c3) && c3.equals(c1));

        // test case 5: equal objects
        c1 = new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.ONE, BigInteger.valueOf(19L));
        c2 = new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.valueOf(1L), BigInteger.valueOf(19L), null);
        assertTrue(c1.equals(c2) && c2.equals(c1));
    }
View Full Code Here

     * Assertion: must return the same value if invoked
     * repeatedly on the same object.
     */
    public final void testHashCode01() {
        int hc = 0;
        EllipticCurve f = new EllipticCurve(new ECFieldFp(BigInteger
                .valueOf(23L)), BigInteger.ONE, BigInteger.valueOf(19L),
                new byte[24]);
        hc = f.hashCode();
        assertTrue(hc == f.hashCode() && hc == f.hashCode()
                && hc == f.hashCode() && hc == f.hashCode()
                && hc == f.hashCode() && hc == f.hashCode()
                && hc == f.hashCode() && hc == f.hashCode());
    }
View Full Code Here

     *
     * Assertion: must return the same value if invoked
     * on equal (according to the <code>equals(Object)</code> method) objects.
     */
    public final void testHashCode02() {
        assertEquals(new EllipticCurve(new ECFieldFp(BigInteger.valueOf(23L)),
                BigInteger.ONE, BigInteger.valueOf(19L), new byte[24])
                .hashCode(), new EllipticCurve(new ECFieldFp(BigInteger
                .valueOf(23L)), BigInteger.ONE, BigInteger.valueOf(19L),
                new byte[24]).hashCode());
    }
View Full Code Here

TOP

Related Classes of java.security.spec.EllipticCurve

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.