Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Connecting to OpenSSH server

$
0
0
It is working now. I don't see the difference so maybe it was something else I was doing wrong...
        public Boolean VerifyConnetion()
        {
            var passwordAuthMethod = new PasswordAuthenticationMethod(username, password);
            var connectionInfo = new ConnectionInfo(host, port, username, passwordAuthMethod);

            try
            {
                client = new ScpClient(connectionInfo);
                client.HostKeyReceived += HandleHostKeyReceived; ;
                client.Connect();
                client.Disconnect();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }

        private void HandleHostKeyReceived(object sender, HostKeyEventArgs ex)
        {
            if (ex.FingerPrint.SequenceEqual(new byte[] { 0x2a, 0x08, 0xd5, 0x69, 0xe0, 0x9f, 0xcc, 0xdb, 0x3d, 0xc2, 0x78, 0x06, 0x61, 0xd0, 0xf4, 0xc4 })) // TODO
            {
                ex.CanTrust = true;
            }
            else
            {
                ex.CanTrust = false;
            }
        }


Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>