Start a new topic
Solved

Loading SSH key Invalid Format

 in TSX 3.3.1 I load a RSA key into a credential (with or without passphrase. and i have tried one created on my mac, and on a linux machine). When i try and use that credential for a terminal session, I get "Load key "/Users/user/Library/Caches/com.lemonmojo.RoyalTSX.App/iTerm2Connection/TemporaryPrivateKey_3": invalid format"


Is that the correct way to handle that? Do i have some other thing going on?


No i am getting the same Invalid Format message 

No worries, Ryan! Glad I could help!


cheers,

felix

Thanks! I don't know how i managed to overlook that over and over. Sorry!


--Ryan

Thx again for the screenshots.


Like previously mentioned, the problem here is that you specified two different private keys. One at the connection level and one at the credential level.


There's actually a note in the connection private key file configuration that reads: "If you have configured both, a private key file in your credential and a private key file at connection level, Royal TSX will use the private key file configuration from the connection".


That's exactly what's happening here. Since you have another private key file at connection level, that one overrules the one specified at credential level. And as can be seen in the last screenshot, that key file is of unsupported format.


If you want to use the key file that you specified at credential level (where you referenced a path instead of embedding the key file), please remove the embedded key file from the connection. (Click "Actions - Remove").


Hope that helps!


cheers,

felix

Screen Shot on 2018-10-10 at 07-59-54.png


Screen Shot on 2018-10-10 at 08-00-02.png

did the other screenshots come through? I know i attached them. I can attach the connections one momentarily. This is the error with a path to the key:


 

 

Royal TSX Version: 4.0.0.21

System Information:
       OS Version: Version 10.13.5 (Build 17F77)
        Processor: Intel 80486
     Screen Count: 2
 Current Language: en-US
   Current Locale: en_US

Log Information:
         Severity: Warning
    Date and Time: 10/10/2018 7:56:07 AM
           Action: Plugin
        Object ID: 
      Object Name: 
      Object Type: 
       Local User: 
       Local Host: 
      Remote User: 
              URI: 
      Plugin Name: Terminal (based on iTerm2)
   Plugin Version: 
        Plugin ID: 7c84a650-9896-11e1-a8b0-0800200c9a66
          Message: An error occurred while converting an embedded private key to OpenSSH format.

Details:
System.Security.Cryptography.CryptographicException: Invalid key format.
  at Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo.ppld (System.Byte[] dry, System.Int32 drz, Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo+hgdk& dsa, Rebex.Security.Certificates.KeyAlgorithm& dsb, System.String& dsc) [0x0008e] in <2e67c63ff99847019bc457b7006d3e53>:0 
  at Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo.Load (System.IO.Stream input, System.String password) [0x00066] in <2e67c63ff99847019bc457b7006d3e53>:0 
  at Rebex.Net.SshPrivateKey.jomv (System.IO.Stream aco, System.String acp) [0x00202] in <1cea187bd82641e2997a1b5e6f802c02>:0 
  at Rebex.Net.SshPrivateKey..ctor (System.Byte[] data, System.String password) [0x00031] in <1cea187bd82641e2997a1b5e6f802c02>:0 
  at RoyalCommon.Utils.RoyalPrivateKeyFileConverter.Convert (System.Byte[] keyContents, RoyalCommon.Utils.RoyalPrivateKeyFormat destinationKeyFormat, System.String keyPassphrase, System.String destinationKeyPassphrase) [0x00032] in <7324eed88e5a412ca68f9df1cc22df03>:0 
  at RoyalTSX.Plugins.iTerm3.LMiTerm3Options.GetOptions (RoyalDocumentLibrary.RoyalSSHConnection connection, System.String bundlePath, Monobjc.Foundation.NSRect initialFrame, RoyalDocumentLibrary.CredentialInfo effectiveCredentials, System.String& temporaryPrivateKeyFilePath, System.Boolean& containsPrivilegedPortForwards) [0x0027d] in <63c8ccba7d22420ca378357619db5239>:0 

 

 

Hi Ryan,


thx for the screenshots. I don't think I'll be needing the key file as that's likely not the actual problem.

Please send me screenshots of your connection's credential configuration as well. I'm pretty certain that you have an additional key file referenced there which is overruling the one from your credential.


cheers,

felix

 Here's the tabs. Are you wanting the key as well? I have been using one that is not used anywhere, so i can provide that as well.


Screen Shot on 2018-10-09 at 07-37-39.png


Screen Shot on 2018-10-09 at 07-38-39.png

If you get this same log entry, then the key is still embedded or you're looking at the wrong credential/connection configuration.

In the case of a file reference (instead of embedded key files) no conversion is done from our side and the key is just passed to the ssh client.


Please send us screenshots of your SSH connection's credential configuration (both tabs) as well as the credential object itself (if any).


cheers,

felix

Hi Ryan,


okay, so does it work if you specify the path to the key file instead of embedding it into the document?


thx,

felix

seems to be the same ...


 

Royal TSX Version: 4.0.0.20

System Information:
       OS Version: Version 10.13.5 (Build 17F77)
        Processor: Intel 80486
     Screen Count: 2
 Current Language: en-US
   Current Locale: en_US

Log Information:
         Severity: Warning
    Date and Time: 10/8/2018 7:15:58 AM
           Action: Plugin
        Object ID: 
      Object Name: 
      Object Type: 
       Local User: 
       Local Host: 
      Remote User: 
              URI: 
      Plugin Name: Terminal (based on iTerm2)
   Plugin Version: 
        Plugin ID: 7c84a650-9896-11e1-a8b0-0800200c9a66
          Message: An error occurred while converting an embedded private key to OpenSSH format.

Details:
System.Security.Cryptography.CryptographicException: Invalid key format.
  at Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo.ppld (System.Byte[] dry, System.Int32 drz, Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo+hgdk& dsa, Rebex.Security.Certificates.KeyAlgorithm& dsb, System.String& dsc) [0x0008e] in <2e67c63ff99847019bc457b7006d3e53>:0 
  at Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo.Load (System.IO.Stream input, System.String password) [0x00066] in <2e67c63ff99847019bc457b7006d3e53>:0 
  at Rebex.Net.SshPrivateKey.jomv (System.IO.Stream aco, System.String acp) [0x00202] in <1cea187bd82641e2997a1b5e6f802c02>:0 
  at Rebex.Net.SshPrivateKey..ctor (System.Byte[] data, System.String password) [0x00031] in <1cea187bd82641e2997a1b5e6f802c02>:0 
  at RoyalCommon.Utils.RoyalPrivateKeyFileConverter.Convert (System.Byte[] keyContents, RoyalCommon.Utils.RoyalPrivateKeyFormat destinationKeyFormat, System.String keyPassphrase, System.String destinationKeyPassphrase) [0x00032] in <07e65101a1034bc0b1e07439c4dbb64d>:0 
  at RoyalTSX.Plugins.iTerm3.LMiTerm3Options.GetOptions (RoyalDocumentLibrary.RoyalSSHConnection connection, System.String bundlePath, Monobjc.Foundation.NSRect initialFrame, RoyalDocumentLibrary.CredentialInfo effectiveCredentials, System.String& temporaryPrivateKeyFilePath, System.Boolean& containsPrivilegedPortForwards) [0x0027d] in <4f1477d9241b45879cd3a103a063a75b>:0 

 

Hi Ryan,


would you please be so kind and give the current V4 beta a try as new key formats are supported there?

You can get the beta here: https://www.royalapplications.com/ts/mac/features-beta


thx,

felix

This is the log entry i get:


 

 

Royal TSX Version: 3.3.1.1000

System Information:
    Computer Name: machinename
        User Name: corvock
       OS Version: Version 10.13.5 (Build 17F77)
        Processor: Intel 80486
              x64: True
     Screen Count: 2
 Current Language: en-US
   Current Locale: en_US

Log Information:
         Severity: Warning
    Date and Time: 10/5/2018 9:20:27 AM
           Action: Plugin
        Object ID: 
      Object Name: 
      Object Type: 
       Local User: 
       Local Host: 
      Remote User: 
              URI: 
      Plugin Name: Terminal (based on iTerm2)
   Plugin Version: 
        Plugin ID: 7c84a650-9896-11e1-a8b0-0800200c9a66
          Message: An error occurred while converting an embedded private key to OpenSSH format.

Details:
System.Security.Cryptography.CryptographicException: Invalid key format.
  at Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo.pvls (System.Byte[] dqw, System.Int32 dqx, Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo+slum& dqy, Rebex.Security.Certificates.KeyAlgorithm& dqz, System.String& dra) [0x0008e] in <d258b17adf014652be7dfe815b0dbb46>:0 
  at Rebex.Security.Cryptography.Pkcs.PrivateKeyInfo.Load (System.IO.Stream input, System.String password) [0x00066] in <d258b17adf014652be7dfe815b0dbb46>:0 
  at Rebex.Net.SshPrivateKey.crpy (System.IO.Stream abq, System.String abr) [0x00202] in <3e53a8bb182c4d909c546f812a2cb1f3>:0 
  at Rebex.Net.SshPrivateKey..ctor (System.Byte[] data, System.String password) [0x00031] in <3e53a8bb182c4d909c546f812a2cb1f3>:0 
  at RoyalCommon.Utils.RoyalPrivateKeyFileConverter.Convert (System.Byte[] keyContents, RoyalCommon.Utils.RoyalPrivateKeyFormat destinationKeyFormat, System.String keyPassphrase, System.String destinationKeyPassphrase) [0x00032] in <0fbcad4516d848a48f2f575e1cfc35e0>:0 
  at RoyalTSX.Plugins.iTerm3.LMiTerm3Options.GetOptions (RoyalDocumentLibrary.RoyalSSHConnection connection, System.String bundlePath, Monobjc.Foundation.NSRect initialFrame, System.String& temporaryPrivateKeyFilePath, System.Boolean& containsPrivilegedPortForwards) [0x00289] in <6f82d1f04d3f4e77814d0c2036cd509b>:0 

 

 

Initially i was trying to use my id_rsa that i generated on my mac, and actively use. I have regenerated them on the mac, and used a different machine to generate them. I am able to successfully log in with the keys to other machines.
Login or Signup to post a comment