I am using JSch library to connect to SFTP server (Tectia) Since Tectia generate private keys in SSH2 format and library doesn't accept this format, I expectedly receive
Exception in thread "main" com.jcraft.jsch.JSchException: invalid privatekey: [B@372f7a8d
When I convert this key to RSA format using PuttyGen - it works OK. My goal now is to avoid converting key manually but do it using Java. All I have is privateKey file
---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----
key here
---- END SSH2 ENCRYPTED PRIVATE KEY ----
and I want to end up with
-----BEGIN RSA PRIVATE KEY-----
*converted key here *
-----END RSA PRIVATE KEY-----
Is there any java library which can do it? Or is it a way to do it at all without putty-gen or open-ssl?
Proposed solution for question I 'duplicated' is not appropriate in my case, it is for RSA with cert files. I have ssh2 ciphered (3des-cbc) encrypted private key. I even can't covert it using ssh-keygen (only puttygen, which is not appropriate for me because it need user interaction with GUI)