diff options
author | Kenny Root <kenny@the-b.org> | 2008-12-11 21:38:34 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2008-12-11 21:38:34 +0000 |
commit | 7cf1f4248c9a1600a0a2fa5f842c123c72be2a51 (patch) | |
tree | f3a3bb02df434d00ce11db6e5bf08a5ec548002d | |
parent | 4b5d2d600bebadfec5ae23ef1cfea70dbb979bc2 (diff) | |
download | connectbot-7cf1f4248c9a1600a0a2fa5f842c123c72be2a51.tar.gz connectbot-7cf1f4248c9a1600a0a2fa5f842c123c72be2a51.tar.bz2 connectbot-7cf1f4248c9a1600a0a2fa5f842c123c72be2a51.zip |
Output algorithm during connection.
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index 9fe9cd6..bbd811e 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -52,6 +52,7 @@ import android.view.View.OnKeyListener; 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; @@ -172,6 +173,8 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal protected BridgeDisconnectedListener disconnectListener = null; + protected ConnectionInfo connectionInfo; + public class HostKeyVerifier implements ServerHostKeyVerifier { public boolean verifyServerHostKey(String hostname, int port, String serverHostKeyAlgorithm, byte[] serverHostKey) throws Exception { @@ -307,7 +310,26 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal new Thread(new Runnable() { public void run() { try { - connection.connect(new HostKeyVerifier()); + connectionInfo = connection.connect(new HostKeyVerifier()); + + if (connectionInfo.clientToServerCryptoAlgorithm + .equals(connectionInfo.serverToClientCryptoAlgorithm) + && connectionInfo.clientToServerMACAlgorithm + .equals(connectionInfo.serverToClientMACAlgorithm)) { + outputLine(String.format("Using algorithm: %s %s", + connectionInfo.clientToServerCryptoAlgorithm, + connectionInfo.clientToServerMACAlgorithm)); + } else { + outputLine(String.format( + "Client-to-server algorithm: %s %s", + connectionInfo.clientToServerCryptoAlgorithm, + connectionInfo.clientToServerMACAlgorithm)); + + outputLine(String.format( + "Server-to-client algorithm: %s %s", + connectionInfo.serverToClientCryptoAlgorithm, + connectionInfo.serverToClientMACAlgorithm)); + } } catch (IOException e) { Log.e(TAG, "Problem in SSH connection thread during authentication", e); @@ -717,7 +739,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal } // skip keys if we aren't connected yet or have been disconnected - if(disconnected || session == null) + if (disconnected || session == null) return false; boolean printing = (keymap.isPrintingKey(keyCode) || keyCode == KeyEvent.KEYCODE_SPACE); |