test/sun/security/ec/TestEC.java

Thu, 17 Sep 2020 12:51:33 +0300

author
abakhtin
date
Thu, 17 Sep 2020 12:51:33 +0300
changeset 14208
77b682e2d679
parent 12116
8dc49b3c8953
child 14222
5a272e10d7e7
permissions
-rw-r--r--

8252886: [TESTBUG] sun/security/ec/TestEC.java : Compilation failed
Reviewed-by: shade, andrew, mbalao

vinnie@1548 1 /*
igerasim@10951 2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
vinnie@1548 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
vinnie@1548 4 *
vinnie@1548 5 * This code is free software; you can redistribute it and/or modify it
vinnie@1548 6 * under the terms of the GNU General Public License version 2 only, as
vinnie@1548 7 * published by the Free Software Foundation.
vinnie@1548 8 *
vinnie@1548 9 * This code is distributed in the hope that it will be useful, but WITHOUT
vinnie@1548 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
vinnie@1548 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
vinnie@1548 12 * version 2 for more details (a copy is included in the LICENSE file that
vinnie@1548 13 * accompanied this code).
vinnie@1548 14 *
vinnie@1548 15 * You should have received a copy of the GNU General Public License version
vinnie@1548 16 * 2 along with this work; if not, write to the Free Software Foundation,
vinnie@1548 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
vinnie@1548 18 *
ohair@2365 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2365 20 * or visit www.oracle.com if you need additional information or have any
ohair@2365 21 * questions.
vinnie@1548 22 */
vinnie@1548 23
xuelei@6961 24 //
xuelei@6961 25 // SunJSSE does not support dynamic system properties, no way to re-use
xuelei@6961 26 // system properties in samevm/agentvm mode.
xuelei@6961 27 //
xuelei@6961 28
vinnie@1548 29 /**
vinnie@1548 30 * @test
vinnie@1548 31 * @bug 6840752
vinnie@1548 32 * @summary Provide out-of-the-box support for ECC algorithms
vinnie@1548 33 * @library ../pkcs11
vinnie@1548 34 * @library ../pkcs11/ec
vinnie@1677 35 * @library ../pkcs11/sslecc
weijun@4482 36 * @library ../../../java/security/testlibrary
abakhtin@14208 37 * @library ../../../javax/net/ssl/TLSCommon
vinnie@1677 38 * @compile -XDignore.symbol.file TestEC.java
coffeys@12116 39 * @run main/othervm -Djdk.tls.namedGroups="secp256r1,sect193r1" TestEC
vinnie@1548 40 */
vinnie@1548 41
mullan@5801 42 import java.security.NoSuchProviderException;
vinnie@1548 43 import java.security.Provider;
weijun@4482 44 import java.security.Security;
vinnie@1548 45
vinnie@1548 46 /*
vinnie@1548 47 * Leverage the collection of EC tests used by PKCS11
vinnie@1548 48 *
vinnie@1677 49 * NOTE: the following 6 files were copied here from the PKCS11 EC Test area
vinnie@1548 50 * and must be kept in sync with the originals:
vinnie@1548 51 *
vinnie@1548 52 * ../pkcs11/ec/p12passwords.txt
vinnie@1677 53 * ../pkcs11/ec/certs/sunlabscerts.pem
vinnie@1548 54 * ../pkcs11/ec/pkcs12/secp256r1server-secp384r1ca.p12
vinnie@1548 55 * ../pkcs11/ec/pkcs12/sect193r1server-rsa1024ca.p12
vinnie@1677 56 * ../pkcs11/sslecc/keystore
vinnie@1677 57 * ../pkcs11/sslecc/truststore
vinnie@1548 58 */
vinnie@1548 59
vinnie@1548 60 public class TestEC {
vinnie@1548 61
vinnie@1548 62 public static void main(String[] args) throws Exception {
igerasim@10951 63 // reset security properties to make sure that the algorithms
igerasim@10951 64 // and keys used in this test are not disabled.
igerasim@10951 65 Security.setProperty("jdk.tls.disabledAlgorithms", "");
igerasim@10951 66 Security.setProperty("jdk.certpath.disabledAlgorithms", "");
igerasim@10951 67
weijun@4482 68 ProvidersSnapshot snapshot = ProvidersSnapshot.create();
weijun@4482 69 try {
weijun@4482 70 main0(args);
weijun@4482 71 } finally {
weijun@4482 72 snapshot.restore();
weijun@4482 73 }
weijun@4482 74 }
weijun@4482 75
weijun@4482 76 public static void main0(String[] args) throws Exception {
mullan@5801 77 Provider p = Security.getProvider("SunEC");
mullan@5801 78
mullan@5801 79 if (p == null) {
mullan@5801 80 throw new NoSuchProviderException("Can't get SunEC provider");
mullan@5801 81 }
mullan@5801 82
vinnie@1548 83 System.out.println("Running tests with " + p.getName() +
vinnie@1548 84 " provider...\n");
vinnie@1677 85 long start = System.currentTimeMillis();
vinnie@1548 86
vinnie@1677 87 /*
vinnie@1677 88 * The entry point used for each test is its instance method
vinnie@1677 89 * called main (not its static method called main).
vinnie@1677 90 */
vinnie@1548 91 new TestECDH().main(p);
vinnie@1548 92 new TestECDSA().main(p);
vinnie@1587 93 new TestCurves().main(p);
vinnie@1548 94 new TestKeyFactory().main(p);
vinnie@1548 95 new TestECGenSpec().main(p);
vinnie@1548 96 new ReadPKCS12().main(p);
vinnie@1677 97 new ReadCertificates().main(p);
weijun@4482 98
weijun@4482 99 // ClientJSSEServerJSSE fails on Solaris 11 when both SunEC and
weijun@4482 100 // SunPKCS11-Solaris providers are enabled.
weijun@4482 101 // Workaround:
weijun@4482 102 // Security.removeProvider("SunPKCS11-Solaris");
vinnie@1677 103 new ClientJSSEServerJSSE().main(p);
vinnie@1677 104
vinnie@1548 105 long stop = System.currentTimeMillis();
vinnie@1548 106 System.out.println("\nCompleted tests with " + p.getName() +
vinnie@1677 107 " provider (" + ((stop - start) / 1000.0) + " seconds).");
vinnie@1548 108 }
vinnie@1548 109 }

mercurial