sonyxperiadev / gerrit-events

MIT License
47 stars 62 forks source link

No support for ED25519 keys (replace JSCH library) #113

Open sratz opened 3 years ago

sratz commented 3 years ago

gerrit-events does not support ED25519 keys:

    com.sonymobile.tools.gerrit.gerritevents.ssh.SshException: com.jcraft.jsch.JSchException: invalid privatekey: [B@5e887fa3
        at com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionImpl.connect(SshConnectionImpl.java:200)
        at com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionFactory.getConnection(SshConnectionFactory.java:140)
        at com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionFactory.getConnection(SshConnectionFactory.java:117)
        at com.sonymobile.tools.gerrit.gerritevents.GerritConnection.connect(GerritConnection.java:498)
        at com.sonymobile.tools.gerrit.gerritevents.GerritConnection.run(GerritConnection.java:404)
    Caused by: com.jcraft.jsch.JSchException: invalid privatekey: [B@5e887fa3
        at com.jcraft.jsch.KeyPair.load(KeyPair.java:664)
        at com.jcraft.jsch.KeyPair.load(KeyPair.java:561)
        at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
        at com.jcraft.jsch.JSch.addIdentity(JSch.java:406)
        at com.jcraft.jsch.JSch.addIdentity(JSch.java:387)
        at com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionImpl.connect(SshConnectionImpl.java:168)
        ... 4 more

This is because the JSCH library does not.

Since JSCH seems not to be maintained anymore, it should be considered to switch to an alternative SSH library, e.g. Apache MINA.

Apteryks commented 2 years ago

Cross-linking to the Gerrit Trigger issue: https://issues.jenkins.io/browse/JENKINS-67563.

rsandell commented 2 years ago

Sure, Apache MINA is already used in test scope. Though it might cause some issues in runtime due to a core dependency on the same library.

patbaumgartner commented 2 years ago

I came across this today https://www.matez.de/index.php/2020/06/22/the-future-of-jsch-without-ssh-rsa/ and realized that ED25519 is implemented in https://github.com/mwiede/jsch - which should be a drop-in replacement ...