Topic "Unable to Use Key File - (Unable to open file) v5.5.6"

Author Message
fengfengw
[View user's profile]

Joined: 2014-11-04
Posts: 4
Location: Australia
I was unable to use the private key in vb.net. But if I run Winscp in windows and use the same file, I can establish connection with the server.

Could anyone tell me how to resolve this issue?



Session log:
. 2014-11-07 16:31:59.326 Doing Diffie-Hellman key exchange with hash SHA-1
. 2014-11-07 16:31:59.555 Verifying host key rsa2 0x10001,0xcec35289cb7273bd dee460487d3425a8 c84864a3596c3b19 e052e1dac8c5df97 a95a38ddcada3492 9d8d898783c4d277 0b1d83c7d52d4678 14326509edeb1c38 59001f0d1fc05608 8cb279f3680407f5 fe7d26fa0041ae1c b778adcc98035fe0 be017ab51905e17d 3d2a22fc0533d371 77d05a924be25818 6a70eb235d384ba1 9c33afe467b5bceb 102f159a31359576 13b5fb3e6b72103a 2ffa7a2abffb2975 a0b10bc77b11e058 e0a92e22c0fcd694 df30565f217115c8 fc971c4743f2ed7e b4b46f320293c049 16dd6421d3148d4e 9b512991e3a589a6 013d6d6f61ee7630 e9fce0b201434dc4 ad5182fbbaa72f4d 006485577e0b7ab7 2ac1e86d4a1aea4d with fingerprint ssh-rsa 2048 0c:d4:ae:73:e7:b6:bb:20:1d:80:09:bc:10:09:aa:ab
. 2014-11-07 16:32:00.213 Host key matches configured key
. 2014-11-07 16:32:00.213 Host key fingerprint is:
. 2014-11-07 16:32:00.213 ssh-rsa 2048 0c:d4:ae:73:e7:b6:bb:20:1d:80:09:bc:10:09:aa:ab
. 2014-11-07 16:32:00.213 Initialised AES-256 CBC client->server encryption
. 2014-11-07 16:32:00.213 Initialised HMAC-SHA1 client->server MAC algorithm
. 2014-11-07 16:32:00.213 Initialised AES-256 CBC server->client encryption
. 2014-11-07 16:32:00.214 Initialised HMAC-SHA1 server->client MAC algorithm
. 2014-11-07 16:32:00.429 Reading private key file "C:\Users\xxxxxx\Desktop\000100038240.pkk"
. 2014-11-07 16:32:00.429 Unable to use this key file (unable to open file)
! 2014-11-07 16:32:00.429 Unable to use key file "C:\Users\xxxxxxx\Desktop\000100038240.pkk" (unable to open file)
! 2014-11-07 16:32:00.470 Using username "000100038240".
. 2014-11-07 16:32:00.484 Disconnected: No supported authentication methods available (server sent: publickey)
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24538
Location: Prague, Czechia
Please attach a complete session log file both from GUI and .NET assembly.
fengfengw
[View user's profile]

Joined: 2014-11-04
Posts: 4
Location: Australia
prikryl wrote:
Please attach a complete session log file both from GUI and .NET assembly.


Please find attached the logs
vb.net.log (5.75 KB) [Download]

Description: .Net

GUI.log (6.86 KB) [Download]

Description: GUI log

fengfengw
[View user's profile]

Joined: 2014-11-04
Posts: 4
Location: Australia
prikryl wrote:
Please attach a complete session log file both from GUI and .NET assembly.


To share more insights, I have tried command line in vb.net and I got the same error "Unable to read the key file. However, when I have tried directly command line in cmd, it works. Therefore, I guess the problem comes from .net assembly.

My current workaround is :
1) I have created a .bat and a .txt file to grab the files from SFTP server,
2) then use vb.net to execute the .bat file and wait till it finish and
3) then continue other functions in my vb.net project.

But I still hope the vb.net can work directly so that I can catch the results/errors directly. Could you please help me?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24538
Location: Prague, Czechia
It's trivial typo:

.NET assembly:
. 2014-11-08 07:30:12.261 Reading private key file "C:\000100038240.pkk"

GUI:
. 2014-11-08 07:26:14.981 Reading private key file "C:\000100038240.ppk"
_________________
Martin Prikryl
fengfengw
[View user's profile]

Joined: 2014-11-04
Posts: 4
Location: Australia
Thank you very much. That was a stupid typo.

But I still can't get it work. I am now getting error : Server refused to start a shell/command. What should I do now?

. 2014-11-12 01:30:31.909 Offered public key
. 2014-11-12 01:30:31.948 Offer of public key accepted
! 2014-11-12 01:30:31.948 Authenticating with public key "rsa-key-20141104"
. 2014-11-12 01:30:32.344 Sent public key signature
. 2014-11-12 01:30:32.379 Access granted
. 2014-11-12 01:30:32.379 Opening session as main channel
. 2014-11-12 01:30:32.390 Opened main channel
. 2014-11-12 01:30:32.603 Server refused to start a shell/command
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24538
Location: Prague, Czechia
And does it work now in the GUI? Can you attach again today's log from GUI and .NET?
_________________
Martin Prikryl
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