dbeaver: "invalid privatekey" connecting through SSH tunnel

Connection specification:

MySQL connection via SSH Tunnel to Ubuntu 16.04 server

Describe the problem you’re observing:

Just done a fresh install on my laptop and now cannot connect to remote server using the new SSH key I generated.

Key was generated like so: ssh-keygen -t rsa -b 4096 -C

I can connect to the server in question just fine via ssh user@host in a terminal but with the same host, user and private key reference under the ‘SSH Tunnel’ tab I get:

Can't initialize tunnel
  Cannot establish tunnel
  Cannot establish tunnel
    invalid privatekey: [B@7696c31f
    invalid privatekey: [B@7696c31f

I added the SSHJ extension after reading through similar issues but it’s not helped

Am I missing something?

System information:

  • DBeaver 6.0.3.201904211926 org.jkiss.dbeaver.core.product
  • DBeaver SSHJ .0.28.201904211926 org.jkiss.dbeaver.net.sshj.feature.feature.group JKISS
  • Host OS: Fedora 30
  • Open SSL version: OpenSSH_7.9p1, OpenSSL 1.1.1b FIPS 26 Feb 2019
  • java -version:
openjdk version "1.8.0_201"
OpenJDK Runtime Environment (build 1.8.0_201-b09)
OpenJDK 64-Bit Server VM (build 25.201-b09, mixed mode)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 38
  • Comments: 44 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Run this on your key to convert it to RSA private key. Helped me. ssh-keygen -p -m PEM -f ~/.ssh/id_rsa

private key generated by ssh-keygen starts with

-----BEGIN OPENSSH PRIVATE KEY----- and not -----BEGIN RSA PRIVATE KEY-----

and this is not supported by DBeaver.

To generate supported key add -m PEM to the end of your ssh-keygen command

e.g.

ssh-keygen -t rsa -b 2048 -m PEM

@fancywriter Could you try SSHJ instead of JSch (Help->Install New Software->https://dbeaver.io/update/sshj/latest/)?

would be great to support newer openssh formats though?

Hi! Im in same situation, solution from @nimda7 worked for me! Once you install the plugin, change it in “Implementation” dropdown option: SSHJ

Thanks!

Could we have a better error description than “invalid private key”. We had an issue where ssh connection with the key was possible, but dbeaver couldn’t because of the “invalid private key” error - and it wasn’t obvious that the format was not support by the program. 🤷‍♂️

Thanks

While using SSHJ does work when saving the password of a protected ed25519 private key, there is no password popup when trying to connect after closing the connection settings.

I get the following error message:

The checkInts differed, the key was not correctly decoded.

Can't initialize tunnel
  Cannot establish tunnel
  Cannot establish tunnel
    Exhausted available authentication methods
    Exhausted available authentication methods
      Problem getting public key from com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile@5bae85fd
      Problem getting public key from com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile@5bae85fd
        The checkInts differed, the key was not correctly decoded.
        The checkInts differed, the key was not correctly decoded.

Does anybody else have this? And is there a fix for it?

Unfortunately, SSHJ does not seem to work with DBeaver 7.0.0. This is the error:

Cannot complete the install because of a conflicting dependency.
  Software being installed: DBeaver SSHJ 1.0.50.202003211804 (org.jkiss.dbeaver.net.sshj.feature.feature.group 1.0.50.202003211804)
  Software currently installed: DBeaver 7.0.0 (org.jkiss.dbeaver.core.product 7.0.0)
  Only one of the following can be installed at once: 
    DBeaver Model Plug-in 1.0.51 (org.jkiss.dbeaver.model 1.0.51)
    DBeaver Model 1.0.118.202003211804 (org.jkiss.dbeaver.model 1.0.118.202003211804)
  Cannot satisfy dependency:
    From: DBeaver 7.0.0 (org.jkiss.dbeaver.ce.feature.feature.group 7.0.0)
    To: org.eclipse.equinox.p2.iu; org.jkiss.dbeaver.standalone.feature.feature.group [7.0.0,7.0.0]
  Cannot satisfy dependency:
    From: DBeaver Core 7.0.0 (org.jkiss.dbeaver.core.feature.feature.group 7.0.0)
    To: org.eclipse.equinox.p2.iu; org.jkiss.dbeaver.model [1.0.51,1.0.51]
  Cannot satisfy dependency:
    From: DBeaver 7.0.0 (org.jkiss.dbeaver.core.product 7.0.0)
    To: org.eclipse.equinox.p2.iu; org.jkiss.dbeaver.ce.feature.feature.group [7.0.0,7.0.0]
  Cannot satisfy dependency:
    From: DBeaver SSHJ 1.0.50.202003211804 (org.jkiss.dbeaver.net.sshj.feature.feature.group 1.0.50.202003211804)
    To: org.eclipse.equinox.p2.iu; org.jkiss.dbeaver.runtime.feature.feature.group 0.0.0
  Cannot satisfy dependency:
    From: DBeaver Runtime 7.0.1.202003211804 (org.jkiss.dbeaver.runtime.feature.feature.group 7.0.1.202003211804)
    To: org.eclipse.equinox.p2.iu; org.jkiss.dbeaver.model [1.0.118.202003211804,1.0.118.202003211804]
  Cannot satisfy dependency:
    From: DBeaver Standalone 7.0.0 (org.jkiss.dbeaver.standalone.feature.feature.group 7.0.0)
    To: org.eclipse.equinox.p2.iu; org.jkiss.dbeaver.core.feature.feature.group [7.0.0,7.0.0]

private key genereated by ssh-keygen starts with

-----BEGIN OPENSSH PRIVATE KEY----- and not -----BEGIN RSA PRIVATE KEY-----

and this is not supported by DBeaver.

To generated supported key add -m PEMto the end of your ssh-keygen command

e.g.

ssh-keygen -t rsa -b 2048 -m PEM

works great. to bad that openssh keys dont work though 😃

Could you add this to the wiki ? Thanks !

@kuriel-trivu,

The SSHJ extension is now bundled with DBeaver, so I guess that’s the reason why you’re getting this error.

I confirm issue on archlinux with an openssh key (Dbeaver 7.2.3 using Jsch). Specified private key cannot be converted: Saving key "/tmp/.dbeaver-temp6234629892423691601/mysql5-16917676b1b-4955161a3b0189da.pem" failed: passphrase is too short (minimum five characters).

Works fine with SSHj plugins (thanks to @bradmccormack for workaround 😃 )

Dbeaver: DBeaver 7.2.3 org.jkiss.dbeaver.core.product null => 7.2.3.202010232212

JSch: Eclipse Orbit JSch 0.1.55.v20190404-1902 com.jcraft.jsch Eclipse.org JSch Core 1.3.800.v20200106-0907 org.eclipse.jsch.core Eclipse.org JSch UI 1.3.800.v20200205-0619 org.eclipse.jsch.ui

Reopen issue please,

@kuriel-trivu,

The SSHJ extension is now bundled with DBeaver, so I guess that’s the reason why you’re getting this error.

That’s right, the SSHJ option is hidden in SSH under Advanced options.

Thanks for the information, @DevJackSmith.

Looks like your ssh-keygen just converted key to the same format as it was before.

To keep the issue tracked, please create a separate ticket on our board.

@ShadelessFox it is -----BEGIN OPENSSH PRIVATE KEY----- I tried running the ssh-keygen -p -m PEM -f ~/.ssh/id_rsa on it, and it didn’t do anything, here’s the output when i run that command:

Enter new passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved with the new passphrase.

More info on the key: ssh-keygen -l -f returns: 256 SHA256:...<edited>... (ED25519)

@ccayg-sainsburys I get prompted to update SSHJ every time I update DBeaver itself. You might want to manually check for updates in case this screen does not show up automatically.

private key genereated by ssh-keygen starts with

-----BEGIN OPENSSH PRIVATE KEY----- and not -----BEGIN RSA PRIVATE KEY-----

and this is not supported by DBeaver.

To generated supported key add -m PEMto the end of your ssh-keygen command

e.g.

ssh-keygen -t rsa -b 2048 -m PEM

thanks! it works for me.

Your private key file must be in OpenSSH format to work in DBeaver. Format convertion info: https://burnz.wordpress.com/2007/12/14/ssh-convert-openssh-to-ssh2-and-vise-versa/

any luck on this? Having the same issue.