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
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.
below is my code
I get the following error in the call to create the session:
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
try { // 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()) { session.Open(sessionOptions); // Upload files TransferOptions transferOptions = new TransferOptions(); transferOptions.TransferMode = TransferMode.Binary; TransferOperationResult transferResult; transferResult = session.PutFiles(localfilename, ftpfilename, false, transferOptions); transferResult.Check(); if (transferResult.IsSuccess) { return true; } else { return false; } } } catch (Exception e) { writeToLog(true, e.Message.ToString()); throw new Exception(e.Message); }
What am I doing wrong?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}(:|-)){15}[0-9a-f]{2}(;((ssh-rsa|ssh-dss)( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2})*/