Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(C# UWP/WinRT) Get SSH Server Authentication MethodsDemonstrates how to get the authentication methods of an SSH server. This example requires Chilkat v9.5.0.78 or greater.
// This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Chilkat.Ssh ssh = new Chilkat.Ssh(); // To get the authentication methods offered by an SSH server, we first connect. bool success = await ssh.ConnectAsync("example.com",22); if (success != true) { Debug.WriteLine(ssh.LastErrorText); return; } // Next, we call GetAuthMethods to receive a comma separated list of authentication methods string authMethods = await ssh.GetAuthMethodsAsync(); if (ssh.LastMethodSuccess != true) { Debug.WriteLine(ssh.LastErrorText); return; } // For example: publickey,password,keyboard-interactive Debug.WriteLine("Authentication methods suported by this serve: " + authMethods); // IMPORTANT: // Getting the authentication methods will intentionally disconnect from the server. // We'll need to re-connect, etc. to continue.. // For example.. bool success = await ssh.ConnectAsync("example.com",22); if (success != true) { Debug.WriteLine(ssh.LastErrorText); return; } success = await ssh.AuthenticatePwAsync("myLogin","myPassword"); if (success != true) { Debug.WriteLine(ssh.LastErrorText); return; } Debug.WriteLine("SSH Authentication successful."); // ... ssh.Disconnect(); |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.