简体   繁体   English

JDK 7更改了keytool输出

[英]JDK 7 changes keytool output

I'm using keytool of JDK to generate the Google Maps API key fingerprint. 我正在使用JDK的keytool来生成Google Maps API密钥指纹。 While being rejected for several times, I realized that I've upgraded JDK to 1.7 recently. 虽然被拒绝多次,但我意识到我最近将JDK升级到了1.7。 So I switch my dir to JDK6 (Thank god, the old version remains.), and repeated the same command: 所以我将我的目录转换为JDK6(感谢上帝,旧版本仍然存在。),并重复相同的命令:

D:\.android>"C:\Program Files\Java\jre6\bin\keytool" -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android

and Bang! 和邦! It works. 有用。 Turned out that JDK7 generated the SHA1 fingerprint instead of MD5, which leads to the rejection of my submission to Google. 原来JDK7生成了SHA1指纹而不是MD5,这导致我拒绝提交给谷歌。 So I'm wondering why this happens for the new version of JDK. 所以我想知道为什么新版本的JDK会发生这种情况。 Any one have some clues? 任何人都有一些线索?

The keytool command has the parameter -keyalg that takes an algorithm name and generates the key according to that algorithm. keytool命令具有参数-keyalg ,该参数采用算法名称并根据该算法生成密钥。 As far as I understand, it just means that the default algorithm for that command has changed. 据我了解,它只是意味着该命令的默认算法已更改。

I do not know whether it is a conscious choice or a bug - you may want to report it to Oracle. 我不知道这是一个有意识的选择还是一个错误 - 你可能想把它报告给Oracle。

keytool.exe -v provides you different fingerprints, such as MD5 etc. keytool.exe -v为您提供不同的指纹,如MD5等。

exampl: C:[jedk path]\\bin\\keytool.exe" -v -list -keystore "C:\\Document s and Settings\\Administrator.android\\debug.keystore" 例如:C:[jedk path] \\ bin \\ keytool.exe“-v -list -keystore”C:\\ Document s和Settings \\ Administrator.android \\ debug.keystore“

To elaborate on the accepted answer: 详细说明接受的答案:

With JDK 1.7 I was having Authorization failure issues. 使用JDK 1.7,我遇到了授权失败问题。 I finally figured out how to generate the right debug keystore, using SHA1. 我终于想出了如何使用SHA1生成正确的调试密钥库。 Here's the command I used: 这是我使用的命令:

keytool -genkey -v -keyalg RSA -sigalg SHA1withRSA -keystore "%USERPROFILE%\.android\debug.keystore" -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"

After generating it, you can see it by using the command: 生成它之后,您可以使用以下命令查看它:

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

The Signature algorithm should now read "SHA1withRSA". 签名算法现在应为“SHA1withRSA”。 Copy the SHA1 fingerprint and paste it in the Google console "Key for Android apps", and you should be good to go. 复制SHA1指纹并将其粘贴到Google控制台“Android应用程序密钥”中,您应该很高兴。

使用-digestalg SHA1 -sigalg MD5withRSA和jarsigner。

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

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