SFTP connection Error - SSH host key fingerprint does not match pattern

Advertisement

raviteja4545
Joined:
Posts:
2
Location:
NewYork

SFTP connection Error - SSH host key fingerprint does not match pattern

After successfully connecting to SFTP using GUI, i am having trouble connecting to it in C# using visual studio.
ErrorMsg
System.ArgumentException
HResult=0x80070057
Message=SSH host key fingerprint "ssh-rsa ***********" does not match pattern /((ssh-rsa|ssh-dss|ssh-ed25519|ecdsa-sha2-nistp(256|384|521))( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2}(;((ssh-rsa|ssh-dss|ssh-ed25519|ecdsa-sha2-nistp(256|384|521))( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2})*/
Source=WinSCPnet
StackTrace:
at WinSCP.SessionOptions.SetSshHostKeyFingerprint(String s)
at AB.Barra.FTP.Program.Main(String[] args) in
Code generated by GUI
// Set up session options
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Sftp,
    HostName = "sftp.***.com",
    UserName = "********",
    Password = "********",
    SshHostKeyFingerprint = "ssh-rsa 2048 ****/*******************",
};
 
sessionOptions.AddRawSettings("ProxyMethod", "3");
sessionOptions.AddRawSettings("ProxyHost", "********");
sessionOptions.AddRawSettings("ProxyPort", "8082");
 
using (Session session = new Session())
{
    // Connect
    session.Open(sessionOptions);
 
    // Your code
}
can anyone help me with this error.

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: SFTP connection Error - SSH host key fingerprint does not match pattern

You have probably used a recent version of WinSCP GUI to generate a code with SHA-256 fingerprint (what is good).
But you are trying to use the code with an old version of WinSCP .NET assembly that does not support SHA-256 fingerprints.
Please upgrade the assembly to the latest version.

Reply with quote

Advertisement

You can post new topics in this forum