Android keystore stopped working

混江龙づ霸主 提交于 2019-11-27 11:46:06
Erhannis

I may have had the same problem. I never did figure out why it was failing (though I wonder if it was because the keystore password was shorter than 6 digits), but I was able to copy my key into a new keystore, which I then renamed to replace the old one, and it mysteriously worked after that (using the new passwords). Needed the key password, by the way. Working off https://security.stackexchange.com/a/3795, I did the following:

  1. keytool -importkeystore -srckeystore old.keystore -destkeystore new.keystore -v
  2. Entered the new keystore password twice
  3. Hit Enter when it asked me for the source keystore password (left it blank)
  4. Entered the key password

After double-checking that the new one worked, I just copied it over the old one. Hope it works for you; good luck.

Try to remove .metadata folder in your workspace and clear all temp folders. If your keystore file isn't damaged and you have tried to reinstall Eclipse, ADT, Android SDK and Java SDK correctly, I don't see other possibly causes for this strange issue excluding .metadata cache files and\or some temp corruption.

Another suggestion

Try to use Portecle an utility for managing and examining keystores, keys, certificates, certificate requests, certificate revocation lists etc.

Gerhat

I had the same problem and I tried everything that is suggested in this thread but nothing was able to save my alias password. The point is that I was absolutely sure about the password, since I had updated the app four times already. I was getting the "Keystore was tampered with, or password was incorrect" message.

The solution

It appears that at the creation of the keystore using eclipse, a space character was added in front of the password!

This nasty bug was apparently fixed at a later version rendering me unable to sign my app with the password I thought was the correct one.

Based on this SO link: Ant fails to build signed apk after updating to android v20 I would suggest that you try adding a space character before of after your password.

I will suggest couple of more heat and trials.

Have patience to apply these,

Steps:

  1. Untick the build automatically (Project-> Build Automatically) in eclipse and clean your project.
  2. Build it again.(Right Click on the project+Build Project)
  3. Export Project.
  4. Select Android Export.(auto aligned for you)
  5. Choose your key. provide the password. alias should come in the list.(Be sure about the caps lock). Sometimes we give correct password but due to caps it always fails ;)
  6. Let me know if it works for you.

Hopes this will help you.

Are you storing values such as key.store.password or key.alias.password in your local.properties file? Are either of those incorrect?

I'm curious if there's some bug that occurs for keys created with JDK6 and verified in JDK7 - It would explain why the new keys you created for testing work, but the old one doesn't. Try downgrading to JDK6 and see if that fixes it- Others have had jarsigner trouble in JDK7 that went away when they downgraded to 6. If that works, file a bug report and demand a patch so you can safely upgrade to Java 7 :)

I battled this issue as well recently, and tried all suggestions listed here and elsewhere. Finally identified a silly mistake that was causing this error at my end - I wanted to share this here in case it helps any of you.

This is more likely to be the case if you, like me, have multiple Java versions on your machine and had upgraded JRE / JDK between the time you originally created the keystore and now when you're trying to sign the APK.

For some reason, our compile instructions were referencing the full Java path like this:

C:\Progra~1\Java\jdk1.6.0_45\bin\jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore cre80ve.keystore unsigned.apk cre80ve

One of the suggestions above got me thinking that it might not be a password issue at all, and it could be version incompatibilities causing the issue. So I ran the below command :

keytool -list -keystore cre80ve.keystore

Using the password that I knew was correct, and lo and behold, it confirmed that it was the right password.

I then dropped the explicit reference in the path to the (older) Java version. This made it automatically pick up the latest version of Java (jdk1.8.0_31 in my case):

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore cre80ve.keystore unsigned.apk cre80ve

And everything started working fine!

Bottomline: it may not be a password issue at all, but different versions of Java or the Android SDK causing the issue, so remember to check that out.

And once it starts working, remember to backup your keystore and password in a safe place :-)

My key alias stoped working sudenly. (Ok, after few updates of Android Studio and Java).

I tried all solutions from this thread as well as from others. In my case the solution was surprising. I have the keystore with few aliases. None was working except one, which had password the same as keystore. But unfortunately it wasn't the one I needed. This made me thinking with no logic involved. I copied single alias to new keystore with

keytool -importkeystore -srckeystore old.keystore -destkeystore new.keystore -srcalias importantalias

And then I changed alias password to the same as keystore's password with:

keytool -keypasswd -keystore new.keystore -alias importantalias

Finally I was able to sign my apk. It looks like silly bug which can waste a day of development.

Just had this issue - all of a sudden Android Studio forgot my passwords and wouldn't use the ones I had in the gradle file. I've had the same keyfile and passwords in the same project for 6 years!

So I entered them manually - but it failed verification time after time. I tried some things like invalidating caches, restarting Android Studio and restoring a backup of the keystore but nothing helped.

Finally in pure desperation I tried to switch the keystore password and the key password. Lo and behold - it worked! Turns out I had switched the passwords when I entered them into the Gradle build file a few years ago, and for some reason I never noticed.

Conclusion: never be 100% sure that you're doing it right.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!