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

我怎样才能摆脱这个?


当前回答

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

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

其他回答

使用整个路径,像这样:

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

这对我很管用。

我今天也遇到了同样的问题,通过以下视频(SSL安装)解决了它- https://www.youtube.com/watch?v=PoAc1lpfK8I&ab_channel=GleyGames

然后,我使用Usamas命令,并运行它(在命令中更改路径后),我从java安装中的bin文件夹中运行它,使用CMD。

对我有效的全面命令:

(来自C:\Program Files\Java\ jdk-11.0.12\bin):

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "C:\Program Files\OpenSSL-Win64\bin\openssl" sha1 -binary | "C:\Program Files\OpenSSL-Win64\bin\openssl" base64

如果你在本地安装了git,很容易解决。 你可以打开git bash,在你想要生成密钥的地方更改目录,然后运行你的命令。 它将工作,因为git默认安装开放的SSL exe,你不需要每次你想运行SSL exe手动设置路径。 它对我很有效,我希望它能有所帮助。

这对我来说很成功。

“C:\Program Files\Java\jdk1.6.0_26\bin\keytool.exe” -exportcert -alias sociallist -keystore “D:\keystore\SocialListing” |“C:\cygwin\bin\openssl.exe” sha1 -binary |“C:\cygwin\bin\openssl.exe” base64

注意以下路径:

“C: \ Program Files \ Java \ jdk1.6.0_26 \ bin \ keytool.exe” “D:\keystore\SocialListing”或者可以是这样的“C:\Users\Shaon.android\debug.keystore” “C:\cygwin\bin\openssl.exe”或者可以像这样:C:\ users \openssl\bin\openssl.exe

如果命令成功工作,那么你将看到这个命令:

输入keystore密码:typeyourpassword

Encryptedhashkey * *

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