Author: markt
Date: Wed Jul 30 07:05:27 2014
New Revision: 1614565
URL: http://svn.apache.org/r1614565
Log:
Fix OpenSSL path configuration
Add test to check for new/missing OpenSSL ciphers (currently disabled)
Modified:
tomcat/trunk/test/org/apache/tomcat/util/net/jsse/openssl/TestCipher.java
Modified:
tomcat/trunk/test/org/apache/tomcat/util/net/jsse/openssl/TestCipher.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/jsse/openssl/TestCipher.java?rev=1614565&r1=1614564&r2=1614565&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/jsse/openssl/TestCipher.java
(original)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/jsse/openssl/TestCipher.java
Wed Jul 30 07:05:27 2014
@@ -24,8 +24,8 @@ import java.util.List;
import java.util.Set;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
-
import org.apache.catalina.util.IOTools;
import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream;
@@ -67,6 +67,32 @@ public class TestCipher {
}
+ /**
+ * Checks that the unit tests are running with a version of OpenSSL that
+ * includes all the expected ciphers and does not include any unexpected
+ * ones.
+ */
+ @Test
+ @Ignore // Mapping code currently defines 48 extra cipher suites. Figure
out
+ // why.
+ public void testOpenSSLCipherAvailability() throws Exception {
+ Set<String> availableCipherSuites = getOpenSSLCiphersAsSet("ALL");
+ Set<String> expectedCipherSuites = new HashSet<>();
+ for (Cipher cipher : Cipher.values()) {
+ expectedCipherSuites.add(cipher.getOpenSSLAlias());
+ }
+
+ Set<String> unavailableCipherSuites = new HashSet<>();
+ unavailableCipherSuites.addAll(expectedCipherSuites);
+ unavailableCipherSuites.removeAll(availableCipherSuites);
+ StringBuilder unavailableList = new StringBuilder();
+ for (String cipher : unavailableCipherSuites) {
+ unavailableList.append(cipher);
+ unavailableList.append(' ');
+ }
+ Assert.assertEquals(unavailableList.toString(), 0,
unavailableCipherSuites.size());
+ }
+
private static Set<String> getOpenSSLCiphersAsSet(String specification)
throws Exception {
String[] ciphers =
getOpenSSLCiphersAsExpression(specification).trim().split(":");
Set<String> result = new HashSet<>(ciphers.length);
@@ -79,7 +105,7 @@ public class TestCipher {
private static String getOpenSSLCiphersAsExpression(String specification)
throws Exception {
- String openSSLPath = System.getProperty("test.openssl.path","openssl");
+ String openSSLPath =
System.getProperty("tomcat.test.openssl.path","openssl");
StringBuilder cmd = new StringBuilder(openSSLPath + " ciphers");
if (specification != null) {
cmd.append(' ');
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]