Topic "SSH host key fingerprint "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" does not mat"

Author Message
[View user's profile]

Joined: 2015-11-24
Posts: 1
I am using the .NET libraries and I am trying to connect to a server for the first time.
I am using public/private key authentication.
HostName, UserName, Password etc, have been set in memory variables before calling this code
below is my code
// Setup session options
SessionOptions sessionOptions = new SessionOptions
Protocol = Protocol.Sftp,
HostName = ftpServer,
UserName = ftpUser,
Password = ftpPassword,
//GiveUpSecurityAndAcceptAnySshHostKey = false,
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx",
SshPrivateKeyPath = PrivateKeyFile,
PortNumber = 22,
SshPrivateKeyPassphrase = PrivateKeyPass
/////Here I get the exception?/// Why?

using (Session session = new Session())

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult;
transferResult = session.PutFiles(localfilename, ftpfilename, false, transferOptions);
if (transferResult.IsSuccess)
return true;
return false;
catch (Exception e)
writeToLog(true, e.Message.ToString());
throw new Exception(e.Message);

I get the following error in the call to create the sessing

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

What am I doing wrong?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Do you really have the xx:xx:xx... there?
It's not a valid fingerprint.

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License