diff src/ch/ethz/ssh2/KnownHosts.java @ 299:4c3a4e88c027 ganymed

add ecdsa key support everywhere
author Carl Byington <carl@five-ten-sg.com>
date Tue, 29 Jul 2014 18:08:09 -0700
parents ab3a99f11a36
children beaccc9df37b
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/KnownHosts.java	Tue Jul 29 18:01:08 2014 -0700
+++ b/src/ch/ethz/ssh2/KnownHosts.java	Tue Jul 29 18:08:09 2014 -0700
@@ -114,7 +114,7 @@
                 publicKeys.add(new KnownHostsEntry(hostnames, dpk));
             }
         }
-        else if (serverHostKeyAlgorithm.startsWith("ecdsa-")) {
+        else if (serverHostKeyAlgorithm.startsWith("ecdsa-sha2-")) {
             ECPublicKey epk = ECDSASHA2Verify.decodeSSHECDSAPublicKey(serverHostKey);
 
             synchronized(publicKeys) {
@@ -404,9 +404,9 @@
             String[] arr = line.split(" ");
 
             if(arr.length >= 3) {
-                if((arr[1].compareTo("ssh-rsa") == 0) ||
-                   (arr[1].compareTo("ssh-dss") == 0) ||
-                   (arr[1].startsWith("ecdsa-sha2-") == 0)) {
+                if ((arr[1].compareTo("ssh-rsa") == 0) ||
+                    (arr[1].compareTo("ssh-dss") == 0) ||
+                    (arr[1].startsWith("ecdsa-sha2-"))) {
                     String[] hostnames = arr[0].split(",");
 
                     byte[] msg = Base64.decode(arr[2].toCharArray());
@@ -702,7 +702,7 @@
         }
         else if("ssh-dss".equals(keyType)) {
         }
-        else if (keyType.startsWith("ecdsa-sha2-") {
+        else if (keyType.startsWith("ecdsa-sha2-")) {
         }
         else {
             throw new IllegalArgumentException("Unknown key type " + keyType);