Author: remy.maucherat(a)jboss.com
Date: 2014-10-21 10:36:24 -0400 (Tue, 21 Oct 2014)
New Revision: 2527
Modified:
branches/7.5.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSEUtils.java
Log:
BZ1123356: Fix use of single cipher. Submitted by Emmanuel Hugonnet.
Modified: branches/7.5.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSEUtils.java
===================================================================
--- branches/7.5.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSEUtils.java 2014-10-16
13:41:28 UTC (rev 2526)
+++ branches/7.5.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSEUtils.java 2014-10-21
14:36:24 UTC (rev 2527)
@@ -40,17 +40,17 @@
Set<String> result = new LinkedHashSet<String>();
if (cipherSuites.length == 1) {
List<String> enabledCiphers =
OpenSSLCipherConfigurationParser.parseExpression(cipherSuites[0]);
- for (String enabledCipher : enabledCiphers) {
- if (supportedCiphers.contains(enabledCipher)) {
- result.add(enabledCipher);
+ if (enabledCiphers.isEmpty()) {
+ result.addAll(filter(Arrays.asList(cipherSuites), supportedCiphers));
+ } else {
+ for (String enabledCipher : enabledCiphers) {
+ if (supportedCiphers.contains(enabledCipher)) {
+ result.add(enabledCipher);
+ }
}
}
} else {
- for (String enabledCipher : cipherSuites) {
- if (supportedCiphers.contains(enabledCipher)) {
- result.add(enabledCipher);
- }
- }
+ result.addAll(filter(Arrays.asList(cipherSuites), supportedCiphers));
}
if (!result.isEmpty()) {
StringBuilder builder = new StringBuilder(result.size() * 16);
@@ -62,4 +62,14 @@
}
return result.toArray(new String[result.size()]);
}
+
+ private static Set<String> filter(final List<String> enabledCiphers,
final Set<String> supportedCiphers) {
+ Set<String> result = new LinkedHashSet<String>();
+ for (String enabledCipher : enabledCiphers) {
+ if (supportedCiphers.contains(enabledCipher)) {
+ result.add(enabledCipher);
+ }
+ }
+ return result;
+ }
}
Show replies by date