Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
38855 views
1
/*
2
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 6313675 6323647 8028192
27
* @summary Verify that all ciphersuites work in FIPS mode
28
* @library ..
29
* @run main/othervm ClientJSSEServerJSSE
30
* @author Andreas Sterbenz
31
*/
32
33
import java.security.*;
34
35
// This test belongs more in JSSE than here, but the JSSE workspace does not
36
// have the NSS test infrastructure. It will live here for the time being.
37
38
public class ClientJSSEServerJSSE extends SecmodTest {
39
40
public static void main(String[] args) throws Exception {
41
if (initSecmod() == false) {
42
return;
43
}
44
45
String arch = System.getProperty("os.arch");
46
if (!("sparc".equals(arch) || "sparcv9".equals(arch))) {
47
// we have not updated other platforms with the proper NSS
48
// libraries yet
49
System.out.println(
50
"Test currently works only on solaris-sparc " +
51
"and solaris-sparcv9. Skipping on " + arch);
52
return;
53
}
54
55
String configName = BASE + SEP + "fips.cfg";
56
Provider p = getSunPKCS11(configName);
57
58
System.out.println(p);
59
Security.addProvider(p);
60
61
Security.removeProvider("SunJSSE");
62
Provider jsse = new com.sun.net.ssl.internal.ssl.Provider(p);
63
Security.addProvider(jsse);
64
System.out.println(jsse.getInfo());
65
66
KeyStore ks = KeyStore.getInstance("PKCS11", p);
67
ks.load(null, "test12".toCharArray());
68
69
CipherTest.main(new JSSEFactory(), ks, args);
70
}
71
72
private static class JSSEFactory extends CipherTest.PeerFactory {
73
74
String getName() {
75
return "Client JSSE - Server JSSE";
76
}
77
78
CipherTest.Client newClient(CipherTest cipherTest) throws Exception {
79
return new JSSEClient(cipherTest);
80
}
81
82
CipherTest.Server newServer(CipherTest cipherTest) throws Exception {
83
return new JSSEServer(cipherTest);
84
}
85
}
86
}
87
88