Topic "C# having trouble using hostkey"

Author Message
Skkra
[View user's profile]

Joined: 2014-06-18
Posts: 2
Location: USA
I'm able to use WinSCP's library to do standard FTP, but when I'm trying to connect to a particular server, I'm having trouble figuring out how to set the SessionOptions. The command line that I use to connect successfully is as follows:

open ftps://username:password@ftps.website.net:1234 -explicitssl -hostkey="01:02:03:04:05:06:07:08:09:10:11:12:13:14:15:16:17:18:19:20" -passive

I'm unable to figure out the correct mix of SessionOptions to make this work, however. How would I set the PROTOCOL, FTPSMODE, and SSHHOSTKEYFINGERPRINT?



I've tried several different combinations, but always run into one error or another no matter what combination I've tried. I've gotten all of the below errors in my attempts, but I can't quite figure out how to set my SessionOptions. Can anyone help? Thanks so much!

SSH host key fingerprint "myfingerprint" does not match pattern /(ssh-rsa |ssh-dss )?\d+ ([0-9a-f]{2}Smile{15}[0-9a-f]{2}(;(ssh-rsa |ssh-dss )?\d+ ([0-9a-f]{2}Smile{15}[0-9a-f]{2})*/

SessionOptions.FtpSecure is not FtpSecure.None, but SessionOptions.Protocol is not Protocol.Ftp.

SessionOptions.TlsHostCertificateFingerprint or SessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate is set, but SessionOptions.FtpSecure is FtpSecure.None.
Skkra
[View user's profile]

Joined: 2014-06-18
Posts: 2
Location: USA
I figured it out. For anyone who may be having a similar problem, the answer is below.

First of all, the actual correct command line should've been:
open ftps://username:password@ftps.website.net:1234 -explicittls -hostkey="01:02:03:04:05:06:07:08:09:10:11:12:13:14:15:16:17:18:19:20" -passive

It should have been using explicitTLS on the command line, but it seemed to work with either. That was my mistake. This key is 20 pairs long, which is TLS it seems, rather than the slightly shorter SSL key.

What finally worked was using:
Protocol = FTP
FTPSMode = ExplicitTLS
TLSHostCertificateFingerprint = "01:02:03:04:05:06:07:08:09:10:11:12:13:14:15:16:17:18:19:20"

That combination of settings successfully made my connection. Thanks to anyone who checked out this topic. This is a great library.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License