diff src/ch/ethz/ssh2/crypto/dh/EcDhExchange.java @ 313:1d400fd78e4a ganymed

add ecdsa key support everywhere
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 16:19:33 -0700
parents cb179051f0f2
children
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/crypto/dh/EcDhExchange.java	Wed Jul 30 16:03:21 2014 -0700
+++ b/src/ch/ethz/ssh2/crypto/dh/EcDhExchange.java	Wed Jul 30 16:19:33 2014 -0700
@@ -27,9 +27,16 @@
  *
  */
 public class EcDhExchange extends GenericDhExchange {
+
+    /* Client public and private */
+
     private ECPrivateKey clientPrivate;
     private ECPublicKey clientPublic;
+
+    /* Server public */
+
     private ECPublicKey serverPublic;
+    private byte[] f;
 
     @Override
     public void init(String name) throws IOException {
@@ -78,6 +85,11 @@
     }
 
     @Override
+    public byte[] getF() {
+        return f;
+    }
+
+    @Override
     public void setF(byte[] f) throws IOException {
         if (clientPublic == null)
             throw new IllegalStateException("DhDsaExchange not initialized!");
@@ -88,6 +100,7 @@
             KeyFactory kf = KeyFactory.getInstance("EC");
             ECParameterSpec params = clientPublic.getParams();
             ECPoint serverPoint = ECDSASHA2Verify.decodeECPoint(f, params.getCurve());
+            this.f = f;
             this.serverPublic = (ECPublicKey) kf.generatePublic(new ECPublicKeySpec(serverPoint,
                                 params));
             ka = KeyAgreement.getInstance("ECDH");