简体   繁体   English

密钥库和Android的签名问题

[英]Signing problems with keystore and Android

So I have an Android application on the market, and now I need to update it. 因此,我在市场上有一个Android应用程序,现在需要对其进行更新。 I've been trying to sign the new apk but having difficulties with that. 我一直在尝试签署新的APK,但遇到了困难。

I have the keystore, and have verified it contains the correct certificate using keytool -list -v -keystore deployment.keystore . 我有密钥库,并使用keytool -list -v -keystore deployment.keystore验证了它包含正确的证书。 The keystore has no password, don't remember doing that but there you go. 密钥库没有密码,不记得要这样做了,但是就到了。 If I enter in anything, I get an error, if I don't then it accepts the command and lists the contained certificates. 如果输入任何内容,则会出现错误;如果不输入,则它将接受命令并列出所包含的证书。

Now the problem is that when trying to export the apk file in Eclipse, using the export wizard, I'm not allowed to have no password on the keystore, thus I can't get to the credentials that are inside. 现在的问题是,当尝试使用导出向导在Eclipse中导出apk文件时,不允许我在密钥库上没有密码,因此无法获得其中的凭证。 So I tried to run the following in an attempt to change the password on the keystore keytool -storepasswd -keystore deployment.keystore . 因此,我尝试运行以下命令,以尝试更改keystore keytool -storepasswd -keystore deployment.keystore上的密码。 I'm asked for a password, and neither the empty string password nor the new password I want to set is accepted. 我被要求输入密码,并且我要设置的空字符串密码和新密码均未被接受。 If its < 6 chars in length I get prompted again, and if its > 6 chars I get the following error: keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect . 如果长度小于6个字符,则再次提示,如果长度大于6个字符,则出现以下错误: keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect

Now I'm at a loss what to do, and seek the collective knowledge of SO to help me out. 现在我无所适从,寻求SO的集体知识来帮助我。

UPDATE : I've now exported the certificate and then imported it again into a new keystore successfully. 更新 :我现在已经导出了证书,然后再次将其成功导入到新的密钥库中。 The problem now is that I'm getting a Unhandled event loop exception in Eclipse when I try to sign. 现在的问题是,当我尝试签名时,我在Eclipse中遇到了Unhandled event loop exception Any ideas? 有任何想法吗?

UPDATE 2: Trying to sign through terminal to avoid the exception that Eclipse is throwing has presented new problems. 更新2:尝试通过终端登录以避免Eclipse抛出的异常带来了新问题。 I'm trying the following: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore new.keystore myApp.apk myAlias . 我正在尝试以下操作: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore new.keystore myApp.apk myAlias I only have the certificate in my new keystore, but no private key so I've been trying to export them as p12 from the old keystore by running keytool -importkeystore -srckeystore deployment.keystore -destkeystore myKeystore.p12 -deststoretype PKCS12 . 我仅在新的密钥库中拥有证书,但没有私钥,因此我一直在尝试通过运行keytool -importkeystore -srckeystore deployment.keystore -destkeystore myKeystore.p12 -deststoretype PKCS12从旧密钥库keytool -importkeystore -srckeystore deployment.keystore -destkeystore myKeystore.p12 -deststoretype PKCS12其导出为p12。

Now I'm getting the following warning: 现在,我收到以下警告:

** * ** * * WARNING WARNING WARNING * ** * ** * ** * ** * *警告警告警告* ** * ** *

The integrity of the information stored in the srckeystore* * has NOT been verified! 尚未验证存储在srckeystore *中的信息的完整性! In order to verify its integrity, * * you must provide the srckeystore password. 为了验证其完整性,您必须提供srckeystore密码。

** * ** * * WARNING WARNING WARNING * ** * ** * ** * ** * *警告警告警告* ** * ** *

And this now prompts me for a password for the srckeystore which is the empty string. 现在,这提示我输入srckeystore的密码,该密码为空字符串。 This is some loop hole I seem to have fallen into! 这似乎是我遇到的一个漏洞!

Update 3: I've now successfully changed the original keystore password by feeding with the command -storepass . 更新3:现在,通过提供命令-storepass我已成功更改了原始密钥库密码。 Now however I'm prompted for the keypass of the actual private/public key pair in the keystore. 但是,现在提示我在密钥库中输入实际私钥/公钥对的密钥。 I don't remember setting these, and even though I've read that they default to the keystore password if not set they are not accepting anything I enter. 我不记得设置这些设置,即使我已经读到they default to the keystore password if not set也不会接受我输入的任何内容。 My search continues. 我的搜索继续。

-MrDresden -德累斯顿

After trying a few different things, we ended up republishing the app with a new key from a new keystore. 在尝试了几种不同的方法之后,我们最终使用来自新密钥库的新密钥重新发布了该应用程序。 Thankfully it had only been out for a couple of hours, and not been promoted at all so only about 10 users got affected. 值得庆幸的是,它只发布了几个小时,并且根本没有被推广,因此只有大约10个用户受到了影响。 Which is still to many. 还有很多。

After all this, we have started to set up Maven and all publishing will only be done after the Maven server has compiled and signed the app. 完成所有这些之后,我们就开始设置Maven,并且只有在Maven服务器编译并签署了应用程序之后,才能进行所有发布。 Everything is backed up, all passwords kept written down etc. 一切都备份了,所有密码都记下来了,等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM