'openssl'不被识别为内部或外部命令

问题描述 投票:8回答:5

我试图在命令提示符中执行以下命令。

keytool -exportcert -alias androiddebugkey -keystore "<path-to-users-directory>\.android\debug.keystore" | openssl sha1 -binary | openssl base64

但命令提示符窗口报告:

'openssl' is not recognized as internal or external command.

我可以在命令提示符窗口中执行此命令吗?

windows cmd openssl
5个回答

16
投票

你看到的错误意味着你的%PATH%(外部命令)中没有这样的程序,它也不是内置的shell命令(内部命令)。

在您的计算机上安装OpenSSL。您还需要检查其安装位置是否在您的%PATH%中。默认情况下,它可能不会。例如,假设OpenSSL安装在c:\OpenSSL-Win32openssl二进制文件可能位于c:\OpenSSL-Win32\bin\openssl.exe。所以你的路径需要包括c:\OpenSSL-Win32\bin

有时,OpenSSL无法在Windows上找到其配置文件。为此,请参阅OpenSSL and error in reading openssl.conf file


另一种选择是使用命令中的完整路径:

keytool -exportcert -alias androiddebugkey -keystore "<path-to-users-directory>\.android\debug.keystore" | ^
  c:\OpenSSL-Win32\bin\openssl.exe sha1 -binary | c:\OpenSSL-Win32\bin\openssl.exe base64

但是,这仍然会受到OpenSSL and error in reading openssl.conf file详细介绍的OpenSSL配置文件问题的影响。


0
投票
  1. 转到:https://code.google.com/archive/p/openssl-for-windows/downloads
  2. 解压文件
  3. 打开bin / openssl.exe

0
投票

只需要将OpenSSL bin路径(例如:C:\ Program Files \ OpenSSL-Win64 \ bin)添加到PATH系统变量,如下所示:

enter image description here


-4
投票

在Windows计算机上安装openssl。

© www.soinside.com 2019 - 2024. All rights reserved.