commit 0b144034572604c884d1ab3749ba0f1fd7ee8a07
parent de766767cba45027dfabb5262585562bd339dddf
Author: Daniel Gultsch <daniel@gultsch.de>
Date: Sun, 7 May 2017 10:49:25 +0200
print explicit warning when dh key size > 2048
Diffstat:
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
@@ -15,12 +15,12 @@
<dependency>
<groupId>rocks.xmpp</groupId>
<artifactId>xmpp-core-client</artifactId>
- <version>0.7.0</version>
+ <version>0.7.4</version>
</dependency>
<dependency>
<groupId>rocks.xmpp</groupId>
<artifactId>xmpp-extensions-client</artifactId>
- <version>0.7.0</version>
+ <version>0.7.4</version>
</dependency>
<dependency>
<groupId>de.measite.minidns</groupId>
diff --git a/src/main/java/eu/siacs/ComplianceTester.java b/src/main/java/eu/siacs/ComplianceTester.java
@@ -2,12 +2,14 @@ package eu.siacs;
import eu.siacs.compliance.suites.*;
import eu.siacs.compliance.TestSuiteFactory;
+import eu.siacs.utils.ExceptionUtils;
import rocks.xmpp.addr.Jid;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.sasl.AuthenticationException;
import rocks.xmpp.core.stream.StreamErrorException;
import rocks.xmpp.core.stream.model.errors.Condition;
+import java.security.InvalidAlgorithmParameterException;
import java.util.Arrays;
import java.util.List;
@@ -86,7 +88,11 @@ public class ComplianceTester {
}
}
} catch (XmppException e) {
- e.printStackTrace();
+ if (ExceptionUtils.getRootCause(e) instanceof InvalidAlgorithmParameterException) {
+ System.err.println("The ComplianceTester can not handle DH key sizes above 2048 bit. Modify your Prosody to use the default TLS configuration.");
+ } else {
+ System.err.println(e.getMessage());
+ }
}
}
}
diff --git a/src/main/java/eu/siacs/utils/ExceptionUtils.java b/src/main/java/eu/siacs/utils/ExceptionUtils.java
@@ -0,0 +1,13 @@
+package eu.siacs.utils;
+
+public class ExceptionUtils {
+ public static Throwable getRootCause(Throwable e) {
+ Throwable cause;
+ Throwable result = e;
+
+ while(null != (cause = result.getCause()) && (result != cause) ) {
+ result = cause;
+ }
+ return result;
+ }
+}