aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/com/trilead/ssh2/transport/KexManager.java5
2 files changed, 6 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 665105b..895d821 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,3 +3,6 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased][unreleased]
+### Fixed
+- Key exchange and host key algorithm preference order was not being
+ respected.
diff --git a/src/com/trilead/ssh2/transport/KexManager.java b/src/com/trilead/ssh2/transport/KexManager.java
index 2476b76..acf2812 100644
--- a/src/com/trilead/ssh2/transport/KexManager.java
+++ b/src/com/trilead/ssh2/transport/KexManager.java
@@ -8,6 +8,7 @@ import java.security.SecureRandom;
import java.security.interfaces.DSAPublicKey;
import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAPublicKey;
+import java.util.LinkedHashSet;
import java.util.Set;
import java.util.TreeSet;
@@ -61,7 +62,7 @@ public class KexManager
supportsEc = keyFact != null;
}
- private static final Set<String> HOSTKEY_ALGS = new TreeSet<String>();
+ private static final Set<String> HOSTKEY_ALGS = new LinkedHashSet<String>();
static {
if (supportsEc) {
HOSTKEY_ALGS.add("ecdsa-sha2-nistp256");
@@ -72,7 +73,7 @@ public class KexManager
HOSTKEY_ALGS.add("ssh-dsa");
}
- private static final Set<String> KEX_ALGS = new TreeSet<String>();
+ private static final Set<String> KEX_ALGS = new LinkedHashSet<String>();
static {
if (supportsEc) {
KEX_ALGS.add("ecdh-sha2-nistp256");