1545N/A/*
3865N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
1545N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1545N/A *
1545N/A * This code is free software; you can redistribute it and/or modify it
1545N/A * under the terms of the GNU General Public License version 2 only, as
1545N/A * published by the Free Software Foundation.
1545N/A *
1545N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1545N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1545N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1545N/A * version 2 for more details (a copy is included in the LICENSE file that
1545N/A * accompanied this code).
1545N/A *
1545N/A * You should have received a copy of the GNU General Public License version
1545N/A * 2 along with this work; if not, write to the Free Software Foundation,
1545N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1545N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1545N/A */
1545N/A
1545N/A/**
1545N/A * @test
1545N/A * @bug 6840752
1545N/A * @summary Provide out-of-the-box support for ECC algorithms
1545N/A * @library ../pkcs11
1545N/A * @library ../pkcs11/ec
1674N/A * @library ../pkcs11/sslecc
5361N/A * @library ../../../java/security/testlibrary
1674N/A * @compile -XDignore.symbol.file TestEC.java
1545N/A * @run main TestEC
1545N/A */
1545N/A
1545N/Aimport java.security.Provider;
5361N/Aimport java.security.Security;
1545N/A
1545N/A/*
1545N/A * Leverage the collection of EC tests used by PKCS11
1545N/A *
1674N/A * NOTE: the following 6 files were copied here from the PKCS11 EC Test area
1545N/A * and must be kept in sync with the originals:
1545N/A *
1545N/A * ../pkcs11/ec/p12passwords.txt
1674N/A * ../pkcs11/ec/certs/sunlabscerts.pem
1545N/A * ../pkcs11/ec/pkcs12/secp256r1server-secp384r1ca.p12
1545N/A * ../pkcs11/ec/pkcs12/sect193r1server-rsa1024ca.p12
1674N/A * ../pkcs11/sslecc/keystore
1674N/A * ../pkcs11/sslecc/truststore
1545N/A */
1545N/A
1545N/Apublic class TestEC {
1545N/A
1545N/A public static void main(String[] args) throws Exception {
5361N/A ProvidersSnapshot snapshot = ProvidersSnapshot.create();
5361N/A try {
5361N/A main0(args);
5361N/A } finally {
5361N/A snapshot.restore();
5361N/A }
5361N/A }
5361N/A
5361N/A public static void main0(String[] args) throws Exception {
1545N/A Provider p = new sun.security.ec.SunEC();
1545N/A System.out.println("Running tests with " + p.getName() +
1545N/A " provider...\n");
1674N/A long start = System.currentTimeMillis();
1545N/A
1674N/A /*
1674N/A * The entry point used for each test is its instance method
1674N/A * called main (not its static method called main).
1674N/A */
1545N/A new TestECDH().main(p);
1545N/A new TestECDSA().main(p);
1584N/A new TestCurves().main(p);
1545N/A new TestKeyFactory().main(p);
1545N/A new TestECGenSpec().main(p);
1545N/A new ReadPKCS12().main(p);
1674N/A new ReadCertificates().main(p);
5361N/A
5361N/A // ClientJSSEServerJSSE fails on Solaris 11 when both SunEC and
5361N/A // SunPKCS11-Solaris providers are enabled.
5361N/A // Workaround:
5361N/A // Security.removeProvider("SunPKCS11-Solaris");
1674N/A new ClientJSSEServerJSSE().main(p);
1545N/A
1674N/A long stop = System.currentTimeMillis();
1545N/A System.out.println("\nCompleted tests with " + p.getName() +
1674N/A " provider (" + ((stop - start) / 1000.0) + " seconds).");
1545N/A }
1545N/A}