-
Notifications
You must be signed in to change notification settings - Fork 34
Description
trying to use j2ssh to make a SSH2 Host based Connect
and getting error
com.sshtools.ssh.SshException: java.io.IOException at com.sshtools.ssh2.Ssh2HostbasedAuthentication.authenticate(Ssh2HostbasedAuthentication.java:112) at com.sshtools.ssh2.AuthenticationProtocol.authenticate(AuthenticationProtocol.java:206) at com.sshtools.ssh2.Ssh2Client.authenticate(Ssh2Client.java:340) at shh_test.main(shh_test.java:110)
Caused by: java.io.IOException: Failed to sign data! Could not sign data at com.sshtools.ssh.components.jce.Ssh2RsaPrivateCrtKey.sign(Ssh2RsaPrivateCrtKey.java:134) at com.sshtools.ssh2.Ssh2HostbasedAuthentication.authenticate(Ssh2HostbasedAuthentication.java:99)
i basically copied the example code from SSH2HostbasedConnect.java with small modifications such as hard-coded user name and host name
error happened at step
SshKeyPair pair;
if (pkfile.isPassphraseProtected()) {
System.out.print("Passphrase: ");
pair = pkfile.toKeyPair(reader.readLine());
} else
pair = pkfile.toKeyPair(null);
pk.setPrivateKey(pair.getPrivateKey());
pk.setPublicKey(pair.getPublicKey());
} while (ssh.authenticate(pk) != SshAuthentication.COMPLETE
&& ssh.isConnected());
I know for sure that my private key is working and I used it in tactia; and it had status - opened
what can cause it ?