SSH key which is used in the code seems to wrong. Please provide the correct key then this error will be gone.
- jyothi
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.HostName = "localhost";
sessionOptions.Password = "test";
sessionOptions.UserName = "test";
sessionOptions.Protocol = Protocol.Ftp;
sessionOptions.FtpSecure = FtpSecure.Implicit;
sessionOptions.PortNumber = 990;
sessionOptions.FtpMode = FtpMode.Passive;
sessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate = true;
using (Session session = CreateSession())
{
session.Open(sessionOptions);
}
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.HostName = "localhost";
sessionOptions.Password = "test";
sessionOptions.UserName = "test";
sessionOptions.Protocol = Protocol.Ftp;
sessionOptions.FtpSecure = FtpSecure.Implicit;
sessionOptions.PortNumber = 990;
sessionOptions.FtpMode = FtpMode.Passive;
sessionOptions.TlsHostCertificateFingerprint = "a0:cd:69:37:d2:f6:d3:ee:a7:5d:39:3d:e7:5e:36:f4:9a:83:45:60";
using (Session session = CreateSession())
{
session.Open(sessionOptions);
}
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.HostName = _hostName;
sessionOptions.Password = _password;
sessionOptions.UserName = _userName;
sessionOptions.Protocol = Protocol.Ftp;
sessionOptions.FtpSecure = FtpSecure.Implicit;
sessionOptions.PortNumber = 990;
sessionOptions.FtpMode = FtpMode.Passive;
sessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate = true;
System.ArgumentException: SessionOptions.SshHostKey or SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey is set, but SessionOptions.Protocol is not Protocol.Sftp nor Protocol.Scp.
sessionOptions.GiveUpSecurityAndAcceptAnySshHostKey
sessionOptions.TlsHostCertificateFingerprint = "61:79:71...";
sessionOptions.SshHostKeyFingerprint = "61:79:71..."
System.ArgumentException: SSH host key fingerprint "61:79:71..." does not match 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})*/