I have a question about how and what is the version of OpenSSl that I must install in Windows to later create certificates. Install a one version (openssl-1.0.2d-fips-2.0.10) found in SourceForge but it does not generate the files correctly. There is also the official website https://www.openssl.org, but I do not know how to install it and how, so that when it comes to generating the keys and .pem file, it works. Generate some environment variables that point to the folder where I unzipped the downloaded, I do not know if it is the correct way.


当前回答

安装铲斗,然后打字

scoop install openssl

其他回答

我最近需要记录如何安装它的一个版本,所以我在这里复制了我的步骤,因为其他答案使用的是与我推荐的Cygwin不同的来源。我喜欢Cygwin,因为它维护得很好,并为Windows提供了大量其他实用程序。Cygwin还允许您在修复漏洞时根据需要轻松更新版本。请经常更新您的OpenSSL版本!

打开Windows命令提示符,输入:OpenSSL version检查是否安装了OpenSSL

如果您得到命令无法识别的错误消息,那么按照以下总结步骤参考Cygwin安装OpenSSL:

基本上,下载并运行Cygwin Windows安装应用程序来安装和更新OpenSSL应用程序:

Select an install directory, such as C:\cygwin64. Choose a download mirror such as: http://mirror.cs.vt.edu Enter in openssl into the search and select it. You can also select/un-select other items of interest at this time. The click Next twice then click Finish. After installing, you need to edit the PATH variable. On Windows, you can access the System Control Center by pressing Windows Key + Pause. In the System window, click Advanced System Settings → Advanced (tab) → Environment Variables. For Windows 10, a quick access is to enter "Edit the system environment variables" in the Start Search of Windows and click the button "Environment Variables". Change the PATH variable (double-click on it or Select and Edit), and add the path where your Cywgwin is, e.g. C:\cygwin\bin. Verify you have it installed via a new Command Prompt window: openssl version. For example: C:\Program Files\mosquitto>openssl versionOpenSSL 1.1.1f 31 Mar 2020 If not, refer to the Cygwin documentation and also other tutorials such as: https://www.eclipse.org/4diac/documentation/html/installation/cygwin.html

Necroposting,但可能对其他人有用:

There's always the official page ([OpenSSL.Wiki]: Binaries) which contains useful URLs (pointing to unofficial resources / builds, make sure to read the Important Disclaimer) There are other repositories which contain unofficial builds Here I want to mention: [GitHub]: CristiFati/Prebuilt-Binaries - Prebuilt-Binaries/OpenSSL v1.0.2u (FIPS capable) is built with OpenSSL-FIPS 2.0.16 Artefacts are .zips that should be unpacked in "C:\Program Files" (please take a look at the Readme.md file, and also at the one at the repository root) Other 3rd-party software may bundle OpenSSL, so it gets "installed" as a side effect. Such software (mentioned by other answers): Cygwin, Git And of course you can build it yourself from sources, but that requires some deeper knowledge

注意:当你有一个功能性的OpenSSL实例时(使用上面的任何方法),下面是你如何从VStudio中使用它(如果你需要它到你自己的项目中):

这里有一个解决方案,可能会让那些已经实现了WSL (Windows Subsystem for Linux)的人感到高兴。你可以用:

WSL openssl…

关键是许多实现了WSL的人可能没有意识到他们可以通过这种方式从DOS或powershell命令行调用任何linux命令(在他们的底层WSL linux虚拟机中)。(人们很容易认为WSL的目的是用它来“shell到vm”,这确实是一个选项,但是从Windows运行linux命令的能力是WSL真正的增值。)

需要明确的是,在执行上面的命令时,您可能指向(或创建)的任何文件名或文件夹都将相对于您运行命令的Windows文件夹。例如,openssl req创建一个自签名证书,其中可以将-keyout命名为selfsigned。输入自签名。crt,这两个文件将被创建在运行命令的Windows文件夹中。

也就是说,对于一些openssl命令示例来说,这可能会失败,例如,如果他们试图使用各种特定于bash的参数,在这种情况下,“shell到wsl”来运行命令可能是更好的选择。您仍然可以直接在主机上找到或放置东西,但我并不是说这个答案过于关注WSL方面。我只是想把它作为安装openssl的另一种选择。

你安装Git了吗? 您可以在Git Bash中访问openssl命令,而无需添加任何环境变量。

但是,如果你想从Windows cmd中访问openssl命令,请跟随我:

找到Git bin目录的路径。通常是在

C:\Program Files\Git\usr\bin\

然后添加路径你的环境变量(User变量-> path):

现在打开一个新的命令提示符(不要使用已经打开的cmd,因为已经打开的cmd不知道新的环境变量)。

现在写:

openssl

检查openssl工具,这是一个来自LibreSSL项目和Cygwin库的openssl集合(2.5 MB)。NB !我们是包装商。

创建自签名证书的一行代码:

Openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout selfsigned。输出self - signed.crt