aboutsummaryrefslogtreecommitdiffstats
path: root/lib/src/main/java/com/trilead/ssh2
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2015-04-04 23:09:34 -0700
committerKenny Root <kenny@the-b.org>2015-04-05 16:00:27 -0700
commitb79bd8c02343fa0751b8e8fba4d8355bc47ea5ba (patch)
tree9e55c71e5e766825ff8f76a58ddff107c91f913b /lib/src/main/java/com/trilead/ssh2
parentdf68511544c9979b1868bb98ebc004fab885509a (diff)
downloadsshlib-b79bd8c02343fa0751b8e8fba4d8355bc47ea5ba.tar.gz
sshlib-b79bd8c02343fa0751b8e8fba4d8355bc47ea5ba.tar.bz2
sshlib-b79bd8c02343fa0751b8e8fba4d8355bc47ea5ba.zip
Keep order for crypto wishlist
Switch from TreeSet to LinkedHashMap since the preference is determined by iterating over the Set for both KEX_ALGS and HOST_KEY_ALGS. The order before was based on string comparisons(!) Change-Id: Ia4573d67f35a5371eb8c70dde631085d61570fe9
Diffstat (limited to 'lib/src/main/java/com/trilead/ssh2')
-rw-r--r--lib/src/main/java/com/trilead/ssh2/transport/KexManager.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/src/main/java/com/trilead/ssh2/transport/KexManager.java b/lib/src/main/java/com/trilead/ssh2/transport/KexManager.java
index 2476b76..acf2812 100644
--- a/lib/src/main/java/com/trilead/ssh2/transport/KexManager.java
+++ b/lib/src/main/java/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");