2
|
1 |
/*
|
|
2 |
* Copyright 2002-2005 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* @test
|
|
26 |
* @bug 6313675 6323647
|
|
27 |
* @summary Verify that all ciphersuites work in FIPS mode
|
|
28 |
* @author Andreas Sterbenz
|
|
29 |
* @library ..
|
|
30 |
*/
|
|
31 |
|
|
32 |
import java.security.*;
|
|
33 |
|
|
34 |
// This test belongs more in JSSE than here, but the JSSE workspace does not
|
|
35 |
// have the NSS test infrastructure. It will live here for the time being.
|
|
36 |
|
|
37 |
public class ClientJSSEServerJSSE extends SecmodTest {
|
|
38 |
|
|
39 |
public static void main(String[] args) throws Exception {
|
|
40 |
if (initSecmod() == false) {
|
|
41 |
return;
|
|
42 |
}
|
|
43 |
|
|
44 |
if ("sparc".equals(System.getProperty("os.arch")) == false) {
|
|
45 |
// we have not updated other platforms with the proper NSS libraries yet
|
|
46 |
System.out.println("Test currently works only on solaris-sparc, skipping");
|
|
47 |
return;
|
|
48 |
}
|
|
49 |
|
|
50 |
String configName = BASE + SEP + "fips.cfg";
|
|
51 |
Provider p = getSunPKCS11(configName);
|
|
52 |
|
|
53 |
System.out.println(p);
|
|
54 |
Security.addProvider(p);
|
|
55 |
|
|
56 |
Security.removeProvider("SunJSSE");
|
|
57 |
Provider jsse = new com.sun.net.ssl.internal.ssl.Provider(p);
|
|
58 |
Security.addProvider(jsse);
|
|
59 |
System.out.println(jsse.getInfo());
|
|
60 |
|
|
61 |
KeyStore ks = KeyStore.getInstance("PKCS11", p);
|
|
62 |
ks.load(null, "test12".toCharArray());
|
|
63 |
|
|
64 |
CipherTest.main(new JSSEFactory(), ks, args);
|
|
65 |
}
|
|
66 |
|
|
67 |
private static class JSSEFactory extends CipherTest.PeerFactory {
|
|
68 |
|
|
69 |
String getName() {
|
|
70 |
return "Client JSSE - Server JSSE";
|
|
71 |
}
|
|
72 |
|
|
73 |
CipherTest.Client newClient(CipherTest cipherTest) throws Exception {
|
|
74 |
return new JSSEClient(cipherTest);
|
|
75 |
}
|
|
76 |
|
|
77 |
CipherTest.Server newServer(CipherTest cipherTest) throws Exception {
|
|
78 |
return new JSSEServer(cipherTest);
|
|
79 |
}
|
|
80 |
}
|
|
81 |
}
|