8257083: Security infra test failures caused by JDK-8202343
Reviewed-by: xuelei
This commit is contained in:
parent
4db05e991b
commit
c0719605e7
@ -24,11 +24,12 @@
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.Security;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
/*
|
||||
* A JDK client process.
|
||||
*/
|
||||
@ -161,7 +162,7 @@ public class JdkProcClient extends AbstractClient {
|
||||
String appProtocolsStr = System.getProperty(JdkProcUtils.PROP_APP_PROTOCOLS);
|
||||
|
||||
// Re-enable TLSv1 and TLSv1.1 since client depends on them
|
||||
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
|
||||
removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
|
||||
|
||||
JdkClient.Builder builder = new JdkClient.Builder();
|
||||
builder.setCertTuple(JdkProcUtils.createCertTuple(
|
||||
@ -188,4 +189,22 @@ public class JdkProcClient extends AbstractClient {
|
||||
client.connect(host, port);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified protocols from the jdk.tls.disabledAlgorithms
|
||||
* security property.
|
||||
*/
|
||||
private static void removeFromDisabledTlsAlgs(String... algs) {
|
||||
List<String> algList = Arrays.asList(algs);
|
||||
String value = Security.getProperty("jdk.tls.disabledAlgorithms");
|
||||
StringBuilder newValue = new StringBuilder();
|
||||
for (String constraint : value.split(",")) {
|
||||
String tmp = constraint.trim();
|
||||
if (!algList.contains(tmp)) {
|
||||
newValue.append(tmp);
|
||||
newValue.append(",");
|
||||
}
|
||||
}
|
||||
Security.setProperty("jdk.tls.disabledAlgorithms", newValue.toString());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user