Mercurial > 510Connectbot
diff src/com/five_ten_sg/connectbot/transport/SSH.java @ 342:175c7d68f3c4
merge ganymed into mainline
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 31 Jul 2014 16:33:38 -0700 |
parents | 5351641c8a46 |
children |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/SSH.java Thu Jul 17 22:09:05 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/transport/SSH.java Thu Jul 31 16:33:38 2014 -0700 @@ -31,6 +31,8 @@ import java.security.PublicKey; import java.security.interfaces.DSAPrivateKey; import java.security.interfaces.DSAPublicKey; +import java.security.interfaces.ECPrivateKey; +import java.security.interfaces.ECPublicKey; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.InvalidKeySpecException; @@ -59,23 +61,24 @@ import android.os.Environment; import android.util.Log; -import com.trilead.ssh2.AuthAgentCallback; -import com.trilead.ssh2.ChannelCondition; -import com.trilead.ssh2.Connection; -import com.trilead.ssh2.ConnectionInfo; -import com.trilead.ssh2.ConnectionMonitor; -import com.trilead.ssh2.DynamicPortForwarder; -import com.trilead.ssh2.InteractiveCallback; -import com.trilead.ssh2.KnownHosts; -import com.trilead.ssh2.LocalPortForwarder; -import com.trilead.ssh2.SCPClient; -import com.trilead.ssh2.ServerHostKeyVerifier; -import com.trilead.ssh2.Session; -import com.trilead.ssh2.HTTPProxyData; -import com.trilead.ssh2.HTTPProxyException; -import com.trilead.ssh2.crypto.PEMDecoder; -import com.trilead.ssh2.signature.DSASHA1Verify; -import com.trilead.ssh2.signature.RSASHA1Verify; +import ch.ethz.ssh2.AuthAgentCallback; +import ch.ethz.ssh2.ChannelCondition; +import ch.ethz.ssh2.Connection; +import ch.ethz.ssh2.ConnectionInfo; +import ch.ethz.ssh2.ConnectionMonitor; +import ch.ethz.ssh2.DynamicPortForwarder; +import ch.ethz.ssh2.InteractiveCallback; +import ch.ethz.ssh2.KnownHosts; +import ch.ethz.ssh2.LocalPortForwarder; +import ch.ethz.ssh2.SCPClient; +import ch.ethz.ssh2.ServerHostKeyVerifier; +import ch.ethz.ssh2.Session; +import ch.ethz.ssh2.HTTPProxyData; +import ch.ethz.ssh2.HTTPProxyException; +import ch.ethz.ssh2.crypto.PEMDecoder; +import ch.ethz.ssh2.signature.DSASHA1Verify; +import ch.ethz.ssh2.signature.ECDSASHA2Verify; +import ch.ethz.ssh2.signature.RSASHA1Verify; /** * @author Kenny Root @@ -144,7 +147,7 @@ algorithmName = "RSA"; else if ("ssh-dss".equals(serverHostKeyAlgorithm)) algorithmName = "DSA"; - else if (serverHostKeyAlgorithm.startsWith("ecdsa-")) + else if (serverHostKeyAlgorithm.startsWith("ecdsa-sha2-")) algorithmName = "EC"; else algorithmName = serverHostKeyAlgorithm; @@ -562,7 +565,9 @@ catch (IOException e) { Log.e(TAG, "Problem in SSH connection thread during authentication", e); // Display the reason in the text. - bridge.outputLine(e.getCause().getMessage()); + Throwable t = e.getCause(); + String m = (t == null) ? e.getMessage() : t.getMessage(); + bridge.outputLine(m); onDisconnect(); return; } @@ -1062,6 +1067,10 @@ DSAPublicKey pubkey = (DSAPublicKey) pair.getPublic(); pubKeys.put(entry.getKey(), DSASHA1Verify.encodeSSHDSAPublicKey(pubkey)); } + else if (privKey instanceof ECPrivateKey) { + ECPublicKey pubkey = (ECPublicKey) pair.getPublic(); + pubKeys.put(entry.getKey(), ECDSASHA2Verify.encodeSSHECDSAPublicKey(pubkey)); + } else continue; }