comparison src/ch/ethz/ssh2/transport/ServerKexManager.java @ 285:486df527ddc5 ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 18:33:40 -0700
parents 4ec87de11e71
children db9b028016de
comparison
equal deleted inserted replaced
284:4ec87de11e71 285:486df527ddc5
165 kxs.dhx.setE(dhi.getE()); 165 kxs.dhx.setE(dhi.getE());
166 166
167 byte[] hostKey = null; 167 byte[] hostKey = null;
168 168
169 if(kxs.np.server_host_key_algo.equals("ssh-rsa")) { 169 if(kxs.np.server_host_key_algo.equals("ssh-rsa")) {
170 hostKey = RSASHA1Verify.encodeSSHRSAPublicKey(kxs.local_rsa_key.getPublic()); 170 hostKey = RSASHA1Verify.encodeSSHRSAPublicKey((RSAPublicKey)kxs.local_rsa_key.getPublic());
171 } 171 }
172 172
173 if(kxs.np.server_host_key_algo.equals("ssh-dss")) { 173 if(kxs.np.server_host_key_algo.equals("ssh-dss")) {
174 hostKey = DSASHA1Verify.encodeSSHDSAPublicKey(kxs.local_dsa_key.getPublic()); 174 hostKey = DSASHA1Verify.encodeSSHDSAPublicKey((DSAPublicKey)kxs.local_dsa_key.getPublic());
175 } 175 }
176 176
177 try { 177 try {
178 kxs.H = kxs.dhx.calculateH(csh.getClientString(), csh.getServerString(), 178 kxs.H = kxs.dhx.calculateH(csh.getClientString(), csh.getServerString(),
179 kxs.remoteKEX.getPayload(), kxs.localKEX.getPayload(), hostKey); 179 kxs.remoteKEX.getPayload(), kxs.localKEX.getPayload(), hostKey);
185 kxs.K = kxs.dhx.getK(); 185 kxs.K = kxs.dhx.getK();
186 186
187 byte[] signature = null; 187 byte[] signature = null;
188 188
189 if(kxs.np.server_host_key_algo.equals("ssh-rsa")) { 189 if(kxs.np.server_host_key_algo.equals("ssh-rsa")) {
190 byte[] rs = RSASHA1Verify.generateSignature(kxs.H, kxs.local_rsa_key); 190 byte[] rs = RSASHA1Verify.generateSignature(kxs.H, (RSAPrivateKey)kxs.local_rsa_key.getPrivate());
191 signature = RSASHA1Verify.encodeSSHRSASignature(rs); 191 signature = RSASHA1Verify.encodeSSHRSASignature(rs);
192 } 192 }
193 193
194 if(kxs.np.server_host_key_algo.equals("ssh-dss")) { 194 if(kxs.np.server_host_key_algo.equals("ssh-dss")) {
195 byte[] ds = DSASHA1Verify.generateSignature(kxs.H, kxs.local_dsa_key, rnd); 195 byte[] ds = DSASHA1Verify.generateSignature(kxs.H, (DSAPrivateKey)kxs.local_dsa_key.getPrivate(), rnd);
196 signature = DSASHA1Verify.encodeSSHDSASignature(ds); 196 signature = DSASHA1Verify.encodeSSHDSASignature(ds);
197 } 197 }
198 198
199 PacketKexDHReply dhr = new PacketKexDHReply(hostKey, kxs.dhx.getF(), signature); 199 PacketKexDHReply dhr = new PacketKexDHReply(hostKey, kxs.dhx.getF(), signature);
200 tm.sendKexMessage(dhr.getPayload()); 200 tm.sendKexMessage(dhr.getPayload());