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

1

4

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?

Fraenum answered 30/11, 2018 at 13:23 Comment(0)
S
3

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.

Santasantacruz answered 30/11, 2018 at 14:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.