Topic "Alternative SshHostKeyFingerprint Formatting Issue"

Author Message
CB

Guest


Hello,

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,
Christian
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
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.
CB

Guest


Worked! Thank you for your help!

Christian
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