Create a SSH private key with ssh-keygen that is accepted by JSch [duplicate]

孤人 提交于 2021-02-18 12:47:08

问题


Not directly a programming question, but somehow related. JSch (Java SSH library) does not seem to allow private keys that macOS 10.14 creates using

$ ssh-keygen -t rsa -b 4096

What command I should use to create a private key file with such a format:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,....

which is accepted by JSch?


回答1:


You seem to need a key in classic OpenSSH format. Recent versions of OpenSSH generate keys in a new format.

To force the classic format, use -m PEM switch.

See also "Invalid privatekey" when using JSch.



来源:https://stackoverflow.com/questions/53558436/create-a-ssh-private-key-with-ssh-keygen-that-is-accepted-by-jsch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!