After reading through the WinSCP .NET docs on SSH keys I need some help. I imported the site from a file and can successfully login via the winscp.exe UI. I verified on the server and protocol information form that I am using the correct fingerprint.
Valid fingerprint (copied directly from WinSCP UI):
ssh-rsa 2048 4d+341...
or
ssh-rsa 2048 7b:e4:e2...
Error Messages:
Host key does not match configured key fingerprint "ssh-rsa 2048 7b:e4:e2..."!
Host key fingerprint is ssh-rsa 2048 KWrXZJFJPrG2J37NoVUvsyu/YGuAfwSNzBDz+qZROqY=
Host key does not match configured key fingerprint "ssh-rsa 2048 4d+341..."!
Host key fingerprint is ssh-rsa 2048 KWrXZJFJPrG2J37NoVUvsyu/YGuAfwSNzBDz+qZROqY=
When I try to use the fingerprint the error message suggest it revokes my key...I used the instructions at this link to clear everything and start over:
https://winscp.net/eng/docs/ui_cleanup
I could not find anything in the registry or appdata folders that would be caching the "key fingerprint" in the error message.
Below is the C# code for the session options. All values are passed in from an XML config file and are valid. The only issue is with the fingerprint...
C# Code
SessionOptions sessionOptions = new SessionOptions()
{
Protocol = Protocol.Sftp,
HostName = hostName,
UserName = userName,
SshPrivateKeyPath = SshPrivateKeyPath,
PrivateKeyPassphrase = password,
SshHostKeyFingerprint = sshHostKeyFingerPrint,
PortNumber = 22
};
How do I overcome this mismatch? Thanks,