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

Advertisement

fengfengw
Joined:
Posts:
4
Location:
Australia

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

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)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Unable to Use Key File - (Unable to open file) v5.5.6

Please attach a complete session log file both from GUI and .NET assembly.

Reply with quote

fengfengw
Joined:
Posts:
4
Location:
Australia

Re: Unable to Use Key File - (Unable to open file) v5.5.6

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?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Unable to Use Key File - (Unable to open file) v5.5.6

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"

Reply with quote

Advertisement

fengfengw
Joined:
Posts:
4
Location:
Australia

Re: Unable to Use Key File - (Unable to open file) v5.5.6

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

Reply with quote

martin
Site Admin
martin avatar

Re: Unable to Use Key File - (Unable to open file) v5.5.6

And does it work now in the GUI? Can you attach again today's log from GUI and .NET?

Reply with quote

Robert_M
Guest

Unable to use this key file (unable to open file)

Hi

I have problem reading the key file from my C# program but no issues using it from GUI application.
I get the strange line in the log:
Unable to use key file "@433A5C55736572735C61646D3231383337335C446F63756D656E74735C536B616E652E49502E50617469656E742E4265665265672E417669736572696E672E4772756E646C6164646E696E675C5353485C7472737330303031302D507269762E70706B" (unable to open file)
I set the path in app.config and fetch the value and set a string variable, the output from my logging of above mentioned variable is looking ok. Why do i get this strange output from session log (woks fine from GUI and log displays keypath correct).

Regards /Robert

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum