0

I'm getting a releasekey to my app Three months ago. Now I format my computer and when I was sign my app with my releasekey i got the error: java.lang.RunTimeException: keystore load: invalid keystore format.

How I should solve this error?

The command was: jarsigner -verbose -keystore "D:\releasekey.keystore" "D:\myApp.apk" releasekey

I'm using the older keystore (the fisrt one) but I get the error mentioned.

I tried and get this:

java.io.IOException: java.io.IOException: invalid keystore format 
at sun.security.provider.javaKeyStore.engineLoad(JavaKeyStore.java:650) 
at sun.security.provider.javaKeyStore$JKS.engineLoad(JavaKeyStore.java:55) 
at java.security.KeyStrore.load(KeyStore.java:1214) 
at sun.security.tools.KeyTool.doCommands(KeyTool.java:789) 
at sun.security.tools.KeyTool.run(KeyTool.java:340) 
at sun.security.tools.KeyTool.main(KeyTool.java:333) 

enter image description here

weldsonandrade
  • 606
  • 1
  • 9
  • 25

1 Answers1

1

The keystore holds the private encryption key used to sign the app - rerunning the command would generate a totally different key (the password just protects the file holding it - it does not have a directly relationship with the encryption key itself) - You can NOT recover/rebuild it if you lost the keystore file.

If you lost it then your users would have to uninstall the existing app completely before they can install your new version - and they will loose any data saved in the app when they uninstall it (no way around this, it's a security feature in android)

Worse then that - android play store isn't going to let you upload your new version because they aren't encoded using the same key as the old version - you'll need to release the new version under a Different package name - That means your existing users can't even upgrade automatically (they have to find the new version) - and you have no way of even telling them that they need to upgrade (you can't upload a new version of the old app...)

You gotta find that keystore file in your backups or try to recover the data from the disk - hopefully you did a 'quick' format - in which case a good data recovery service Might be able to get it back if your OS hasn't over-written it yet.

Goodluck!

msEmmaMays
  • 1,073
  • 7
  • 7
  • hi, I recovery my old releasekey but i can't using jarsiner because the error mentioned( keystore load) – weldsonandrade Sep 06 '12 at 03:14
  • Oh, then maybe this: "mangled trusted.certs" http://stackoverflow.com/questions/126798/java-invalid-keystore-format-error – msEmmaMays Sep 06 '12 at 03:19
  • Hi, I don't find this archive, I was in "C:\Users\weldson\AppData\LocalLow\Sun\Java\Deployment\security" and there have only two archives (baseline.timestamp, baseline.versions). =/ – weldsonandrade Sep 06 '12 at 03:54
  • It might not be in your personal AppData - it could be in the main program install directories - search your entire computer for a file called 'trusted.certs' - make sure it's under a /Java/ folder - and rename it instead of deleting it (just in case you need to put it back) – msEmmaMays Sep 06 '12 at 03:59
  • I really seached in all computer and nothing. I don't have this archive. – weldsonandrade Sep 06 '12 at 04:17
  • you could try this to list the contents and see if it can read the file - keytool -list -v -keystore "D:\releasekey.keystore" – msEmmaMays Sep 06 '12 at 04:24
  • I tried and get this: java.io.IOException: java.io.IOException: invalid keytore format at sun.security.provider.javaKeyStore.engineLoad(JavaKeyStore.java:650) at sun.security.provider.javaKeyStore$JKS.engineLoad(JavaKeyStore.java:55) at java.security.Keystrore.load(KeyStore.java:1214) at sun.security.tools.KeyTool.doComands – weldsonandrade Sep 06 '12 at 04:32
  • edit your question to add the info - the comments suck for this kind of thing – msEmmaMays Sep 06 '12 at 04:37
  • 1
    line 650 is here - http://www.docjar.com/html/api/sun/security/provider/JavaKeyStore.java.html#641 It's checking the second byte in the file to see if it's a '0x01' or '0x02' - If you open the keystore file in a hexeditor and check that second byte what does it say? It sounds like your file is corrupt – msEmmaMays Sep 06 '12 at 04:41
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/16341/discussion-between-weldsonandrade-and-robertmaysjr) – weldsonandrade Sep 06 '12 at 04:55
  • Sorry I have to go to bed, I misread the code it should be the first byte (not the second) - in your screenshot that is 0x8b - which is why it's failing. It looks like the file is corrupt. The only other possiblity is you are using an older version of java then you had before you reformatted - but there were only two versions so that's unlikely) – msEmmaMays Sep 06 '12 at 05:09
  • I think the file is corrupt =/ – weldsonandrade Sep 06 '12 at 14:11
  • The Java version is newer. I Get other program to recovery data, I'm praying for work. – weldsonandrade Sep 06 '12 at 14:18