PublicKey-Authentication-in-SSH - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

PublicKey Authentication in SSH
VB code
Dim wodSSH1 As wodSSHCom
Dim key As Keys
Set wodSSH1 = New wodSSHCom
Set key = New Keys

'wodKeys component is part of wodSSH ActiveX component.
'Load private key from a file.
key.Load "c:\private.pem", "weonlydo" 'weonlydo is private key password

wodSSH1.HostName = "your_hostname"
'Select public key authentication.
wodSSH1.Authentication = authPubkey
wodSSH1.Protocol = SSH2
wodSSH1.Login = "your_login"
'Connect private key from wodKeys to wodSSH.
wodSSH1.PrivateKey = key
wodSSH1.Blocking = True 'Use synchronous connections
wodSSH1.Connect
VB.NET code
Dim wodSSH1 As New WeOnlyDo.Client.SSH
Dim key As New WeOnlyDo.Security.Cryptography.KeyManager

'wodKeyManager.NET component is part of wodSSH.NET component.
'Load private key from a file.
key.Load("c:\private.pem", "weonlydo") 'weonlydo is private key password

wodSSH1.Hostname = "your_hostname"
'Select public key authentication.
wodSSH1.Authentication = WeOnlyDo.Client.SSH.Authentications.PublicKey
wodSSH1.Login = "your_login"
'Connect private key from wodKeys to wodSSH.
wodSSH1.PrivateKey = key.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey)
wodSSH1.Blocking = True 'Use synchronous connections
wodSSH1.Connect()
C# code
WeOnlyDo.Client.SSH wodSSH1 = new WeOnlyDo.Client.SSH();
WeOnlyDo.Security.Cryptography.KeyManager key = new WeOnlyDo.Security.Cryptography.KeyManager();

//wodKeyManager.NET component is part of wodSSH.NET component.
//Load private key from a file.
key.Load(@"C:\private.pem", "weonlydo"); //weonlydo is private key password

wodSSH1.Hostname = "your_hostname";
//Select public key authentication.
wodSSH1.Authentication = WeOnlyDo.Client.SSH.Authentications.PublicKey;
wodSSH1.Login = "your_login";
//Connect private key from wodKeys to wodSSH.
wodSSH1.PrivateKey = key.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey);
wodSSH1.Blocking = true; //Use synchronous connections
wodSSH1.Connect();