Login  
Search All Forums
Dart Home | PowerTCP SFTP & SSH for .NET | Custom Development Reply | PowerTCP SFTP & SSH for .NET Topics | Forums   
AuthorForum: PowerTCP SFTP & SSH for .NET
Topic: How to use a supplied private key file?
gdarbe

From: Brisbane, Australia
Posts: 1
Member Since: 07/19/18
posted July 19, 2018 7:51 PM

Hello All,

One of our clients we currently connect via Ftp is now implementing a change to go to Sftp with a private key etc...

They have provided a private key file for a test environment which when used say via FileZilla works fine. am just not sure how use this file with the Sftp control, any help would be appreciated.

the layout of the private key file supplied is below;

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20180420
Public-Lines: 6
<6 lines of encrypted text here>
Private-Lines: 14
<14 lines of encrypted text here>
Private-MAC:
<Mac address here>
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted July 20, 2018 11:32 AM

Hello,

That does not appear to be a key file type we support, but you can easily convert it by following the instructions I've copied from the help documentation:

You must convert it to the OpenSSH, SSH2, or SSH.com key format with the "puttygen" tool (can be downloaded from the Putty website). Load your key and use the "Conversions/Export OpenSSH key" functionality to produce a compatible PEM file.

For more information:
http://www.dart.com/help/ptsshnet/webframe.html#Public%20Key-Private%20Key%20Overview.html

Our included samples demonstrate public-key authentication (load the key file in the login form).

In-code, the easiest way is to specify the contents of the PEM file for SshLoginData.Pem (in addition to your other required information to the other properties):
http://www.dart.com/help/ptsshnet/webframe.html#Dart.Ssh~Dart.Ssh.SshLoginData~Pem.html

And pass that into Sftp.Authenticate:
http://www.dart.com/help/ptsshnet/webframe.html#Dart.Ssh~Dart.Ssh.SshConnection~Authenticate(SshLoginData).html

A simple connect and authentication is demonstrated here (which demonstrates keyboard-interactive, which may be necessary, depending upon your server):
http://www.dart.com/help/ptsshnet/webframe.html#Dart.Ssh~Dart.Ssh.SshConnection~Challenge_EV.html
Reply | PowerTCP SFTP & SSH for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX