Java Keytool 签名问题:Keystore 被篡改,或密码不正确
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4262773/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Keytool Signing Problem: Keystore was tampered with, or password was incorrect
提问by Sheehan Alam
I am trying to sign the release version of my Android app (debug was signed fine) for the Google Maps API:
我正在尝试为 Google Maps API 签署我的 Android 应用程序的发布版本(调试已正确签署):
keytool -list -alias cancertrials -keystore /Users/syalam/Documents/workspace/Cancer_Trials/keys/release -storepass android -keypass cancertrials
But I get the error:
但我收到错误:
java.io.IOException: Keystore was tampered with, or password was incorrect
I am positive the password is correct, because when I try to export my app in Eclipse, it asks for the keystore and the password, and I am entering it in correctly.
我很确定密码是正确的,因为当我尝试在 Eclipse 中导出我的应用程序时,它要求提供密钥库和密码,并且我输入正确。
Not sure why I can't sign this? I need to display Google Maps in release mode (working in debug mode).
不知道为什么我不能签署这个?我需要在发布模式下显示谷歌地图(在调试模式下工作)。
采纳答案by chubbsondubs
I don't think you have to include a storepass when you're just doing a list. The storepass encrypts the private key which isn't displayed when doing a list. Just try this:
我不认为您只需要在列出清单时就必须包含商店通行证。storepass 加密了做列表时不显示的私钥。试试这个:
keytool -list -keystore /Users/salam/Documents/yada/yada
Then provide your keystore password when prompted. If that works then you can try just the keypass on the command line.
然后在提示时提供您的密钥库密码。如果可行,那么您可以在命令行上尝试使用 keypass。
You might also want to check and make sure your using the same version of Java. I don't think that's the problem, but if the above doesn't help try it out.
您可能还想检查并确保您使用的是相同版本的 Java。我不认为那是问题所在,但如果上述方法无济于事,请尝试一下。
回答by Marek Gregor
I have the same problem with jarsigner on jdk1.6.0.31 when I switched back to 1.6.0_29 jarsigner works correctly. Please be aware of jdk version.
当我切换回 1.6.0_29 jarsigner 时,jdk1.6.0.31 上的 jarsigner 也有同样的问题。请注意jdk版本。
回答by Bhaskar
Check your alias name once. Some times your alias is different from is keytool alias name then it gives the same error. i.e.
检查您的别名一次。有时您的别名与 keytool 别名不同,然后它会给出相同的错误。IE
回答by shauvik
Somehow on windows, the keytool would not accept the password. I only needed the SHA1 password for configuring the client id on the project on google dev console. The following seemed to work for me
不知何故,在 Windows 上,keytool 不会接受密码。我只需要 SHA1 密码就可以在 google dev 控制台上的项目中配置客户端 ID。以下似乎对我有用
keytool --list --keystore android.jks --protected
This printed the SHA1 keys for all aliases.
这打印了所有别名的 SHA1 密钥。
回答by Manas
keytool -list -keystore "Path of the keystore"
keytool -list -keystore "Path of the keystore"
This command will ask for password in linux
machines, whereas in windows machine, you just need to enter the list keystore.
此命令将在linux
机器中询问密码,而在 Windows 机器中,您只需要输入列表密钥库。