Velocedge
Velocedge

Reputation: 1455

Why is SFTP fingerprint from FileZilla not accepted by WinSCP .NET assembly in C#?

I'm setting up to put files using SFTP to a client's server. I have an SFTP server to test and developed a client using WinSCP in C# VS2022 on Windows Server 2019. I initially logged on to the test server using FileZilla and copied the fingerprint by double clicking it. I pasted that into my C# client and it worked as expected.

I did the very same thing with the client's SFTP server, but I get the error: "SSH host key fingerprint does not match pattern". The format does look slightly different from mine:

SHA256:tUlL3I72i+NOA.......DLTVoH35szgNVJiOGGhRV/ic

Mine has SHA256 [space] then the footprint. I'm not sure what the :tUlL3I72i+ is all about but I've tried removing it, turning the + into a space, etc. but same error.

What am I missing and how can I fix this?

Upvotes: 1

Views: 898

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202494

FileZilla's Unknown host key box looks like this:

enter image description here

In WinSCP .NET assembly, that maps to the following value of Session.SshHostKeyFingerprint:

"ssh-ed25519 255 1hI1HqP3IzoOWCABHGS7+GsrP2JUVsSs7oskK7HGP1E"

Though way easier is to use WinSCP GUI to generate a code template for you:

enter image description here

Upvotes: 2

Related Questions