TestEC.java revision 3002:9d6a9f65d2bf
14Srgrimes/*
2122296Speter * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
34Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44Srgrimes *
54Srgrimes * This code is free software; you can redistribute it and/or modify it
64Srgrimes * under the terms of the GNU General Public License version 2 only, as
74Srgrimes * published by the Free Software Foundation.
84Srgrimes *
94Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
104Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
114Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
124Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
134Srgrimes * accompanied this code).
144Srgrimes *
154Srgrimes * You should have received a copy of the GNU General Public License version
164Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
174Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
184Srgrimes *
194Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
204Srgrimes * or visit www.oracle.com if you need additional information or have any
214Srgrimes * questions.
224Srgrimes */
234Srgrimes
244Srgrimes/**
254Srgrimes * @test
264Srgrimes * @bug 6840752
274Srgrimes * @summary  Provide out-of-the-box support for ECC algorithms
284Srgrimes * @ignore JSSE supported cipher suites are changed with CR 6916074,
294Srgrimes *     need to update this test case in JDK 7 soon
304Srgrimes * @library ../pkcs11
314Srgrimes * @library ../pkcs11/ec
324Srgrimes * @library ../pkcs11/sslecc
33557Srgrimes * @compile -XDignore.symbol.file TestEC.java
3450477Speter * @run main TestEC
354Srgrimes */
364Srgrimes
37122296Speterimport java.security.Provider;
38122296Speter
39557Srgrimes/*
404Srgrimes * Leverage the collection of EC tests used by PKCS11
41122278Speter *
424Srgrimes * NOTE: the following 6 files were copied here from the PKCS11 EC Test area
43122278Speter *       and must be kept in sync with the originals:
44168035Sjkim *
454Srgrimes *           ../pkcs11/ec/p12passwords.txt
464Srgrimes *           ../pkcs11/ec/certs/sunlabscerts.pem
47114349Speter *           ../pkcs11/ec/pkcs12/secp256r1server-secp384r1ca.p12
48114349Speter *           ../pkcs11/ec/pkcs12/sect193r1server-rsa1024ca.p12
49114349Speter *           ../pkcs11/sslecc/keystore
50114349Speter *           ../pkcs11/sslecc/truststore
51114349Speter */
52114349Speter
53114349Speterpublic class TestEC {
54114349Speter
55114928Speter    public static void main(String[] args) throws Exception {
56114928Speter        Provider p = new sun.security.ec.SunEC();
57210777Sjkim        System.out.println("Running tests with " + p.getName() +
58210777Sjkim            " provider...\n");
59210777Sjkim        long start = System.currentTimeMillis();
60210777Sjkim
61210777Sjkim        /*
62210777Sjkim         * The entry point used for each test is its instance method
63210777Sjkim         * called main (not its static method called main).
64210777Sjkim         */
65210777Sjkim        new TestECDH().main(p);
66210777Sjkim        new TestECDSA().main(p);
67210777Sjkim        new TestCurves().main(p);
6848691Sjlemon        new TestKeyFactory().main(p);
69216634Sjkim        new TestECGenSpec().main(p);
70216634Sjkim        new ReadPKCS12().main(p);
71216634Sjkim        new ReadCertificates().main(p);
72216634Sjkim        new ClientJSSEServerJSSE().main(p);
73216634Sjkim
74216673Sjkim        long stop = System.currentTimeMillis();
75216634Sjkim        System.out.println("\nCompleted tests with " + p.getName() +
76210780Sjkim            " provider (" + ((stop - start) / 1000.0) + " seconds).");
77210780Sjkim    }
78210780Sjkim}
79210780Sjkim