Error reading ssh key - net.schmizz.sshj.common.Buffer$BufferException: Bad item length: -1845887552

I do get this error while installing hopsworks locally on my ubuntu.

I seems like it can not read my ssh-keys in a correct way?

INFO [2021-04-04 09:14:30,467] net.schmizz.sshj.transport.TransportImpl: Disconnected - UNKNOWN

INFO [2021-04-04 09:14:40,473] net.schmizz.sshj.transport.random.BouncyCastleRandom: Generating random seed from SecureRandom.

INFO [2021-04-04 09:14:40,474] se.kth.karamel.backend.machines.SshMachine: connecting …

INFO [2021-04-04 09:14:40,475] net.schmizz.sshj.transport.TransportImpl: Client identity string: SSH-2.0-SSHJ_0.20.0

INFO [2021-04-04 09:14:40,484] net.schmizz.sshj.transport.TransportImpl: Server identity string: SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1

INFO [2021-04-04 09:14:40,488] se.kth.karamel.backend.machines.SshMachine: Yey!! connected ^-^

INFO [2021-04-04 09:14:40,489] com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile: Read key type: ssh-rsa

ERROR [2021-04-04 09:14:40,489] se.kth.karamel.backend.machines.MachinesMonitor:

! net.schmizz.sshj.common.Buffer$BufferException: Bad item length: -1845887552

! at net.schmizz.sshj.common.Buffer.readString( ~[sshj-0.20.0.jar:na]

! at com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile.readUnencrypted( ~[sshj-0.20.0.jar:na]

! at com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile.readDecodedKeyPair( ~[sshj-0.20.0.jar:na]

! at com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile.readKeyPair( ~[sshj-0.20.0.jar:na]

! at net.schmizz.sshj.userauth.keyprovider.BaseFileKeyProvider.getPublic( ~[sshj-0.20.0.jar:na]

! at net.schmizz.sshj.userauth.method.KeyedAuthMethod.putPubKey( ~[sshj-0.20.0.jar:na]

I did find a workaround - until sshj supports new file formats. For anyone else that likely will hit this problem. This is due to sshj in the version hopsworks is using will not support the latest file formats. So when generating the keys - use:

>ssh-keygen -m PEM

to generate a key with the format supported (and press enter to NOT set a password on the key).