0

I have created a SSH key in my local host in another user login (Instead of root user). The public (id_rsa.pub) and private (id_rsa) key files in the directory (/home/user/.ssh/). I have copied the public key file to the remote host in the directory (./ssh/authorized_keys). Passphrase is empty.

I have written a java program to connect to the remote host (linux machine) from my local host (linux machine) using maverick-legacy-client-1.7.5-all.jar classes.

Following is my code block

com.maverick.ssh.PublicKeyAuthentication pubKey = new com.maverick.ssh.PublicKeyAuthentication();
pubKey.setUsername(userName);
SshPrivateKeyFile pkf = SshPrivateKeyFileFactory.parse(privateKey);
SshKeyPair pair = pkf.toKeyPair(passphrase);

But While running the program, I am facing the following issue

com.sshtools.publickey.InvalidPassphraseException: Unsupported type: OPENSSH PRIVATE KEY at com.sshtools.publickey.OpenSSHPrivateKeyFile.toKeyPair(OpenSSHPrivateKeyFile.java:88) ~[maverick-legacy-client-1.7.5-all.jar:?]

I didn't get any clue why this issue is happening.. Please help me to resolve this issue.

Anand Murugan
  • 223
  • 1
  • 8
  • 16

1 Answers1

1

You are using a version of the Maverick SSH API that is over 3 years old which does not support the new OpenSSH Private Key format. Since OpenSSH 7.8 the default behavior is to generate keys in its new format.

Upgrade to the latest version of Maverick 1.7.34 which supports the new format.