Archived Forum Post

Index of archived forum posts

Question:

SshKey.FromPuttyPrivateKey() fails if comment contains umlauts

Apr 05 '16 at 08:14

Hello,

I have some issues with loading Putty private key files if the comment section contains umlauts (äöü). No matter if the key is encrypted or not, i get the same results:

ChilkatLog:
  FromPuttyPrivateKey:
    DllDate: Mar 11 2016
    ChilkatVersion: 9.5.0.56
    UnlockPrefix: NONE
    Username: xxx:xxx
    Architecture: Little Endian; 32-bit
    Language: .NET 4.5
    VerboseLogging: 1
    fromPuttyPrivateKey:
      ppk_content: PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: With umlauts: äöü
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEAovJXTENhV9djgDN6qoEiRCUCSXKqtWIfCwt9
xNM1m08xlR3gUHN6VHoIeM6uQzMnqSdxKiI5sONdoJdKw/eDj5XiCKlEGCogR6Um
GA2KAMxibHBpJPoxVfm70N7D6Lh8fg9KnqUiXA30FEhjUYAFupBQU9KaMra4cvdp
VsX7FPUKDch381V2FkTwfW3vmtK0yjEvhZoTGdQDlILWhhNeRKwXtSqHBbCGez5x
7qF+XBZwKnA9GqYZqYLUPZhuNBgKV4axMPtIA7XfzXLWSvdPFop1mPBYRCUhMj0Y
Enpdlm0cHr6CZmW0Ulk25SBAJqIOQBB5ErJPjUMGMFZnewl0+w==
Private-Lines: 14
AAABAA02Pm33oBvhCBFQSDdWlBNc8lj7daABCW+ZJd+GvyhEsP5AsVKhlEwJ5QLg
U1GOhqzZrzrEgTfbFW3iwN907v3N4eUGzit5CYlEveZGSXWvtPQJHUgv9imQygoE
OWXlceC1IbnWCbRv1YUaoETg3d6xwVLnj/ZGKqGJrphVPd8aqFdM27s4Y/vIgI3y
PEmPi+ORuDIrtltmSD/RoTl2VG2ATcJiI3KCUlm6EBmZS3CD/Gnt4AkyPskD3Q7E
dQ8ZIN6L8UIofe0gXEqyXa07mpPUlM8vmAzyi854V9BeAEd2a83RIwl3cgR/N1Dw
YPUcbJRpMKyTIfLO2lGBpb2e2cUAAACBAM7ZDxyaly07KUWxc0rKb5Hu6d68g40Z
wtn0Q7TDXP36ohE0vhaeI96A4BPs+wggdNUGkoThTC+b8Zh5JtAhoZ9UTk9uwnAm
yLQVbrFAwwg867ZY1DopFeH1DUsBu29oiYorCV8e3A5/lUs41/YQLIPL54XGsnUv
mdePxX/LSyI9AAAAgQDJqrAaqQbNDx15SqRn784QOezGXlC87iOujSWyqK2kWNuc
zbIQjfAFp7zsxe5+epsctBKXx+45CQxADk/6WECASnps55rGxbNkHsGhsap/D7Y+
miZ1e1/YSrjnXDeVZy8LCUxzKB3SRfhBcLOeR2xPTcJFpj6NAFyqCKdA4mx/lwAA
AIEAlh+PLSdQ9CxPhkibVHccMhhFSxA3s8is6PCnayOgr5vJpApi1iwROAlk6BMg
V99r70vmvhxiciE1pQJ7rjqGJW/egV3P5K9yvRhhmAAZoe/rgMTVqPoBfXgArDqL
OP5vpyKf/9RABDJXrphaUtC7Wf9ABMyJhdS6IRBSX7aQJJQ=
Private-MAC: 8110fd4009f02fd210e14b95b59e7082e1aefb91

Calculated MAC does not match Private-MAC
      Need to specify a password for this encrypted private key file.
    --fromPuttyPrivateKey
    Failed.
  --FromPuttyPrivateKey
--ChilkatLog

If there are no umlauts, it just works fine:

ChilkatLog:
  FromPuttyPrivateKey:
    DllDate: Mar 11 2016
    ChilkatVersion: 9.5.0.56
    UnlockPrefix: NONE
    Username: xxx:xxx
    Architecture: Little Endian; 32-bit
    Language: .NET 4.5
    VerboseLogging: 1
    fromPuttyPrivateKey:
      ppk_content: PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: Without umlauts
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEAovJXTENhV9djgDN6qoEiRCUCSXKqtWIfCwt9
xNM1m08xlR3gUHN6VHoIeM6uQzMnqSdxKiI5sONdoJdKw/eDj5XiCKlEGCogR6Um
GA2KAMxibHBpJPoxVfm70N7D6Lh8fg9KnqUiXA30FEhjUYAFupBQU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MyJhdS6IRBSX7aQJJQ=
Private-MAC: 76c426d20c3750e2006f67a4d6442f134d9b6206

--fromPuttyPrivateKey
    Success.
  --FromPuttyPrivateKey
--ChilkatLog

My sample code:

Dim key = New Chilkat.SshKey()
key.VerboseLogging = True
If Not key.FromPuttyPrivateKey(key.LoadText(FileName)) Then
  Debug.WriteLine(key.LastErrorText)
End If

Same result with (to make sure a different encoding doesn't do the trick):

Dim key = New Chilkat.SshKey()
key.VerboseLogging = True
If Not key.FromPuttyPrivateKey(New StreamReader(FileName, System.Text.Encoding.Default).ReadToEnd) Then
  Debug.WriteLine(key.LastErrorText)
End If

Did someone encounter the same problems? Thanks in advance!

Kind regards


Accepted Answer

Thanks! This new build should fix it:

32-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet45-9.5.0-win32.zip

64-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet45-9.5.0-x64.zip


Answer

Hi,

the new build works without any flaw. Thank you very much!

Kind regards Manuel Schott