Topic "Alternative SshHostKeyFingerprint Formatting Issue"

Author Message



I am using the .NET assembly of WinSCP574 in a SSIS project to establish a SFTP connection. The issue I am having is related to the fingerprint of the server, especially when providing multiple possible fingerprints (multiple values for SshHostKeyFingerprint).

Everything works just fine using just one Key:

SessionOptions sessionOptions = new SessionOptions
Protocol = Protocol.Sftp,
HostName = (string) Dts.Variables["User::HostName"].Value,
UserName = (string) Dts.Variables["User::UserName"].Value,
Password = (string) Dts.Variables["User::Password"].Value,
PortNumber = (string) Dts.Variables["User::PortNumber"].Value,
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

However, as soon as I add multiple SshHostKeyFingerprints with the following syntax, it fails:
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx; ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

The error message is, that the syntax doesn't match the pattern
((ssh-rsa|ssh-dss)( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2}(;((ssh-rsa|ssh-dss)( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2})*

In order to check that my syntax is correct, I did a check with Regex.Match, which returned true.

Am I missing anything? Is the current version of WinSCP still supporting multiple SshHostKeyFingerprints?

Thank you,
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
While the Regex.Match.Success is indeed true, it does not match whole string, just the first hostkey.

The assembly does not accept the space after the semicolon. Remove it.


Worked! Thank you for your help!


You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License