我正在运行 windows xp 32 位
我刚刚从以下网址下载了 Openssl 并安装了它。 http://www.slproweb.com/products/Win32OpenSSL.html
然后我尝试使用以下命令创建自签名证书
openssl req -x509 -days 365 -newkey rsa:1024 -keyout hostkey.pem -nodes -out hostcert.pem
然后开始报错
Unable to load config info from /usr/local/ssl/openssl.cnf
经过一些谷歌搜索,我将上面的命令更改为
openssl req -config C:\OpenSSL\bin\openssl.conf -x509 -days 365 -newkey rsa:1024 -keyout hostkey.pem -nodes -out hostcert.pem
但是现在我在命令提示符中得到以下错误
error on line -1 of C:\OpenSSL\bin\openssl.conf
4220:error:02001002:system library:fopen:No such file or
directory:.\crypto\bio\bss_file.c:126:fopen('C:\OpenSSL\bin\openssl.conf','rb')
4220:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file.c:129:
4220:error:0E078072:configuration file routines:DEF_LOAD:no such file:.\crypto\conf\conf_def.c:197:
最佳答案
在 Windows 上,您还可以设置环境属性 OPENSSL_CONF
。例如,您可以从命令行输入:
set OPENSSL_CONF=c:/libs/openssl-0.9.8k/openssl.cnf
要验证它,您可以键入:
echo %OPENSSL_CONF%
您还可以将它设置为计算机环境变量的一部分,这样所有用户和服务都可以默认使用它。参见,例如,Environment variables in Windows NT和 How To Manage Environment Variables in Windows XP .
现在您无需传递配置位置参数即可运行 openssl 命令。
关于windows - OpenSSL 和读取 openssl.conf 文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7360602/