Facebook Android SDK 的密钥哈希
我不知道如何获取使用 Facebook Android SDK 所需的密钥哈希。我发现我可以将 keytool
与这些命令一起使用:
keytool -exportcert -alias [alias]
-keystore [keystore] | openssl sha1 -binary | openssl enc -a -e
唯一的问题是我不知道在哪里插入它,我尝试通过命令窗口(win7)并尝试打开文件 keytool.exe 。
I can't figure out how to get the Key Hash required to use the Facebook Android SDK. I figured out that I can use keytool
with these commands:
keytool -exportcert -alias [alias]
-keystore [keystore] | openssl sha1 -binary | openssl enc -a -e
The only problem is that I have no idea where to insert this, I tried through command windows (win7) and I tried opening the file keytool.exe.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
您可以从此处安装 Open SSL,这将使您的命令正常工作
You can install Open SSL from here , that should make your command work
我创建了一个批处理脚本 facebookkeydebug.bat,它返回所需的 Facebook 密钥哈希值。只需编辑脚本,设置正确的路径、密钥库名称并运行它。
编辑:我发布了一个存储库,其中包含一些批处理脚本,用于在 Windows 上签名和获取证书密钥: https://github.com/petrnohejl/Android -脚本
I created a batch script facebookkeydebug.bat, which return desired Facebook key hash. Just edit the script, set correct paths, keystore name and run it.
EDIT: I published a repo with some batch scripts for signing and getting cert keys on Windows: https://github.com/petrnohejl/Android-Scripts
您可以使用下面的代码来获取哈希密钥:
参考:
http ://limbaniandroid.blogspot.com/2013/04/how-to-get-hash-key-for-integarte.html
you can use code below to get the Hash key :
Reference :
http://limbaniandroid.blogspot.com/2013/04/how-to-get-hash-key-for-integarte.html
为了让事情变得更容易 -
这应该为您提供所需的指纹,而无需安装 openssl 的麻烦。
例如
To make things easier -
this should provide you with the fingerprints needed, without the hassle of installing openssl.
e.g.
这是如何从密钥库获取密钥哈希的示例:
首先我们需要获取以下路径:
Java 路径:
C:\Program Files\Java\jdk1.6.0_35\jre\bin
打开 SSL 路径:
C:\OpenSSL-Win32\bin
(从以下位置安装:http://www.openssl.org/)
密钥库路径:
C:\Data\ANDROID\KEYSTORE\
2) 然后转到命令行并键入:
3) 然后输入:
4) 必须需要您的密钥库的密码,然后您就有与您的 Android 密钥库相关的
Hash Key
。这是有关如何为
设置
:密钥哈希
的文档Facebookhttps://developers.facebook。 com/docs/android/getting-started#release-key-hash
This is an example of how to get the Key Hash from the Keystore:
first we need to get the paths of:
Java path:
C:\Program Files\Java\jdk1.6.0_35\jre\bin
Open SSL Path:
C:\OpenSSL-Win32\bin
(install from: http://www.openssl.org/)
Keystore Path:
C:\Data\ANDROID\KEYSTORE\
2) then go to Command line and type:
3) then type :
4) the password of your Keystore must be required and then you have the
Hash Key
related to your Android Keystore.This is the doc of how to set the
Key Hash
forFacebook
:https://developers.facebook.com/docs/android/getting-started#release-key-hash
您必须打开命令提示符窗口。转到开始->运行并输入“cmd”并按 Enter 键。然后,您必须导航到
keytool
所在的文件夹(除非它在您的路径中),然后键入该命令。也就是说,假设该命令适用于 Windows 而不是 Linux。
You have to open a command prompt window. Go to start->run and type 'cmd' and hit enter. Then you have to navigate to the folder where
keytool
is (unless it's in your path), and then type that command.That is, assuming that command is for windows and not linux.
最好的方法是使用代码生成 Key-Hash:
调用此方法一次并生成 key-hash,享受
Best way is to generate Key-Hash using code:
call this method once and generate key-hash, enjoy
C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe -exportcert -alias "typeYouraliasname" -keystore 密钥库位置 | C:\OpenSSL-Win32\bin\openssl sha1 -binary | C:\OpenSSL-Win32\bin\openssl base64
C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe -exportcert -alias "typeYouraliasname" -keystore locationof your keystore | C:\OpenSSL-Win32\bin\openssl sha1 -binary | C:\OpenSSL-Win32\bin\openssl base64