Skip to content

Commit 00321ee

Browse files
committed
u
1 parent 5a1ae8b commit 00321ee

File tree

56 files changed

+212
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+212
-177
lines changed

test/jdk/javax/net/ssl/DTLS/CipherSuite.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class CipherSuite extends DTLSOverDatagram {
6565

6666
public static void main(String[] args) throws Exception {
6767
if (args.length > 1 && "re-enable".equals(args[1])
68-
&& !(Utils.isFIPS())) {
68+
&& !(SecurityUtils.isFIPS())) {
6969
Security.setProperty("jdk.tls.disabledAlgorithms", "");
7070
}
7171

@@ -75,7 +75,7 @@ public static void main(String[] args) throws Exception {
7575
try {
7676
testCase.runTest(testCase);
7777
} catch (javax.net.ssl.SSLHandshakeException sslhe) {
78-
if (Utils.isFIPS()) {
78+
if (SecurityUtils.isFIPS()) {
7979
if(!SecurityUtils.TLS_CIPHERSUITES.containsKey(cipherSuite)) {
8080
if ("No appropriate protocol (protocol is disabled or cipher suites are inappropriate)".equals(sslhe.getMessage())) {
8181
System.out.println("Expected exception msg: <No appropriate protocol (protocol is disabled or cipher suites are inappropriate)> is caught");

test/jdk/javax/net/ssl/DTLS/DTLSWontNegotiateV10.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class DTLSWontNegotiateV10 {
5353
public static void main(String[] args) throws Exception {
5454

5555
if (args[0].equals(DTLSV_1_0)
56-
&& !(Utils.isFIPS())) {
56+
&& !(SecurityUtils.isFIPS())) {
5757
SecurityUtils.removeFromDisabledTlsAlgs(DTLSV_1_0);
5858
}
5959

@@ -77,7 +77,7 @@ public static void main(String[] args) throws Exception {
7777
} catch (SocketTimeoutException exc) {
7878
System.out.println("The server timed-out waiting for packets from the client.");
7979
} catch (javax.net.ssl.SSLHandshakeException sslhe) {
80-
if (Utils.isFIPS()) {
80+
if (SecurityUtils.isFIPS()) {
8181
if(!SecurityUtils.TLS_PROTOCOLS.contains(args[0])) {
8282
if ("No appropriate protocol (protocol is disabled or cipher suites are inappropriate)".equals(sslhe.getMessage())) {
8383
System.out.println("Expected exception msg: <No appropriate protocol (protocol is disabled or cipher suites are inappropriate)> is caught");

test/jdk/javax/net/ssl/DTLS/WeakCipherSuite.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class WeakCipherSuite extends DTLSOverDatagram {
5555
public static void main(String[] args) throws Exception {
5656
// reset security properties to make sure that the algorithms
5757
// and keys used in this test are not disabled.
58-
if (!(Utils.isFIPS())) {
58+
if (!(SecurityUtils.isFIPS())) {
5959
Security.setProperty("jdk.tls.disabledAlgorithms", "");
6060
Security.setProperty("jdk.certpath.disabledAlgorithms", "");
6161
}
@@ -66,7 +66,7 @@ public static void main(String[] args) throws Exception {
6666
try {
6767
testCase.runTest(testCase);
6868
} catch (javax.net.ssl.SSLHandshakeException sslhe) {
69-
if (Utils.isFIPS()) {
69+
if (SecurityUtils.isFIPS()) {
7070
if(!SecurityUtils.TLS_CIPHERSUITES.containsKey(cipherSuite)) {
7171
if ("No appropriate protocol (protocol is disabled or cipher suites are inappropriate)".equals(sslhe.getMessage())) {
7272
System.out.println("Expected exception msg: <No appropriate protocol (protocol is disabled or cipher suites are inappropriate)> is caught");

test/jdk/javax/net/ssl/FixingJavadocs/ImplicitHandshake.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import javax.net.ssl.*;
4040

4141
import jdk.test.lib.Utils;
42+
import jdk.test.lib.security.SecurityUtils;
4243

4344
public class ImplicitHandshake {
4445

@@ -194,9 +195,9 @@ public static void main(String[] args) throws Exception {
194195
System.getProperty("test.src", "./") + "/" + pathToStores +
195196
"/" + trustStoreFile;
196197

197-
if (Utils.isFIPS()) {
198-
keyFilename = Utils.revertJKSToPKCS12(keyFilename, passwd);
199-
trustFilename = Utils.revertJKSToPKCS12(trustFilename, passwd);
198+
if (SecurityUtils.isFIPS()) {
199+
keyFilename = SecurityUtils.revertJKSToPKCS12(keyFilename, passwd);
200+
trustFilename = SecurityUtils.revertJKSToPKCS12(trustFilename, passwd);
200201
}
201202
System.setProperty("javax.net.ssl.keyStore", keyFilename);
202203
System.setProperty("javax.net.ssl.keyStorePassword", passwd);

test/jdk/javax/net/ssl/HttpsURLConnection/CriticalSubjectAltName.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import java.security.cert.Certificate;
5656

5757
import jdk.test.lib.Utils;
58+
import jdk.test.lib.security.SecurityUtils;
5859

5960
public class CriticalSubjectAltName implements HostnameVerifier {
6061
/*
@@ -162,7 +163,7 @@ void doClientSide() throws Exception {
162163

163164
public static void main(String[] args) throws Exception {
164165
// MD5 is used in this test case, don't disable MD5 algorithm.
165-
if (!(Utils.isFIPS())) {
166+
if (!(SecurityUtils.isFIPS())) {
166167
Security.setProperty("jdk.certpath.disabledAlgorithms",
167168
"MD2, RSA keySize < 1024");
168169
Security.setProperty("jdk.tls.disabledAlgorithms",
@@ -176,9 +177,9 @@ public static void main(String[] args) throws Exception {
176177
System.getProperty("test.src", "./") + "/" + pathToStores +
177178
"/" + trustStoreFile;
178179

179-
if (Utils.isFIPS()) {
180-
keyFilename = Utils.revertJKSToPKCS12(keyFilename, passwd);
181-
trustFilename = Utils.revertJKSToPKCS12(trustFilename, passwd);
180+
if (SecurityUtils.isFIPS()) {
181+
keyFilename = SecurityUtils.revertJKSToPKCS12(keyFilename, passwd);
182+
trustFilename = SecurityUtils.revertJKSToPKCS12(trustFilename, passwd);
182183
}
183184

184185
System.setProperty("javax.net.ssl.keyStore", keyFilename);
@@ -195,7 +196,7 @@ public static void main(String[] args) throws Exception {
195196
try {
196197
new CriticalSubjectAltName();
197198
} catch (Exception e) {
198-
if (Utils.isFIPS()) {
199+
if (SecurityUtils.isFIPS()) {
199200
if (e instanceof java.security.cert.CertPathValidatorException) {
200201
if ("Algorithm constraints check failed on signature algorithm: MD5withRSA".equals(e.getMessage())) {
201202
System.out.println("MD5withRSA is not a supported signature algorithm.");

test/jdk/javax/net/ssl/HttpsURLConnection/GetResponseCode.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.security.cert.Certificate;
4040

4141
import jdk.test.lib.Utils;
42+
import jdk.test.lib.security.SecurityUtils;
4243

4344
public class GetResponseCode implements HostnameVerifier {
4445
/*
@@ -152,9 +153,9 @@ public static void main(String[] args) throws Exception {
152153
System.getProperty("test.src", "./") + "/" + pathToStores +
153154
"/" + trustStoreFile;
154155

155-
if (Utils.isFIPS()) {
156-
keyFilename = Utils.revertJKSToPKCS12(keyFilename, passwd);
157-
trustFilename = Utils.revertJKSToPKCS12(trustFilename, passwd);
156+
if (SecurityUtils.isFIPS()) {
157+
keyFilename = SecurityUtils.revertJKSToPKCS12(keyFilename, passwd);
158+
trustFilename = SecurityUtils.revertJKSToPKCS12(trustFilename, passwd);
158159
}
159160

160161
System.setProperty("javax.net.ssl.keyStore", keyFilename);

test/jdk/javax/net/ssl/SSLEngine/Arrays.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static void main(String args[]) throws Exception {
189189
contextVersion = args[0];
190190
// Re-enable context version if it is disabled.
191191
// If context version is SSLv3, TLSv1 needs to be re-enabled.
192-
if (!(Utils.isFIPS())) {
192+
if (!(SecurityUtils.isFIPS())) {
193193
if (contextVersion.equals("SSLv3")) {
194194
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1");
195195
} else if (contextVersion.equals("TLSv1") ||
@@ -207,7 +207,7 @@ public static void main(String args[]) throws Exception {
207207
try {
208208
test.runTest();
209209
} catch (javax.net.ssl.SSLHandshakeException sslhe) {
210-
if (Utils.isFIPS()) {
210+
if (SecurityUtils.isFIPS()) {
211211
if(!SecurityUtils.TLS_PROTOCOLS.contains(contextVersion)) {
212212
if ("No appropriate protocol (protocol is disabled or cipher suites are inappropriate)".equals(sslhe.getMessage())) {
213213
System.out.println("Expected exception msg: <No appropriate protocol (protocol is disabled or cipher suites are inappropriate)> is caught");

test/jdk/javax/net/ssl/SSLEngine/Basics.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ public class Basics {
5858
"/" + TRUSTSTORE_FILE;
5959

6060
public static void main(String[] args) throws Exception {
61-
if (!(Utils.isFIPS())) {
61+
if (!(SecurityUtils.isFIPS())) {
6262
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1");
6363
runTest("TLSv1.1", "TLS_DHE_DSS_WITH_AES_128_CBC_SHA");
6464
}
6565

6666
runTest("TLSv1.3", "TLS_AES_256_GCM_SHA384");
67-
if (!(Utils.isFIPS())) {
67+
if (!(SecurityUtils.isFIPS())) {
6868
runTest("TLSv1.2", "TLS_RSA_WITH_AES_256_GCM_SHA384");
6969
}
7070
}

test/jdk/javax/net/ssl/SSLEngine/CheckTlsEngineResults.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.nio.*;
4242

4343
import jdk.test.lib.Utils;
44+
import jdk.test.lib.security.SecurityUtils;
4445

4546
public class CheckTlsEngineResults {
4647

@@ -128,7 +129,7 @@ private void test() throws Exception {
128129
SSLEngineResult result1; // clientEngine's results from last operation
129130
SSLEngineResult result2; // serverEngine's results from last operation
130131
String[] suite1;
131-
if (!(Utils.isFIPS())) {
132+
if (!(SecurityUtils.isFIPS())) {
132133
suite1 = new String [] {
133134
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA" };
134135
} else {

test/jdk/javax/net/ssl/SSLEngine/ConnectionTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.nio.*;
4646

4747
import jdk.test.lib.Utils;
48+
import jdk.test.lib.security.SecurityUtils;
4849

4950
public class ConnectionTest {
5051

@@ -600,7 +601,7 @@ private static void log(Object msg) {
600601
public static void main(String args[]) throws Exception {
601602
// reset the security property to make sure that the algorithms
602603
// and keys used in this test are not disabled.
603-
if (!(Utils.isFIPS())) {
604+
if (!(SecurityUtils.isFIPS())) {
604605
Security.setProperty("jdk.tls.disabledAlgorithms", "");
605606
}
606607

test/jdk/javax/net/ssl/SSLEngine/EngineCloseOnAlert.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import static javax.net.ssl.SSLEngineResult.HandshakeStatus.*;
4040

4141
import jdk.test.lib.Utils;
42+
import jdk.test.lib.security.SecurityUtils;
4243

4344
public class EngineCloseOnAlert {
4445

@@ -56,7 +57,7 @@ public class EngineCloseOnAlert {
5657
private static KeyManagerFactory KMF;
5758
private static TrustManagerFactory TMF;
5859

59-
private static final String[] ONECIPHER = (Utils.isFIPS()) ?
60+
private static final String[] ONECIPHER = (SecurityUtils.isFIPS()) ?
6061
new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" } : new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA" };
6162

6263

test/jdk/javax/net/ssl/SSLEngine/LargeBufs.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import java.util.Random;
4545

4646
import jdk.test.lib.Utils;
47+
import jdk.test.lib.security.SecurityUtils;
4748

4849
public class LargeBufs {
4950

@@ -185,7 +186,7 @@ private void runTest(String cipher) throws Exception {
185186
public static void main(String args[]) throws Exception {
186187
LargeBufs test;
187188

188-
if (!(Utils.isFIPS())) {
189+
if (!(SecurityUtils.isFIPS())) {
189190
// reset the security property to make sure that the algorithms
190191
// and keys used in this test are not disabled.
191192
Security.setProperty("jdk.tls.disabledAlgorithms", "");

test/jdk/javax/net/ssl/SSLEngine/NoAuthClientAuth.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public class NoAuthClientAuth {
144144
* Main entry point for this test.
145145
*/
146146
public static void main(String args[]) throws Exception {
147-
if (!(Utils.isFIPS())) {
147+
if (!(SecurityUtils.isFIPS())) {
148148
Security.setProperty("jdk.tls.disabledAlgorithms", "");
149149
tlsProtocol = args[0];
150150
} else {
@@ -164,7 +164,7 @@ public static void main(String args[]) throws Exception {
164164
try {
165165
test.runTest();
166166
} catch (java.lang.IllegalArgumentException iae) {
167-
if (Utils.isFIPS()) {
167+
if (SecurityUtils.isFIPS()) {
168168
if (tlsProtocol == null) {
169169
if ("Unsupported protocolnull".equals(iae.getMessage())) {
170170
System.out.println("Expected exception msg: <Unsupported protocolnull> is caught");

test/jdk/javax/net/ssl/SSLEngine/TestAllSuites.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private void createSSLEngines() {
9292
private void test() throws Exception {
9393
List<String> tmpCipherSuites = new ArrayList<>();
9494
String [] suites;
95-
if (Utils.isFIPS()) {
95+
if (SecurityUtils.isFIPS()) {
9696
for (String ciphersuite : clientEngine.getEnabledCipherSuites()) {
9797
if (!SecurityUtils.TLS_CIPHERSUITES.containsKey(ciphersuite)) {
9898
continue;
@@ -243,7 +243,7 @@ public static void main(String args[]) throws Exception {
243243
if (args.length < 1) {
244244
throw new RuntimeException("Missing TLS protocol parameter.");
245245
}
246-
if (!(Utils.isFIPS())) {
246+
if (!(SecurityUtils.isFIPS())) {
247247
switch(args[0]) {
248248
case "TLSv1.1" -> SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1");
249249
case "TLSv1.3" -> SecurityUtils.addToDisabledTlsAlgs("TLSv1.2");

test/jdk/javax/net/ssl/SSLParameters/UseCipherSuitesOrder.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.Arrays;
4242

4343
import jdk.test.lib.Utils;
44+
import jdk.test.lib.security.SecurityUtils;
4445

4546
public class UseCipherSuitesOrder {
4647

@@ -177,7 +178,7 @@ private static void parseArguments(String[] args) throws Exception {
177178
throw new Exception("Need to enable at least two cipher suites");
178179
}
179180

180-
if (Utils.isFIPS()) {
181+
if (SecurityUtils.isFIPS()) {
181182
cliEnabledCipherSuites = new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384"};
182183
}
183184

@@ -204,7 +205,7 @@ private static void parseArguments(String[] args) throws Exception {
204205
public static void main(String[] args) throws Exception {
205206
// reset the security property to make sure that the algorithms
206207
// and keys used in this test are not disabled.
207-
if (!(Utils.isFIPS())) {
208+
if (!(SecurityUtils.isFIPS())) {
208209
Security.setProperty("jdk.tls.disabledAlgorithms", "");
209210
}
210211

@@ -218,9 +219,9 @@ public static void main(String[] args) throws Exception {
218219
System.getProperty("test.src", ".") + "/" + pathToStores +
219220
"/" + trustStoreFile;
220221

221-
if (Utils.isFIPS()) {
222-
keyFilename = Utils.revertJKSToPKCS12(keyFilename, passwd);
223-
trustFilename = Utils.revertJKSToPKCS12(trustFilename, passwd);
222+
if (SecurityUtils.isFIPS()) {
223+
keyFilename = SecurityUtils.revertJKSToPKCS12(keyFilename, passwd);
224+
trustFilename = SecurityUtils.revertJKSToPKCS12(trustFilename, passwd);
224225
}
225226

226227
System.setProperty("javax.net.ssl.keyStore", keyFilename);

test/jdk/javax/net/ssl/SSLSession/HttpsURLConnectionLocalCertificateChain.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import java.security.cert.*;
4545

4646
import jdk.test.lib.Utils;
47+
import jdk.test.lib.security.SecurityUtils;
4748

4849
public class HttpsURLConnectionLocalCertificateChain
4950
implements HandshakeCompletedListener,
@@ -247,9 +248,9 @@ public static void main(String[] args) throws Exception {
247248
System.getProperty("test.src", "./") + "/" + pathToStores +
248249
"/" + trustStoreFile;
249250

250-
if (Utils.isFIPS()) {
251-
keyFilename = Utils.revertJKSToPKCS12(keyFilename, passwd);
252-
trustFilename = Utils.revertJKSToPKCS12(trustFilename, passwd);
251+
if (SecurityUtils.isFIPS()) {
252+
keyFilename = SecurityUtils.revertJKSToPKCS12(keyFilename, passwd);
253+
trustFilename = SecurityUtils.revertJKSToPKCS12(trustFilename, passwd);
253254
}
254255

255256
System.setProperty("javax.net.ssl.keyStore", keyFilename);

test/jdk/javax/net/ssl/SSLSession/JSSERenegotiate.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import javax.net.ssl.*;
4343

4444
import jdk.test.lib.Utils;
45+
import jdk.test.lib.security.SecurityUtils;
4546

4647
public class JSSERenegotiate {
4748

@@ -196,7 +197,7 @@ void doClientSide() throws Exception {
196197
public static void main(String[] args) throws Exception {
197198
// reset the security property to make sure that the cipher suites
198199
// used in this test are not disabled
199-
if (!(Utils.isFIPS())) {
200+
if (!(SecurityUtils.isFIPS())) {
200201
Security.setProperty("jdk.tls.disabledAlgorithms", "");
201202
}
202203

@@ -207,9 +208,9 @@ public static void main(String[] args) throws Exception {
207208
System.getProperty("test.src", "./") + "/" + pathToStores +
208209
"/" + trustStoreFile;
209210

210-
if (Utils.isFIPS()) {
211-
keyFilename = Utils.revertJKSToPKCS12(keyFilename, passwd);
212-
trustFilename = Utils.revertJKSToPKCS12(trustFilename, passwd);
211+
if (SecurityUtils.isFIPS()) {
212+
keyFilename = SecurityUtils.revertJKSToPKCS12(keyFilename, passwd);
213+
trustFilename = SecurityUtils.revertJKSToPKCS12(trustFilename, passwd);
213214
suite1 = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256";
214215
suite2 = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384";
215216
} else {

test/jdk/javax/net/ssl/SSLSession/RenegotiateTLS13.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import java.security.SecureRandom;
4343

4444
import jdk.test.lib.Utils;
45+
import jdk.test.lib.security.SecurityUtils;
4546

4647
public class RenegotiateTLS13 {
4748

@@ -142,9 +143,9 @@ public static void main(String[] args) throws Exception {
142143
System.getProperty("test.src", "./") + "/" + pathToStores +
143144
"/" + trustStoreFile;
144145

145-
if (Utils.isFIPS()) {
146-
keyFilename = Utils.revertJKSToPKCS12(keyFilename, passwd);
147-
trustFilename = Utils.revertJKSToPKCS12(trustFilename, passwd);
146+
if (SecurityUtils.isFIPS()) {
147+
keyFilename = SecurityUtils.revertJKSToPKCS12(keyFilename, passwd);
148+
trustFilename = SecurityUtils.revertJKSToPKCS12(trustFilename, passwd);
148149
}
149150

150151
System.setProperty("javax.net.ssl.keyStore", keyFilename);

0 commit comments

Comments
 (0)