Wednesday, July 14, 2010

java.io.IOException: Cannot recover key (Errors & Solutions #5)

Error

java.io.IOException: Cannot recover key


Solution

The KeyStore password and The Key password should be the same :)
Changing both passwords using keytool

Change KeyStore password
keytool -storepasswd -new newpassword -keystore KeyStore.jks
Change Alias key Password
keytool -keypasswd -alias MyKeyAlias -new newpassword -keystore KeyStore.jks

Note: supply old password for both keystore and alias when asked for


28 comments:

  1. Thank you very much! I had loose 2h hours trying to understand this issue.

    ReplyDelete
  2. Very helpful, solved my problem very quickly. Thanks!

    ReplyDelete
  3. You sir have just made my life SO much easier. Keys in future will be exported using the same password as my keystore. Thank you very much.

    ReplyDelete
  4. the first command pass fine, but please how can i know "MyKeyAlias" ?

    thank's

    ReplyDelete
  5. It saves my lot of time. Thank you very much

    ReplyDelete
  6. Thanks man. You saved me. Warm regards from Mexico and Colombia.

    ReplyDelete
  7. Thanks very much!

    ReplyDelete
  8. Thanks! I appreciate your posting this!

    ReplyDelete
  9. I'm creating a lab exercise for HP SiteScope to run via TLS/SSL and your article just let me fix a show-stopper. THANK YOU!!!

    ReplyDelete
  10. Hello, I seem to have the same problem. All the details are correct but Android studio cannot recover my keystore. Maybe the keystore file was corrupted. But when I open it it commandline I can see everything is okay. I am afraid I wont be able to update my app on google play.

    ReplyDelete
  11. Hello, I have created the keystore file .jks format when trying to configure the .jks file format on my tomcat server.xml file i got this error. can please help out me and below i have mention the error details


    SEVERE: Failed to load keystore type JKS with path C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\mykeystore.jks due to C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\mykeystore.jks (The system cannot find the file specified)
    java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\mykeystore.jks (The system cannot find the file specified)


    ReplyDelete
  12. Thank you , very very much appeciated, + infinity :)

    ReplyDelete
  13. Thank you so much! Worked perfectly.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hello ,i have got an error ---> keytool error: java.security.UnrecoverableKeyException: Cannot recover key

    Help me!

    ReplyDelete
  16. Genius... Working like a charm... Thanks Sir

    ReplyDelete
  17. Thank you, the post helped a lot.

    ReplyDelete
  18. It worked from me as well.But Required to bounce applications once .

    ReplyDelete
  19. Thank You!
    Thank You!!
    Thank You!!!

    ReplyDelete