diff src/ch/ethz/ssh2/transport/ServerKexManager.java @ 302:beaccc9df37b ganymed

add ecdsa key support everywhere
author Carl Byington <carl@five-ten-sg.com>
date Tue, 29 Jul 2014 20:23:00 -0700
parents ab3a99f11a36
children d2b303406d63
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/transport/ServerKexManager.java	Tue Jul 29 18:50:35 2014 -0700
+++ b/src/ch/ethz/ssh2/transport/ServerKexManager.java	Tue Jul 29 20:23:00 2014 -0700
@@ -176,7 +176,7 @@
                 byte[] hostKey = null;
 
                 if (kxs.np.server_host_key_algo.startsWith("ecdsa-sha2-")) {
-                    hostKey = ECDSASHA2Verify.encodeSSHECDSAPublicKey((ECDSAPublicKey)kxs.local_ec_key.getPublic());
+                    hostKey = ECDSASHA2Verify.encodeSSHECDSAPublicKey((ECPublicKey)kxs.local_ec_key.getPublic());
                 }
 
                 if(kxs.np.server_host_key_algo.equals("ssh-rsa")) {
@@ -200,8 +200,9 @@
                 byte[] signature = null;
 
                 if (kxs.np.server_host_key_algo.startsWith("ecdsa-sha2-")) {
-                    byte[] es = ECDSASHA2Verify.generateSignature(kxs.H, (ECDSAPrivateKey)kxs.local_ec_key.getPrivate());
-                    signature = ECDSASHA2Verify.encodeSSHECDSASignature(es);
+                    ECPrivateKey pk = (ECPrivateKey)kxs.local_ec_key.getPrivate();
+                    byte[] es = ECDSASHA2Verify.generateSignature(kxs.H, pk);
+                    signature = ECDSASHA2Verify.encodeSSHECDSASignature(es, pk.getParams());
                 }
 
                 if (kxs.np.server_host_key_algo.equals("ssh-rsa")) {