Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
38855 views
/*1* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 6313675 6323647 802819226* @summary Verify that all ciphersuites work in FIPS mode27* @library ..28* @run main/othervm ClientJSSEServerJSSE29* @author Andreas Sterbenz30*/3132import java.security.*;3334// This test belongs more in JSSE than here, but the JSSE workspace does not35// have the NSS test infrastructure. It will live here for the time being.3637public class ClientJSSEServerJSSE extends SecmodTest {3839public static void main(String[] args) throws Exception {40if (initSecmod() == false) {41return;42}4344String arch = System.getProperty("os.arch");45if (!("sparc".equals(arch) || "sparcv9".equals(arch))) {46// we have not updated other platforms with the proper NSS47// libraries yet48System.out.println(49"Test currently works only on solaris-sparc " +50"and solaris-sparcv9. Skipping on " + arch);51return;52}5354String configName = BASE + SEP + "fips.cfg";55Provider p = getSunPKCS11(configName);5657System.out.println(p);58Security.addProvider(p);5960Security.removeProvider("SunJSSE");61Provider jsse = new com.sun.net.ssl.internal.ssl.Provider(p);62Security.addProvider(jsse);63System.out.println(jsse.getInfo());6465KeyStore ks = KeyStore.getInstance("PKCS11", p);66ks.load(null, "test12".toCharArray());6768CipherTest.main(new JSSEFactory(), ks, args);69}7071private static class JSSEFactory extends CipherTest.PeerFactory {7273String getName() {74return "Client JSSE - Server JSSE";75}7677CipherTest.Client newClient(CipherTest cipherTest) throws Exception {78return new JSSEClient(cipherTest);79}8081CipherTest.Server newServer(CipherTest cipherTest) throws Exception {82return new JSSEServer(cipherTest);83}84}85}868788