PublicKey-Authentication-in-SFTP - 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 SFTP
VB code
Dim wodSFTP1 As wodSFTPCom
Dim wodKeys As Keys
Set wodSFTP1 = New wodSFTPCom
Set wodKeys = New Keys

'wodKeys component is part of wodSFTP ActiveX component.
'Using wodKeys Load Method private key is loaded from file.
wodKeys.Load "c:\private.pem", "weonlydo" 'weonlydo is private key password

'Set authentication to public key type.
wodSFTP1.Authentication = authPubkey

'Connect private key from wodKeys to wodSFTP.
wodSFTP1.PrivateKey = wodKeys

wodSFTP1.HostName = "your_hostname"
wodSFTP1.Login = "your_login"
wodSFTP1.Blocking = True  'Use synchronous connections
wodSFTP1.Connect
VB.NET code
Dim wodSFTP1 As New WeOnlyDo.Client.SFTP
Dim KeyManager As New WeOnlyDo.Security.Cryptography.KeyManager

'wodKeyManager.NET component is part of wodSFTP.NET component.
'Using wodKeyManager.NET Load Method private key is loaded from file.
KeyManager.Load("c:\private.pem", "weonlydo")  'weonlydo is private key password

'Set authentication to public key type.
wodSFTP1.Authentication = WeOnlyDo.Client.SFTP.Authentications.PublicKey

'Connect private key from wodKeyManager.NET to wodSFTP.NET.
wodSFTP1.PrivateKey = KeyManager.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey)

wodSFTP1.Hostname = "your_hostname"
wodSFTP1.Login = "your_login"
wodSFTP1.Blocking = True  'Use synchronous connections
wodSFTP1.Connect()
C# code
WeOnlyDo.Client.SFTP wodSFTP1 = new WeOnlyDo.Client.SFTP();
WeOnlyDo.Security.Cryptography.KeyManager KeyManager = new WeOnlyDo.Security.Cryptography.KeyManager();

//wodKeyManager.NET component is part of wodSFTP.NET component.
//Using wodKeyManager.NET Load Method private key is loaded from file.
KeyManager.Load("C:\\private.pem","weonlydo");  //weonlydo is private key password

//Set authentication to public key type.
wodSFTP1.Authentication = WeOnlyDo.Client.SFTP.Authentications.PublicKey;

//Connect private key from wodKeyManager.NET to wodSFTP.NET.
wodSFTP1.PrivateKey = KeyManager.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey);

wodSFTP1.Hostname = "your_hostname";
wodSFTP1.Login = "your_login";
wodSFTP1.Blocking = true;  //Use synchronous connections
wodSFTP1.Connect();