Package java.security.spec

Examples of java.security.spec.ECPoint


        {
            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(),
                                spec.getH().intValue());
        }
View Full Code Here


            EllipticCurve       ellipticCurve = EC5Util.convertCurve(ecP.getCurve(), ecP.getSeed());

            ecSpec = new ECNamedCurveSpec(
                    ECUtil.getCurveName(oid),
                    ellipticCurve,
                    new ECPoint(
                            ecP.getG().getX().toBigInteger(),
                            ecP.getG().getY().toBigInteger()),
                    ecP.getN(),
                    ecP.getH());
        }
        else if (params.isImplicitlyCA())
        {
            ecSpec = null;
        }
        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(),
                ecP.getH().intValue());
        }
View Full Code Here

        EllipticCurve curve = new EllipticCurve(
                new ECFieldFp(new BigInteger("6277101735386680763835789423207666416083908700390324961279")), // q
                new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
                new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b

        ECPoint p = ECPointUtil.decodePoint(curve, Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012"));

        if (!p.getAffineX().equals(new BigInteger("188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 16)))
        {
            fail("x uncompressed incorrectly");
        }

        if (!p.getAffineY().equals(new BigInteger("7192b95ffc8da78631011ed6b24cdd573f977a11e794811", 16)))
        {
            fail("y uncompressed incorrectly");
        }
    }
View Full Code Here

        private Method encodePoint, decodePoint;

        EC(PublicKey key) throws KeyException {
            super(key);
            ECPublicKey ecKey = (ECPublicKey)key;
            ECPoint ecPoint = ecKey.getW();
            ecParams = ecKey.getParams();
            try {
                AccessController.doPrivileged(
                    new PrivilegedExceptionAction<Void>() {
                        public Void run() throws
View Full Code Here

                }
            } else {
                throw new MarshalException("Invalid ECKeyValue");
            }
            curElem = DOMUtils.getNextSiblingElement(curElem, "PublicKey", XMLDSIG_11_XMLNS);
            ECPoint ecPoint = null;
            try {
                Object[] args = new Object[] { Base64.decode(curElem),
                                               ecParams.getCurve() };
                ecPoint = (ECPoint)decodePoint.invoke(null, args);
            } catch (Base64DecodingException bde) {
View Full Code Here

     * Assertion: creates <code>ECPoint</code> instance<br>
     * Test preconditions: valid parameters passed<br>
     * Expected: must pass without any exceptions
     */
    public final void testECPoint01() {
        new ECPoint(BigInteger.ZERO, BigInteger.ZERO);
        new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(-23456L));
        new ECPoint(BigInteger.valueOf(123456L), BigInteger.valueOf(123456L));
        new ECPoint(BigInteger.valueOf(-56L), BigInteger.valueOf(234L));
        new ECPoint(BigInteger.valueOf(3456L), BigInteger.valueOf(-2344L));
    }
View Full Code Here

     * Expected: must throw <code>NullPointerException</code>
     */
    public final void testECPoint02() {
        // test case 1: x is null
        try {
            new ECPoint(null, BigInteger.ZERO);
            fail("#1: Expected NPE not thrown");
        } catch (NullPointerException ok) {
        }


        // test case 2: y is null
        try {
            new ECPoint(BigInteger.ZERO, null);
            fail("#2: Expected NPE not thrown");
        } catch (NullPointerException ok) {
        }


        // test case 3: both : x and y are null
        try {
            new ECPoint(null, null);
            fail("#3: Expected NPE not thrown");
        } catch (NullPointerException ok) {
        }
    }
View Full Code Here

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

     * which is equal to the one passed to the constructor;
     * (both must refer the same object)
     */
    public final void testGetAffineY01() {
        BigInteger y =  BigInteger.valueOf(23456L);
        ECPoint p = new ECPoint(BigInteger.valueOf(-23456L), y);
        BigInteger yRet = p.getAffineY();
        assertEquals(y, yRet);
        assertSame(y, yRet);
    }
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
        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));
    }
View Full Code Here

TOP

Related Classes of java.security.spec.ECPoint

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.