Skip to content

Commit

Permalink
Merge pull request #146 from sbesson/client_disabledAlgorithms_revert
Browse files Browse the repository at this point in the history
Revert "Java client init: no "anon" among jdk.tls.disabledAlgorithms"
  • Loading branch information
jburel authored Sep 7, 2023
2 parents 0c31bf7 + 25e2115 commit aae5472
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/main/java/omero/client.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.security.Security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -200,42 +199,6 @@ public void run() {
// Creation
// =========================================================================

/**
* Ensure that anonymous cipher suites are enabled in the JRE.
*/
static {
final String property = "jdk.tls.disabledAlgorithms";
final String value = Security.getProperty(property);
if (!(value == null || value.trim().isEmpty())) {
final List<String> algorithms = new ArrayList<>();
boolean isChanged = false;
for (String algorithm : value.split(",")) {
algorithm = algorithm.trim();
final String algorithmLower = algorithm.toLowerCase();
if (algorithm.isEmpty()) {
/* ignore */
} else if (algorithmLower.equals("anon") || algorithmLower.endsWith("_anon")) {
isChanged = true;
} else {
algorithms.add(algorithm);
}
}
if (isChanged) {
boolean needsComma = false;
final StringBuilder newValue = new StringBuilder();
for (final String algorithm : algorithms) {
if (needsComma) {
newValue.append(", ");
} else {
needsComma = true;
}
newValue.append(algorithm);
}
Security.setProperty(property, newValue.toString());
}
}
}

private static Properties defaultRouter(String host, int port) {
Properties p = new Properties();
p.setProperty("omero.host", host);
Expand Down

0 comments on commit aae5472

Please sign in to comment.