Mercurial > 510Connectbot
comparison src/ch/ethz/ssh2/transport/ServerKexManager.java @ 306:90e47d99ea54 ganymed
add ecdsa key support everywhere
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 30 Jul 2014 13:38:04 -0700 |
parents | d2b303406d63 |
children | 42b15aaa7ac7 |
comparison
equal
deleted
inserted
replaced
305:d2b303406d63 | 306:90e47d99ea54 |
---|---|
51 } | 51 } |
52 | 52 |
53 public void handleMessage(byte[] msg) throws IOException { | 53 public void handleMessage(byte[] msg) throws IOException { |
54 PacketKexInit kip; | 54 PacketKexInit kip; |
55 | 55 |
56 if (msg == null) { | |
57 synchronized (accessLock) { | |
58 connectionClosed = true; | |
59 accessLock.notifyAll(); | |
60 return; | |
61 } | |
62 } | |
63 | |
56 if((kxs == null) && (msg[0] != Packets.SSH_MSG_KEXINIT)) { | 64 if((kxs == null) && (msg[0] != Packets.SSH_MSG_KEXINIT)) { |
57 throw new PacketTypeException(msg[0]); | 65 throw new PacketTypeException(msg[0]); |
58 } | 66 } |
59 | 67 |
60 if(ignore_next_kex_packet) { | 68 if(ignore_next_kex_packet) { |
90 if(kxs.remoteKEX.isFirst_kex_packet_follows() && (kxs.np.guessOK == false)) { | 98 if(kxs.remoteKEX.isFirst_kex_packet_follows() && (kxs.np.guessOK == false)) { |
91 // Guess was wrong, we need to ignore the next kex packet. | 99 // Guess was wrong, we need to ignore the next kex packet. |
92 ignore_next_kex_packet = true; | 100 ignore_next_kex_packet = true; |
93 } | 101 } |
94 | 102 |
95 if(kxs.np.kex_algo.equals("diffie-hellman-group1-sha1") | 103 if (kxs.np.kex_algo.equals("diffie-hellman-group1-sha1") || |
96 || kxs.np.kex_algo.equals("diffie-hellman-group14-sha1")) { | 104 kxs.np.kex_algo.equals("diffie-hellman-group14-sha1") || |
97 kxs.dhx = new DhExchange(); | 105 kxs.np.kex_algo.equals("ecdh-sha2-nistp256") || |
98 | 106 kxs.np.kex_algo.equals("ecdh-sha2-nistp384") || |
99 if(kxs.np.kex_algo.equals("diffie-hellman-group1-sha1")) { | 107 kxs.np.kex_algo.equals("ecdh-sha2-nistp521")) { |
100 kxs.dhx.serverInit(1, rnd); | 108 kxs.dhx = GenericDhExchange.getInstance(kxs.np.kex_algo); |
101 } | 109 kxs.dhx.init(kxs.np.kex_algo); |
102 else { | |
103 kxs.dhx.serverInit(14, rnd); | |
104 } | |
105 | |
106 kxs.state = 1; | 110 kxs.state = 1; |
107 return; | 111 return; |
108 } | 112 } |
109 | 113 |
110 throw new IllegalStateException("Unkown KEX method!"); | 114 throw new IllegalStateException("Unkown KEX method!"); |
160 | 164 |
161 if((kxs == null) || (kxs.state == 0)) { | 165 if((kxs == null) || (kxs.state == 0)) { |
162 throw new IOException("Unexpected Kex submessage!"); | 166 throw new IOException("Unexpected Kex submessage!"); |
163 } | 167 } |
164 | 168 |
165 if(kxs.np.kex_algo.equals("diffie-hellman-group1-sha1") | 169 if (kxs.np.kex_algo.equals("diffie-hellman-group1-sha1") || |
166 || kxs.np.kex_algo.equals("diffie-hellman-group14-sha1")) { | 170 kxs.np.kex_algo.equals("diffie-hellman-group14-sha1") || |
171 kxs.np.kex_algo.equals("ecdh-sha2-nistp256") || | |
172 kxs.np.kex_algo.equals("ecdh-sha2-nistp384") || | |
173 kxs.np.kex_algo.equals("ecdh-sha2-nistp521")) { | |
167 if(kxs.state == 1) { | 174 if(kxs.state == 1) { |
168 PacketKexDHInit dhi = new PacketKexDHInit(msg); | 175 PacketKexDHInit dhi = new PacketKexDHInit(msg); |
169 | 176 |
170 kxs.dhx.setE(dhi.getE()); | 177 kxs.dhx.setE(dhi.getE()); |
171 | 178 |