Package java.security.spec

Examples of java.security.spec.ECParameterSpec


        if (spec == null)
        {
            EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());

            this.ecSpec = new ECParameterSpec(
                            ellipticCurve,
                            new ECPoint(
                                    dp.getG().getX().toBigInteger(),
                                    dp.getG().getY().toBigInteger()),
                            dp.getN(),
                            dp.getH().intValue());
        }
        else
        {
            EllipticCurve ellipticCurve = EC5Util.convertCurve(spec.getCurve(), spec.getSeed());
           
            this.ecSpec = new ECParameterSpec(
                                ellipticCurve,
                                new ECPoint(
                                        spec.getG().getX().toBigInteger(),
                                        spec.getG().getY().toBigInteger()),
                                spec.getN(),
View Full Code Here


        else
        {
            X9ECParameters      ecP = new X9ECParameters((ASN1Sequence)params.getParameters());
            EllipticCurve       ellipticCurve = EC5Util.convertCurve(ecP.getCurve(), ecP.getSeed());

            this.ecSpec = new ECParameterSpec(
                ellipticCurve,
                new ECPoint(
                        ecP.getG().getX().toBigInteger(),
                        ecP.getG().getY().toBigInteger()),
                ecP.getN(),
View Full Code Here

        EllipticCurve c =
            new EllipticCurve(new ECFieldFp(BigInteger.valueOf(5L)),
                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10);       
    }
View Full Code Here

        ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        BigInteger order = BigInteger.valueOf(5L);

        // Test case 1: curve is null
        try {
            new ECParameterSpec(null, generator, order, 10);
            fail("#1: Expected NPE not thrown");
        } catch (NullPointerException ok) {
        }


        // Test case 2: generator is null
        try {
            new ECParameterSpec(curve, null, order, 10);
            fail("#2: Expected NPE not thrown");
        } catch (NullPointerException ok) {
        }


        // Test case 3: order is null
        try {
            new ECParameterSpec(curve, generator, null, 10);
            fail("#3: Expected NPE not thrown");
        } catch (NullPointerException ok) {
        }


        // Test case 4: all above are null
        try {
            new ECParameterSpec(null, null, null, 10);
            fail("#4: Expected NPE not thrown");
        } catch (NullPointerException ok) {
        }
    }
View Full Code Here

        ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));


        // Test case 1: order is negative
        try {
            new ECParameterSpec(curve, generator, BigInteger.valueOf(-5L), 10);
            fail("#1: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {
        }


        // Test case 2: order == 0
        try {
            new ECParameterSpec(curve, generator, BigInteger.ZERO, 10);
            fail("#2: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {
        }


        // Test case 3: cofactor is negative
        try {
            new ECParameterSpec(curve, generator, BigInteger.valueOf(5L), -10);
            fail("#3: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {
        }


        // Test case 4: cofactor == 0
        try {
            new ECParameterSpec(curve, generator, BigInteger.valueOf(5L), 0);
            fail("#4: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {
        }


        // Test case 5: both order and cofactor are not positive
        try {
            new ECParameterSpec(curve, generator, BigInteger.valueOf(-5L), 0);
            fail("#5: Expected IAE not thrown");
        } catch (IllegalArgumentException ok) {
        }
    }
View Full Code Here

                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        BigInteger order = BigInteger.valueOf(5L);
        int cofactor = 10;
        ECParameterSpec ps =
            new ECParameterSpec(curve, generator, order, cofactor);
        assertEquals(cofactor, ps.getCofactor());
    }
View Full Code Here

                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        BigInteger order = BigInteger.valueOf(5L);
        int cofactor = 10;
        ECParameterSpec ps =
            new ECParameterSpec(curve, generator, order, cofactor);
        EllipticCurve curveRet = ps.getCurve();
        assertEquals(curve, curveRet);
        assertSame(curve, curveRet);
    }
View Full Code Here

                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        BigInteger order = BigInteger.valueOf(5L);
        int cofactor = 10;
        ECParameterSpec ps =
            new ECParameterSpec(curve, generator, order, cofactor);
        ECPoint generatorRet = ps.getGenerator();
        assertEquals(generator, generatorRet);
        assertSame(generator, generatorRet);
    }
View Full Code Here

                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        BigInteger order = BigInteger.valueOf(5L);
        int cofactor = 10;
        ECParameterSpec ps =
            new ECParameterSpec(curve, generator, order, cofactor);
        BigInteger orderRet = ps.getOrder();
        assertEquals(order, orderRet);
        assertSame(order, orderRet);
    }
View Full Code Here

            new EllipticCurve(new ECFieldFp(BigInteger.valueOf(5L)),
                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        new ECPrivateKeySpec(BigInteger.ZERO,
                new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
       
    }
View Full Code Here

TOP

Related Classes of java.security.spec.ECParameterSpec

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.