Archived Forum Post

Index of archived forum posts

Question:

fromPuttyPrivateKey throws invalid key error

Sep 13 '16 at 12:00

Hi

I am trying to call the below

i_bSSHSuccess = key.FromPuttyPrivateKey(keystr)

it fails with message fromPuttyPrivateKey: Invalid Putty Private Key --fromPuttyPrivateKey Failed.

Chilkat version:9.5.0.54.

Thanks


Answer

You version is a bit behind, does the problem persist with 9.5.0.58?

If so, please post the full contents of the LastErrorText property immediately after the failing call in <pre></pre> tags.


Answer

Is the full error similar to the following?

ChilkatLog:
  FromPuttyPrivateKey:
    DllDate: Jun 13 2016
    ChilkatVersion: 9.5.0.58
    UnlockPrefix: <redacted>
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    fromPuttyPrivateKey:
      Expecting PuTTY-User-Key-File-2
    --fromPuttyPrivateKey
    Failed.
  --FromPuttyPrivateKey
--ChilkatLog

We are also now having this error with the latest 9.5.0.58. It did not occur with the previous version we were using, which was 9.5.0.48.


Answer

Thanks. Please post a sample of a private key that is getting passed that reproduces the error.


Answer

Here is a direct copy of the contents of the .ppk file:

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20140227
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEAiI+pMoH+7RvFZ/hRa31u80CXIRk29+X+n74f
r4KukpqP3BfBbKd5LzGk2FTAPS86A3WxsH290jXwWEqwSzfyhmKJXpMVm1qwT2bt
6QbazOIcfvlFvjjxMrUuuNTcWlUMKvUG7s9Kp8thGJg+pdB+WWY4ViDb6y987ZpY
HIWvcCBqiTo5mq6OG/TVNAXXuOda/lg4CJ3YLIwftEWojFNzH/QtqzI6A0stfOFX
XkmdBjpvRSwRU/QAwfdH9jEAC/8pCPNt15S9Z7zSMYTpbCxVJV8ybthiuUQaovgk
kTpJs7OxYAnePDNvz584pGheHnmRN15BNj41yw27GEIgdNAAjQ==
Private-Lines: 14
AAABADOr+tTXPd0tGkMEAyHAwjKHJG1jfJUml7IQll4VxYOUbcjmZN0BGRjGrROV
sIXahKdc9yAvk+6soCFoXmGmd3EeXX27HO6ssWom8jx/IltceXwm98tvfdvV2lPG
Kdz9lea9k+uoYW/sFua2JYrZRJCHivAoG9xy1VL8IVbmebu4r4o+n6AN0ZwvsCbG
vkO4Ik1e20ZIM+taci/JN/+pUEqaQVcUmQO4riFgB1/m5u6f3/SqQWEuEeSY/ASy
tnE8np+qnptrwE2Gt+RSz9kmvw7PMM5flCtDLMAOUqmqVJ4tmvRtJ0ZZUBp4kHgi
DYfZyjnctR6JXhSVxz2F9cSe1G0AAACBAL8PjMX+k71ItEo487RKRC2zdjc4lizr
Z/3YyYyk3EJ0YbYec11IwnQTq7teHIbDHhCYXtEWjlpy0OCLA2r4pAJyXExJqMvY
0Xt1/QDE2+kRKcKlqu5PFn98oKYYzlEJVmLnBnZThcsDRrWzttwnOWsmsLsXpRbi
rgJac4xHtX5lAAAAgQC2+gfyUIiUkecU3bu+4DyJfmdPlkjY5Wv0FAzjVhMlnUPv
b79IVUU2WiWIgriPXr78gZ2Tc2vkvCRfp+eOVc06OcHsF7zjCyvecmPn6WoFbRHc
gzDaiiCk4Z9a3JeGvy3rznU29+YshmMFIOnL66Uh5XiC4C4T+x0FmzWvN7/jCQAA
AIA5symVGM1RpWPGt/d3iMcjBFveVafdYravNHsXGE6o6Va2UuSVife23B7wz0II
PesoQ3B492Kq9yFewfJ4DittlaBWyWGCfu5Rt21EmhxxBLP/BFW1rwhwQJkduSe1
HZsJV7Hxy4wbfhOnaOGuKi91mdX4+E1t9yyRRk94Ab6lPw==
Private-MAC: 08f007a5460dbdceead8f20fe5b268a5457b2ef6


Answer

I gave it a test, and everything worked for me. Double check the actual string your passing to FromPuttyPrivateKey. I suspect you're passing invalid data.. (in other words, the string you're actually passing is not what you think you're passing)..


Answer

Did the FromPuttyPrivateKey method get changed at some point?

Because I see that the current documentation does explicitly state that the argument to FromPuttyPrivateKey should be the file contents, not the file name. And our code does appear to be passing in a file name.

I would agree this is incorrect according to current documentation (I haven't tried changing it yet), but am just very confused how our application IS working with the 9.5.0.48 version of the DLL!


Answer

I tested your PPK and found everything to be working.

Please note that the Forum is not a good way to get paid-for support. The forum is intended for user-to-user discussion.

If you are a licensed Chilkat customer with support that has not yet expired, please send email to support@chilkatsoft.com.

If your support has expired and not lapsed for more then 3 months, then a renewal is possible at https://www.chilkatsoft.com/renewals.asp.

If support has expired for a longer period of time, then a regular purchase is required.

At this time, Chilkat is busy helping licensed customers with non-expired support. As time permits, Chilkat will try to answer Forum questions.