Error : "Cannot restore key pair"
Posted by Mohammad Jawwad on 20 April 2010 03:30 PM
This error is generated by Java when it cannot restore the keypair specified when using the following code :

SshParameters params = new SshParameters("[host]", "[user]", "[pass]");
params.setPrivateKey(new File("[path_to_privatekey_file]"), "[key_passphrase]");

To correct this make sure the following steps are carried out :

1) The passphrase for the private key is actually correct. Make sure there are no leading or trailing spaces in the passphrase.
2) If your private key is greater than 512 bits you may need to install JCE Unrestricted Policy Files for your JVM version. These files are needed so Java can restore keys which are greater than 512 bits in length. To find out which Java version is installed on your machine issue the following command on a shell : java -version

(50 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Help Desk Software by Kayako fusion