无法打开配置文件:Windows 上的 /usr/local/ssl/openssl.cnf
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16658038/
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
Can't open config file: /usr/local/ssl/openssl.cnf on Windows
提问by Himanshu Yadav
I have installed OpenSSL 64. I want to use a certificate for my nodejs https server. I ran the following command:
我已经安装了 OpenSSL 64。我想为我的 nodejs https 服务器使用证书。我运行了以下命令:
openssl genrsa -out subdomain.domain.com.key 1024
But I have got the error:
但我有错误:
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
Loading 'screen' into random state - done
Generating RSA private key, 1024 bit long modulus
.........++++++
.........................................++++++
unable to write 'random state'
e is 65537 (0x10001)
How can I resolve it?
Is this the right command?
我该如何解决?
这是正确的命令吗?
回答by DavAlPi
The solution is running this command:
解决方案是运行此命令:
set OPENSSL_CONF=C:\OpenSSL-Win32\bin\openssl.cfg
or
或者
set OPENSSL_CONF=[path-to-OpenSSL-install-dir]\bin\openssl.cfg
in the command prompt before using openssl
command.
在使用openssl
命令之前的命令提示符中。
Let openssl
know for sure where to find its .cfg
file.
让我们openssl
确定在哪里可以找到它的.cfg
文件。
Alternatively you could set the same variable OPENSSL_CONF
in the Windows environment variables.
或者,您可以OPENSSL_CONF
在 Windows 环境变量中设置相同的变量。
NOTE: This can happen when using the OpenSSL binary distribution from Shining Light Productions(a compiled + installer version of the official OpenSSL that is free to download & use). This distribution is "semi-officially" linked from OpenSSL's site as a "service primarily for operating systems where there are no pre-compiled OpenSSL packages".
注意:使用Shining Light Productions的OpenSSL 二进制分发版(可免费下载和使用的官方 OpenSSL 的编译 + 安装程序版本)时,可能会发生这种情况。这个发行版是从 OpenSSL 的站点“半官方”链接的,作为“主要用于没有预编译 OpenSSL 包的操作系统的服务”。
回答by komu_Mkeya
I've SSL on Apache2.4.4 and executing this code at first, did the trick:set OPENSSL_CONF=C:\wamp\bin\apache\Apache2.4.4\conf\openssl.cnf
我在 Apache2.4.4 上使用 SSL 并首先执行此代码,成功了:set OPENSSL_CONF=C:\wamp\bin\apache\Apache2.4.4\conf\openssl.cnf
then execute the rest codes..
然后执行其余代码..
回答by Steven Penny
/usr/local/ssl/openssl.cnf
/usr/local/ssl/openssl.cnf
A path like this means the program has been compiled with either Cygwin or MSYS. If you must use this openssl
then you will need an interpreter that understands those paths, like Bash, which is provided by Cygwin or MSYS.
像这样的路径意味着程序是用 Cygwin 或 MSYS 编译的。如果您必须使用它,openssl
那么您将需要一个能够理解这些路径的解释器,例如由 Cygwin 或 MSYS 提供的 Bash。
Another option would be to download or compile a Windows Native version of openssl
. Using that the program would instead require a path like
另一种选择是下载或编译 Windows 本机版本的openssl
. 使用该程序将需要一个类似的路径
C:\Users\Steven\ssl\openssl.cnf
which would be better suited for the Command Prompt.
这将更适合命令提示符。
回答by FlyBy
In my case I used the binaries from Shining Light and the environment variables were already updated. But still had the issue until I ran a command window with elevated privileges.
就我而言,我使用了 Shining Light 的二进制文件,并且环境变量已经更新。但是在我运行具有提升权限的命令窗口之前仍然存在问题。
When you open the CMD window be sure to run it as Administrator. (Right click the Command Prompt in Start menu and choose "Run as administrator")
当您打开 CMD 窗口时,请务必以管理员身份运行它。(右键单击开始菜单中的命令提示符并选择“以管理员身份运行”)
I think it can't read the files due to User Account Control.
我认为由于用户帐户控制,它无法读取文件。
回答by T.Todua
SOLUTION!
解决方案!
just set -config
parameter location correctly, i.e :
只需-config
正确设置参数位置,即:
openssl .................... -config C:\bin\apache\apache2.4.9\conf\openssl.cnf
回答by Dev
Not sure what is the difference between .cfg & .cnf
In my server I couldn't find .cfg or .cnf
I had created a new file for the sameand placed it in the following folder /usr/local/ssl/bin
不知道是我找不到.CFG或.CNF我创造了一个新的文件之间.CFG&.CNF在我的服务器的区别一样,放在下面的文件夹/usr/local/ssl/bin
executed the
执行了
.\openssl genrsa -des3 -out <key name>.key 2048
went great..
很棒..
回答by autremoi
Simply install Win64 OpenSSL v1.0.2a or Win32 OpenSSL v1.0.2a, you can download these from http://slproweb.com/products/Win32OpenSSL.html. Works out of the box, no configuration needed.
只需安装 Win64 OpenSSL v1.0.2a 或 Win32 OpenSSL v1.0.2a,您可以从 http://slproweb.com/products/Win32OpenSSL.html。开箱即用,无需配置。