public override void init(Session session, byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) { this.session=session; this.V_S=V_S; this.V_C=V_C; this.I_S=I_S; this.I_C=I_C; // sha=new SHA1(); // sha.init(); try { Type t=Type.GetType(session.getConfig("sha-1")); sha=(HASH)(Activator.CreateInstance(t)); sha.init(); } catch(Exception ee) { Console.WriteLine(ee); } buf=new Buffer(); packet=new Packet(buf); try { Type t=Type.GetType(session.getConfig("dh")); dh=(DH)(Activator.CreateInstance(t)); dh.init(); } catch(Exception ee) { throw ee; } dh.setP(p); dh.setG(g); // The client responds with: // byte SSH_MSG_KEXDH_INIT(30) // mpint e <- g^x mod p // x is a random number (1 < x < (p-1)/2) e=dh.getE(); packet.reset(); buf.putByte((byte)SSH_MSG_KEXDH_INIT); buf.putMPInt(e); session.write(packet); state=SSH_MSG_KEXDH_REPLY; }