keytool error: java.security.UnrecoverableKeyException: Cannot recover key android
Asked Answered
C

2

6

I can't signed my apk with the existing keystore. Its giving me this error when signing: com.android.ide.common.signing.KeytoolException: Failed to read key Cannot recover key

So, by following this link, I have tried to change the password but its giving me keytool error: java.security.UnrecoverableKeyException: Cannot recover key error when executing this command:

keytool -keypasswd -alias %MyKeyAlias% -new %newpassword% -keystore KeyStore.jks

I have already a version available in playstore using this keystore.

Chock answered 20/11, 2016 at 16:39 Comment(9)
If you forgot your password try this https://mcmap.net/q/103411/-how-to-handle-a-lost-keystore-password-in-android this worked for me a while back....Labiate
I have my password. Problem is that suddenly this keystore is not working.Chock
Try with that .jar file and with your password given as suggestions.... I used that to recover my password once when i had similar issueLabiate
I already said, I have my password.Chock
Simply add you current key-store password without %, in order to change password and make sure that KeyStore password and The Keypassword should be same.Velites
Remove % from command and try again, if your alias/password is correct it shouldbe workingImes
@PravinD Tried but didn't workChock
I didn't use % anywhereChock
have you solved thisGruver
E
3

I finally solved it by reading the document: https://www.rickyadams.com/wp/index.php/2017/11/15/keytool-java-keystore-ssl/

As I use a different storepass and keypass.

Verify the private key password by attempting to change it

> keytool -keypasswd -keystore KEYSTORE -alias ALIAS -storepass PASSWORD

This is the output you’ll see if a key password isn’t set, or if the key password is the same as the store password:

New key password for <ALIAS>:

This is the output you’ll see if a key password is set and you enter it incorrectly:

Enter key password for ALIAS:
keytool error: java.security.UnrecoverableKeyException: Cannot recover key

This is the output you’ll see if a key password is set and you enter it correctly:

Enter key password for <ALIAS>:
New key password for <ALIAS>:
Eruptive answered 8/4, 2019 at 3:35 Comment(1)
Working link to said blog post is now rickyadams.com/wp/keytool-java-keystore-sslCortezcortical
R
0

Looks like missing private key.

Reisman answered 29/11, 2016 at 13:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.