private void client_KeyExchangeCompleted(object sender, SshKeyExchangeInitializedEventArgs e) { var client = (SshClient)sender; // Load host key for chosen algorithm. if (e.HostKeyAlgorithm is SshDss) { using (var fileStream = new FileStream(Path.Combine(KeysDirectory, @"dss-default.key"), FileMode.Open, FileAccess.Read)) e.HostKeyAlgorithm.ImportKey(fileStream); } else if (e.HostKeyAlgorithm is SshRsa) { using (var fileStream = new FileStream(Path.Combine(KeysDirectory, @"rsa-default.key"), FileMode.Open, FileAccess.Read)) e.HostKeyAlgorithm.ImportKey(fileStream); } //MessageBox.Show(new SshPublicKey(e.HostKeyAlgorithm).GetFingerprint()); // Write to event log. LogClientEvent(client, "Key exchange completed.", EventLogEntryType.Information); }