I can´t connect with private key without password

Advertisement

Nacho
Joined:
Posts:
2
Location:
Zaragoza

I can´t connect with private key without password

Hi,

I trying to connect SFTP with ppk file without password with .net assembly with session options c#,this is my code

     SessionOptions sessionOptions = new SessionOptions();
     sessionOptions.Protocol = Protocol.Sftp;
     sessionOptions.HostName = "xxx.xxx.xxx.xxx";
     sessionOptions.PortNumber = 22;
     sessionOptions.UserName = "user";
     sessionOptions.SshPrivateKeyPath = path

     using (Session session = new Session())
     {
        try
        {
            session.Open(sessionOptions);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
     }
The message I receive when trying is : "SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.SshHostKeyFingerprint is not set"

I try to connect with the graphical interface with the same configuration and it works at the first.

Some suggestion?

Thanks!!!!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,808
Location:
Prague, Czechia

Re: I can´t connect with private key without password

Well, so do what the message says:
https://winscp.net/eng/docs/message_sessionoptions_sshhostkeyfingerprint_is_not_set

Set the SessionOptions.SshHostKeyFingerprint.
https://winscp.net/eng/docs/library_sessionoptions#sshhostkeyfingerprint

If you can login in GUI, it can generate a working code template for you:
https://winscp.net/eng/docs/ui_generateurl#code

Reply with quote

Nacho
Joined:
Posts:
2
Location:
Zaragoza

Re: I can´t connect with private key without password

martin wrote:

Well, so do what the message says.
Set the SessionOptions.SshHostKeyFingerprint.
https://winscp.net/eng/docs/library_sessionoptions#sshhostkeyfingerprint

If you can login in GUI, it can generate a working code template for you:
https://winscp.net/eng/docs/ui_generateurl#code

Thank you!! i scan figerprint and add to SessionOptions.SshHostKeyFingerPrint and it works perfectly, Now i need a dll that works find with 32 bit

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,808
Location:
Prague, Czechia

Re: I can´t connect with private key without password

Nacho wrote:

Now i need a dll that works find with 32 bit
WinSCP .NET assembly works both in 32 and 64-bit.

Reply with quote

Advertisement

You can post new topics in this forum