-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
- Jenkins 2.277.3
- SSH Pipeline Steps 2.0.0
Using an ed25519 key, or one generated with OpenSSH 7.8+ fails:
invalid privatekey: [B@39b54f70
According to this discussion, it comes from JSch not supporting OpenSSH 7.8 and newer keys – incl. ed25519.
Minimal example:
def remote = [:] remote.name = "example-host-name" remote.host = remote.name remote.allowAnyHosts = true withCredentials([sshUserPrivateKey(credentialsId: 'example-key', keyFileVariable: 'identity', passphraseVariable: 'identityPass', usernameVariable: 'userName')]) { remote.user = userName remote.identityFile = identity remote.passphrase = identityPass sshCommand(remote: remote, command: "ls -l") }
Exception:
com.jcraft.jsch.JSchException: invalid privatekey: [B@39b54f70 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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [...]
Workaround
Use RSA key of the old format instead (generate with -m pem).
- relates to
-
JENKINS-57495 Publish with ssh plugin does not work with openssh key
- Closed
- links to