keytool 与 Android Facebook SDK
我只是想要一些确认。
我正在 Windows 上进行开发,
我正在尝试将 facebook 集成到应用程序中,SDK 文档说我需要“导出签名”,
从这里: http://developers.facebook.com/docs/guides/mobile/#android
所以它说运行这个命令:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
首先我必须下载 openssl:OpenSSL< /a>
现在,我认为上面的命令应该转换为:
"C:\path\to\java\keytool" -exportcert -alias your_alias -keystore "C:\path\to\your\keystore\keystore.name" | "C:\path\to\openssl_install\bin\openssl" sha1 -binary |"C:\path\to\openssl_install\bin\openssl" base64
- 那么您想要将 keytool 安装在最新的 Java 安装文件夹中吗?
- 您希望别名是您在 Eclipse 中正常创建 apk 时使用的别名吗?
- 您希望密钥库成为导出 Android 应用程序时使用的密钥库吗?
- 您希望 openssl 成为您刚刚安装的那个
所以一旦我完成此操作,它会要求输入密码:(它在我输入时显示密码)
如果我输入正确的密码,我会得到
'zR2tey1h9kqPRSW/yEYEr0ruswyD='(已更改为公开)
,但如果我输入错误的密码,它仍然会返回以下形式的代码
'ga0RGNYHvTR5d3SVDEfpQQAPGJ1='?
所以是的,只是在寻找我正在做正确的事情的确认,这是预期的输出
I just want some confirmation.
I'm developing on windows
I'm attempting to integrate facebook into an app and the SDK documentation says I need to 'export a signature'
From here: http://developers.facebook.com/docs/guides/mobile/#android
So it says run this command:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
First I had to download openssl: OpenSSL
Now the command above, I assume should be converted to:
"C:\path\to\java\keytool" -exportcert -alias your_alias -keystore "C:\path\to\your\keystore\keystore.name" | "C:\path\to\openssl_install\bin\openssl" sha1 -binary |"C:\path\to\openssl_install\bin\openssl" base64
- So you want the keytool that is installed in your latest Java install folder?
- You want the alias to be the name of the alias you use for a normal apk creation in eclipse?
- You want the keystore to be the one you use when exporting android apps?
- You want openssl to be the one you just installed
So once I've done this it asks for a password: (it shows the password as I'm typing it)
If I enter a correct password I get
'zR2tey1h9kqPRSW/yEYEr0ruswyD=' (changed for public)
but if I enter an incorrect password it still returns me a code in the form of
'ga0RGNYHvTR5d3SVDEfpQQAPGJ1='?
So yeah, was just looking for a confirmation that I'm doing the right thing, and this is the output expected
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
获取哈希值的最佳方法是运行以下代码:
当使用 Windows cmd、git bash 或 cygwing 终端提取哈希值时,这三个工具给出不同的结果。
最准确的是上面的代码
the best way to get your hash is by running the following code:
when extracting the hash with windows cmd,git bash or cygwing terminal, the three tools give different result.
the most accurate is the code above
是的,我认为你的做法是正确的。我还执行这个命令并将这个哈希值放入我的 Facebook 应用程序中,并且它可以正常工作。
yes you are doing it in a right way i think.i also execute this command and put this hash in my fb app and its works properly.
下面回答您的问题:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 - 二进制 | openssl base64 具有三个命令,将前一个命令的输出提供给后一个命令。
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
openssl sha1 -binary
openssl base64
当给出不正确的密钥库密码时,第一个命令生成错误,但不会显示该错误,因为该错误将输入到第二个命令并生成不同的哈希值。仅运行第一个 keytool 命令 (
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
) 来确认您的密钥库密码以及它是否正确。如果密码不正确,将显示类似以下的输出。〜/.android/debug.keystore
输入密钥库密码:
keytool 错误:java.io.IOException:密钥库被篡改,或密码被篡改
不正确
提供android来回答
输入密钥库密码:
以获取是否生成android调试哈希的提示。 android 调试密钥库的默认密码是 android命令也可以编写为从 keytool 命令捕获错误,以查看命令 1 在运行命令 2 之前是否返回错误。
对以上所有问题都是肯定的。 PATH 可以设置为不输入 keytool 和 openssl 的完整路径。
Answer to your question below:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
has three commands feeding output of preceding command to following command.keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
openssl sha1 -binary
openssl base64
When incorrect keystore password is given, first command generates error but that won't be displayed as that would be input to second command and different hash is generated. Only run first keytool command (
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
) to confirm your keystore password and if it is right. If password is incorrect, similar to output below will be displayed.~/.android/debug.keystore
Enter keystore password:
keytool error: java.io.IOException: Keystore was tampered with, or password was
incorrect
Provide android to answer for
Enter keystore password:
for prompt if android debug hash is generated. Default password for android debug keystore is androidCommand could also have written to catch error from keytool command to see if command 1 returned error before running command 2.
Yes to all of questions above. PATH could be setup not to type full path for keytool and openssl.