2

在花了几个小时弄清楚如何签署应用程序之后(最后我使用了 eclipse,而不是命令行),我想为我的应用程序创建一个密钥哈希这里描述。为此,我在 C:\Users\Family\workspace\MyKeys 文件夹中创建了 sample.keystore 和 samplesigned.apk,以及 keytool.exe 和 jli.dll。

在 cmd.exe 我导航到 C:\Users\Family\workspace\MyKeys 并且当我运行此命令时:

keytool -exportcert -alias samplekey -keystore sample.keystore我得到这个胡言乱语:在此处输入图像描述 samplekey 是在 eclipse 中创建的密钥的别名:

在此处输入图像描述

我从这里下载 open ssl并将其安装到 C:\Program Files\GnuWin32 中。在命令行中导航到这里我尝试了这个命令:openssl -help,它产生了一个命令列表,这意味着我正确安装了它(我希望)。

现在我试试这段代码:

C:\Users\Family\workspace\MyKeys>keytool -exportcert -alias samplekey -keystore sample.keystore | c:\program files\gnuwin32\bin\openssl sha1 -binary | c:\program f
iles\gnuwin32\bin\openssl base64

错误:'c:\program' 不是内部或外部命令、可运行程序或批处理文件。

我还在环境变量的 PATH 中添加了 C:\Program Files\GnuWin32\bin。

我有点迷路了。

4

1 回答 1

5

您需要在命令中引用路径,否则它将在第一个空格(即 C:\Users\Family\workspace\MyKeys>keytool -exportcert -alias samplekey -keystore sample.keystore | "c:\program files\gnuwin32\bin\openssl" sha1 -binary | "c:\program f iles\gnuwin32\bin\openssl" base64)处中断。

不确定这是否是真正的问题,但请尝试一下。

于 2011-06-01T11:22:09.527 回答