windows “openssl”未被识别为内部或外部命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20838516/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 11:13:14  来源:igfitidea点击:

'openssl' is not recognized as internal or external command

windowscmdopenssl

提问by osimer pothe

I am trying to execute the following command in command prompt .

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

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

But the command prompt windows reports:

但是命令提示符窗口报告:

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

What ca I do to execute this command in command prompt window?

我该怎么做才能在命令提示符窗口中执行此命令?

回答by steveayre

The error you saw means there's no such program in your %PATH%(external command) and it's also not a built-in shell command (internal command).

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

Install OpenSSL on your machine. You will also need to check that its installed location is in your %PATH%. By default it probably won't be. As an example, suppose OpenSSL is installed at c:\OpenSSL-Win32. The opensslbinary is probably located at c:\OpenSSL-Win32\bin\openssl.exe. So you path needs to include c:\OpenSSL-Win32\bin.

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

Sometimes OpenSSL cannot find its configuration file on Windows. For that, see OpenSSL and error in reading openssl.conf file.

有时 OpenSSL 在 Windows 上找不到其配置文件。为此,请参阅OpenSSL 和读取 openssl.conf 文件时出错



Another option is to use the full path in the command:

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

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

However, this still suffers the OpenSSL configuration file problem detailed at OpenSSL and error in reading openssl.conf file.

但是,这仍然会遇到 OpenSSL 中详述的 OpenSSL 配置文件问题以及读取 openssl.conf 文件时出错

回答by Ahmed Mihoub

Just you need to Add OpenSSL bin path (ex: C:\Program Files\OpenSSL-Win64\bin) to the PATH system variable as shown below:

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

enter image description here

在此处输入图片说明

回答by Elias

  1. Go to: https://code.google.com/archive/p/openssl-for-windows/downloads
  2. Extract file
  3. open bin/openssl.exe
  1. 转到:https: //code.google.com/archive/p/openssl-for-windows/downloads
  2. 提取文件
  3. 打开 bin/openssl.exe

回答by KCShelby

Install openssl on your Windows machine.

在您的 Windows 机器上安装 openssl。