我希望为我的应用程序生成一个应用程序签名,以后将与Facebook集成。在Facebook的一个教程中,我发现了这个命令:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

在教程中,它说通过运行这个cmd,我的生成签名的进程将开始。

但是,这个命令会给出一个错误:

openssl is not recognized as an internal or external command

我怎样才能摆脱这个?


当前回答

使用这个

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | "C:\Users\DK\openssl-0.9.8d_X64\bin\openssl.exe" sha1 -binary | "C:\Users\DK\openssl-0.9.8d_X64\bin\openssl.exe" base64

其他回答

这种方法对我很有效。请更改您的路径

C:\Program Files\Java\jre7\bin keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Ace.android\debug. keystore "keystore" | "C:\openssl\bin

\openssl.exe" sha1 -二进制| "C:\openssl\bin\openssl.exe" base64

在OpenSSL的地方…你必须输入你下载的OpenSSL文件夹的路径。你的实际命令应该是这样的:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | "C:\Users\abc\openssl\bin\openssl.exe" sha1 -binary | "C:\Users\abc\openssl\bin\openssl.exe" base64

请记住,您将输入的路径将是安装OpenSSL的路径。

编辑:

你可从以下连结下载OpenSSL for windows32及64bit:

OpenSSL for 64位

OpenSSL for 32 Bits

Steps to create Hash Key. 
1: Download openssl from Openssl for Windows . I downloaded the Win64 version 
2:Unzip and copy all the files in the bin folder including openssl.exe(All file of bin folder) 
3:Goto to the folder where you installed JDK for me it’s C:\Program Files\Java\jdk1.8.0_05\bin 
4:Paste all the files you copied from Openssl’s bin folder to the Jdk folder. 

然后进入C:\Program Files\Java\ jdk1.8.0_05\bin,按shift键,右键单击并打开cmd

C:\Program Files\Java\jdk1.8.0_05\bin>//cmd path 

这是给Sha1的 "C:\User\ABC\.android. keytool -exportcert -alias androiddebugkey -keystore "Keystore " | openssl sha1 -binary | openssl base64 . Keystore //和ABC是系统名放置自己的系统名

对于Windows用户,请从谷歌的代码存储库https://code.google.com/p/openssl-for-windows/downloads/list下载开放SSL

下载后,将内容解压到一个文件夹中,最好是在c:驱动器中。

然后更新PATH环境变量,以便可以从命令行中的任何位置使用.exe。

要更新PATH环境变量,请单击“我的电脑->属性->高级系统设置”。

单击高级选项卡,单击对话框底部的“环境变量”按钮,然后单击编辑从“系统变量”部分选择路径条目。

将该路径粘贴到解压缩的openssl下载的bin文件夹,然后单击ok。

您将需要关闭和打开之前可能启动的命令提示符,以便加载更新后的路径设置。

现在运行这个命令:

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Oladipo.android\debug. keystoreKeystore " | openssl sha1 -binary | openssl base64 . Keystore

您应该看到开发人员键。

如果你在windows上并且安装了git,那么你可以使用git Bash运行open ssl命令。

转到要存储密钥的目录 右键单击并打开GIT Bash 在这里,您可以运行任何openssl命令。如。 openssl enc -aes-128-cbc -k test -P -md sha1