getPrivateKey in KeyPair for EDDSA throw UnsupportedOperationException
Hi, I am tying to create keypair using KeyPair.genKeyPair After that I am trying to save the public private key in local machine but the method kpair.writePrivateKey failed in UnsupportedOperationException There are some comments in KeyPairEdDSA class / These methods appear to be for writing keys to a file. // And since writing VENDOR_OPENSSH_V1 isn't supported yet, have these methods fail. Is there any option to enable this for this type? Thanks, Itay
Hi @ihudedi,
Currently we don't currently support writing ssh-ed25519 / ssh-ed448 type private keys to a file, since they are only supported with the openssh-key-v1 type format, which is currently only supported for reading.
Thanks, Jeremy
Hi @norrisjeremy Could you please explain me what is openssh v1? If we can generate the key via openssh why can't we do this in the code? Thanks, Itay
Hi @ihudedi,
The openssh-key-v1 format is a private key file format that was first introduced in OpenSSH 6.5.
As I stated earlier, JSch currently does not support persisting private keys to file using this private key file format: it currently only has code to read this type of private key file format.
The only private key file format JSch currently supports for persisting private keys to file is the legacy OpenSSH PEM file format.
Since the openssh-key-v1 format is the only private key file format that can support ssh-ed25519 / ssh-ed448 type private keys, this means that JSch cannot yet persist these types of private keys to a file (there is no specification for these type of private keys using the legacy OpenSSH PEM file format).
It should also be noted that JSch does not support persisting private keys to file using other file formats that it also supports for reading, such as RFC-5208's PKCS8 or Putty's PPKv2.
We would be happy to review a PR to implement this functionality if you would like to contribute it.
Thanks, Jeremy
I am also interested in this feature and may take a bit of time to produce an implementation.