Skip to content
Permalink
Browse files
8257083: Security infra test failures caused by JDK-8202343
Reviewed-by: xuelei
  • Loading branch information
seanjmullan committed Nov 30, 2020
1 parent 4db05e9 commit c0719605e79f7e91f528dd197dcb953f4ed99169
Showing 1 changed file with 22 additions and 3 deletions.
@@ -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 static void main(String[] args) throws Exception {
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 static void main(String[] args) throws Exception {
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());
}
}

1 comment on commit c071960

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on c071960 Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.