Topic "WinSCP .NET assembly Host Key not verified"

Author Message
RajeshDesai
[View user's profile]

Joined: 2012-04-27
Posts: 5
Location: Manchester (UK)
I am using the lateest WinSCP and am trying to start a session using C# and Vs2010 and Pageant whaich has verified the Passkey

I have tried to log the session to see where the problem is but amnot able to do so.

try
{
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "sftp.incendiaprepaid.co.uk",
UserName = "AutocabLive",
SshHostKey = "ssh-rsa 1024 12:06:9a:b1:4f:84:bf:6b:0a:d4:18:25:79:ec:8e:58",
SshPrivateKey = "rsa-key-20120210"
};

using( Session session = new Session() )
{
session.SessionLogPath = @"C:\WinSCp.log";

// Connect
session.Open( sessionOptions );

I have read the documentation but cannot see what other setting I require to log the session.

I have used the sample code from the documentation to test the connection
Advertisements
RajeshDesai
[View user's profile]

Joined: 2012-04-27
Posts: 5
Location: Manchester (UK)
I have managed to get the session log working and have noticed that my computer has 2 Host Keys, one for WinSCP and the other for Pageant and have noticed that the applicaion only uses the one for WinSCP. I would tried using the Pageant's Host Key and the relevant key but still cannot get it working.

The attached log file shows entries for both cases.

Any assistance here would be helpful
WinSCP.log (7.61 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Session.SshPrivateKey should be set to a path to the provate key file, not name of the key. anyway, if you are using Pageant, you do not need to set it at all.
_________________
Martin Prikryl
RajeshDesai
[View user's profile]

Joined: 2012-04-27
Posts: 5
Location: Manchester (UK)
Using the follwoing setting for SessionOptions

Protocol = Protocol.Sftp,
HostName = "sftp.incendiaprepaid.co.uk",
UserName = "AutocabLive",
SshHostKey = "ssh-rsa 1024 12:06:9a:b1:4f:84:bf:6b:0a:d4:18:25:79:ec:8e:58",

I get the following error log:

. 2012-05-03 16:10:56.130 --------------------------------------------------------------------------
. 2012-05-03 16:10:56.130 WinSCP Version 5.0.6 (Build 2074) (OS 5.1.2600 Service Pack 3)
. 2012-05-03 16:10:56.130 Configuration: nul
. 2012-05-03 16:10:56.130 Local account: CLIENT-52\ASPNET
. 2012-05-03 16:10:56.130 Login time: 03 May 2012 16:10:56
. 2012-05-03 16:10:56.130 --------------------------------------------------------------------------
. 2012-05-03 16:10:56.130 Session name: AutocabLive@sftp.incendiaprepaid.co.uk (Ad-Hoc session)
. 2012-05-03 16:10:56.130 Host name: sftp.incendiaprepaid.co.uk (Port: 22)
. 2012-05-03 16:10:56.130 User name: AutocabLive (Password: No, Key file: No)
. 2012-05-03 16:10:56.130 Tunnel: No
. 2012-05-03 16:10:56.130 Transfer Protocol: SFTP
. 2012-05-03 16:10:56.130 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2012-05-03 16:10:56.130 Proxy: none
. 2012-05-03 16:10:56.130 SSH protocol version: 2; Compression: No
. 2012-05-03 16:10:56.130 Bypass authentication: No
. 2012-05-03 16:10:56.130 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2012-05-03 16:10:56.130 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2012-05-03 16:10:56.130 SSH Bugs: -,-,-,-,-,-,-,-,-,-
. 2012-05-03 16:10:56.130 SFTP Bugs: -,-
. 2012-05-03 16:10:56.130 Return code variable: Autodetect; Lookup user groups: -
. 2012-05-03 16:10:56.130 Shell: default
. 2012-05-03 16:10:56.130 EOL: 0, UTF: 2
. 2012-05-03 16:10:56.130 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2012-05-03 16:10:56.130 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2012-05-03 16:10:56.130 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2012-05-03 16:10:56.130 Cache directory changes: Yes, Permanent: Yes
. 2012-05-03 16:10:56.130 DST mode: 1
. 2012-05-03 16:10:56.130 --------------------------------------------------------------------------
. 2012-05-03 16:10:56.130 Looking up host "sftp.incendiaprepaid.co.uk"
. 2012-05-03 16:10:56.130 Connecting to 109.108.148.66 port 22
. 2012-05-03 16:10:56.193 Server version: SSH-2.0-CoreFTP-0.1.2
. 2012-05-03 16:10:56.193 Using SSH protocol version 2
. 2012-05-03 16:10:56.193 We claim version: SSH-2.0-WinSCP_release_5.0.6
. 2012-05-03 16:10:56.302 Using Diffie-Hellman with standard group "group14"
. 2012-05-03 16:10:56.302 Doing Diffie-Hellman key exchange with hash SHA-1
. 2012-05-03 16:10:56.958 Verifying host key rsa2 0x10001,0xe674cff13011165535818bff099ed0ae67933f... with fingerprint ssh-rsa 1024 12:06:9a:b1:4f:84:bf:6b:0a:d4:18:25:79:ec:8e:58
. 2012-05-03 16:10:56.958 Host key matches configured key
. 2012-05-03 16:10:56.958 Host key fingerprint is:
. 2012-05-03 16:10:56.958 ssh-rsa 1024 12:06:9a:b1:4f:84:bf:6b:0a:d4:18:25:79:ec:8e:58
. 2012-05-03 16:10:56.958 Initialised AES-256 CBC client->server encryption
. 2012-05-03 16:10:56.958 Initialised HMAC-SHA1 client->server MAC algorithm
. 2012-05-03 16:10:56.974 Initialised AES-256 CBC server->client encryption
. 2012-05-03 16:10:56.974 Initialised HMAC-SHA1 server->client MAC algorithm
! 2012-05-03 16:10:57.005 Using username "AutocabLive".
. 2012-05-03 16:10:57.036 Prompt (7, SSH password, , &Password: )
. 2012-05-03 16:10:57.036 Disconnected: Unable to authenticate


I have got Pegeant running with the appropriate ppk loaded with the passphrase entered
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
My guess is that the Pageant is not running as CLIENT-52\ASPNET, right? Because WinSCP does not see it. If you cannot run it as CLIENT-52\ASPNET, you need to set the key using SessionOptions.SshPrivateKey (and have the key unencrypted).
RajeshDesai
[View user's profile]

Joined: 2012-04-27
Posts: 5
Location: Manchester (UK)
I do not get this problem when I use WinSCP and Pageant is running.

WinScp, Pageant and the application are being run on the same machine so cannot see how Pageant could not be running as CLIENT-52\ASPNET

How do I check if Pageant is not running as CLIENT-52\ASPNET ?

Thanks
RajeshDesai
[View user's profile]

Joined: 2012-04-27
Posts: 5
Location: Manchester (UK)
Ahh.. just realised the problem but not sure how to solve it..

Pageant is run on the PC and the passkey entered so this is running under the users credentials. However, the .NET application trying to use Pageant is run from a Web application and this is run under ASPNET so the local accounts for WinSCP and Pageant are different.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
As I wrote, you can specify the private key directly, avoiding pageant.
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
I have added topic to the FAQ:
https://winscp.net/eng/docs/faq_hostkey
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License