diff src/ch/ethz/ssh2/transport/ClientKexManager.java @ 284:4ec87de11e71 ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 18:08:56 -0700
parents c3019725b123
children 486df527ddc5
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/transport/ClientKexManager.java	Fri Jul 18 17:32:11 2014 -0700
+++ b/src/ch/ethz/ssh2/transport/ClientKexManager.java	Fri Jul 18 18:08:56 2014 -0700
@@ -55,8 +55,14 @@
     }
 
     protected boolean verifySignature(byte[] sig, byte[] hostkey) throws IOException {
-        if(kxs.np.server_host_key_algo.equals("ssh-rsa")) {
-            RSASignature rs = RSASHA1Verify.decodeSSHRSASignature(sig);
+        if (kxs.np.server_host_key_algo.startsWith("ecdsa-sha2-")) {
+            byte[] rs = ECDSASHA2Verify.decodeSSHECDSASignature(sig);
+            ECPublicKey epk = ECDSASHA2Verify.decodeSSHECDSAPublicKey(hostkey);
+            log.log(50, "Verifying ecdsa signature");
+            return ECDSASHA2Verify.verifySignature(kxs.H, rs, epk);
+        }
+        if (kxs.np.server_host_key_algo.equals("ssh-rsa")) {
+            byte[] rs = RSASHA1Verify.decodeSSHRSASignature(sig);
             RSAPublicKey rpk = RSASHA1Verify.decodeSSHRSAPublicKey(hostkey);
 
             log.debug("Verifying ssh-rsa signature");
@@ -64,8 +70,8 @@
             return RSASHA1Verify.verifySignature(kxs.H, rs, rpk);
         }
 
-        if(kxs.np.server_host_key_algo.equals("ssh-dss")) {
-            DSASignature ds = DSASHA1Verify.decodeSSHDSASignature(sig);
+        if (kxs.np.server_host_key_algo.equals("ssh-dss")) {
+            byte[] ds = DSASHA1Verify.decodeSSHDSASignature(sig);
             DSAPublicKey dpk = DSASHA1Verify.decodeSSHDSAPublicKey(hostkey);
 
             log.debug("Verifying ssh-dss signature");