我希望为我的应用程序生成一个应用程序签名,以后将与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

我怎样才能摆脱这个?


当前回答

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是系统名放置自己的系统名

其他回答

在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

首先在cmd中导航到Java/jre/bin文件夹 cd c:\Program Files (x86)\Java\jre7\bin

然后使用:[change debug。]到系统上正确位置的密钥库路径] 安装openssl(适用于Windows 32或64,根据您的需要在c:\openssl)

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

因此整个命令是这样的:[提示在执行时输入密钥库密码]

c:\Program Files (x86)\Java\jre7\bin>keytool -exportcert -alias androiddebugkey
-keystore "C:\Users\vibhor\.android\debug.keystore" | "c:\openssl\bin\openssl.ex
e" sha1 -binary | "c:\openssl\bin\openssl.exe" base64
Enter keystore password:

IDK如果这是相关的,但如果你已经安装了Git,你可以在“C:\Program Files\Git\usr\bin”中找到openssl,这个位置你可以在终端中使用你的密钥库命令。

哦,对了,命令:

"C:\Users\YOURPATH/filename. exe -exportcert -alias keystore -keystore "C:\Program Files\Git\usr\bin\openssl" base64 . jks" | "C:\Program Files\Git\usr\bin\openssl" sha1 -二进制|

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是系统名放置自己的系统名

步骤1

从https://code.google.com/archive/p/openssl-for-windows/downloads下载用于windows的SSL。

步骤2

解压文件夹到OpenSSL,并粘贴到“C:\Program Files”。

步骤3

在环境变量中添加“C:\Program Files\OpenSSL\bin”(编辑系统环境变量>环境变量> Path > New)。它将使openssl在终端中工作。

步骤4

将“C:\Program Files\Android\Android Studio\jre\bin”添加到环境变量中。它将使keytool在终端中工作。

步骤5

打开一个终端并执行:

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

密码应该是android。