无法从 Windows 上的 /usr/local/ssl/openssl.cnf 加载配置信息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14459078/
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 10:12:45  来源:igfitidea点击:

Unable to load config info from /usr/local/ssl/openssl.cnf on Windows

windowsopensslpublic-key-encryption

提问by karthik

While using OpenSSL on Windows:

在 Windows 上使用 OpenSSL 时:

openssl genrsa -out privatekey.pem 1024 -->

openssl genrsa -out privatekey.pem 1024 -->

Created successfully

创建成功

openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 365 
---->

Showing error message as

将错误消息显示为

unable to load config info from /usr/local/ssl/openssl.cnf

无法从 /usr/local/ssl/openssl.cnf 加载配置信息

回答by lame_coder

After installing OpenSSL I was required to create a new environment variable:

安装 OpenSSL 后,我需要创建一个新的环境变量:

  • Name: OPENSSL_CONF
  • Value: C:\Program Files\OpenSSL\openssl.cnf
  • 姓名: OPENSSL_CONF
  • 价值: C:\Program Files\OpenSSL\openssl.cnf

In powershell:

在 PowerShell 中:

$env:OPENSSL_CONF = "${env:ProgramFiles}\OpenSSL\openssl.cnf"

This value differs from previous installation versions (as seen in a previous edit of this post). Also, don't forget to add the openssl binary folder ${env:ProgramFiles}\OpenSSLto your Path.

此值与以前的安装版本不同(如本文的先前编辑所示)。另外,不要忘记将 openssl 二进制文件夹添加${env:ProgramFiles}\OpenSSL到您的路径中。

回答by zombi_man

You should specify the absolute path to the config, something like this:

您应该指定配置的绝对路径,如下所示:

openssl req -x509 -config "C:\OpenSSL-Win64\bin\openssl.cnf" ...

回答by BlackPearl

In Windows 10, no need to restart nor run in Administrator's mode but instead set openssl config like so:

在 Windows 10 中,无需重新启动或以管理员模式运行,而是像这样设置 openssl 配置:

set OPENSSL_CONF=C:\Program Files (x86)\GnuWin32\share\openssl.cnf

Of course, if you are using GnuWin32

当然,如果你正在使用 GnuWin32

回答by mavis

In windows , [Similar scenario]

在 windows 中,[类似场景]

I was facing the same problem But It was during requesting for Certificate Signing Request.

我遇到了同样的问题,但它是在请求证书签名请求期间。

I did the below , It Worked for me.

我做了以下,它对我有用。

Once OpenSSL installed, Ran command prompt as administrator after the system reboot.[for the best I did both.. run as admin and system reboot]

安装 OpenSSL 后,在系统重新启动后以管理员身份运行命令提示符。

did, 1.[Error Case]

确实,1.[错误案例]

C:\OpenSSL-Win64\bin>openssl req -new -key server.key -out server.csr

WARNING: can't open config file: C:\OpenSSL-Win64\bin\openssl.cnf AND Unable to load config info from C:\OpenSSL-Win64\bin\openssl.cnf

警告:无法打开配置文件:C:\OpenSSL-Win64\bin\openssl.cnf 并且无法从 C:\OpenSSL-Win64\bin\openssl.cnf 加载配置信息

2.[Worked with Warning]

2.[使用警告]

C:\OpenSSL-Win64\bin> openssl req -new -key server.key -out server.csr -config C:\OpenSSL-Win64\bin\openssl.cfg

[Warning message]: WARNING: can't open config file: C:\OpenSSL-Win64\bin\openssl.cnf

[警告信息]:警告:无法打开配置文件:C:\OpenSSL-Win64\bin\openssl.cnf

But prompted me for the Pass Phrasefor server.key It workedfor me.

但促使我的密码短语为server.key它的工作对我来说。

I referred,This linkfor my assistance.

我提到了,这个链接是为了我的帮助。

Thank you.

谢谢你。

回答by simhumileco

The onlything that worked for me in this situation was the self-createdopenssl.cnffile.

在这种情况下,唯一对我有用的自创建的openssl.cnf文件

Here are the basics needed for this exercise (edit as needed):

以下是此练习所需的基础知识(根据需要进行编辑):

#
# OpenSSL configuration file.
#

# Establish working directory.

dir                         = .

[ ca ]
default_ca                  = CA_default

[ CA_default ]
serial                      = $dir/serial
database                    = $dir/certindex.txt
new_certs_dir               = $dir/certs
certificate                 = $dir/cacert.pem
private_key                 = $dir/private/cakey.pem
default_days                = 365
default_md                  = md5
preserve                    = no
email_in_dn                 = no
nameopt                     = default_ca
certopt                     = default_ca
policy                      = policy_match

[ policy_match ]
countryName                 = match
stateOrProvinceName         = match
organizationName            = match
organizationalUnitName      = optional
commonName                  = supplied
emailAddress                = optional

[ req ]
default_bits                = 1024          # Size of keys
default_keyfile             = key.pem       # name of generated keys
default_md                  = md5               # message digest algorithm
string_mask                 = nombstr       # permitted characters
distinguished_name          = req_distinguished_name
req_extensions              = v3_req

[ req_distinguished_name ]
# Variable name             Prompt string
#-------------------------    ----------------------------------
0.organizationName          = Organization Name (company)
organizationalUnitName      = Organizational Unit Name (department, division)
emailAddress                = Email Address
emailAddress_max            = 40
localityName                = Locality Name (city, district)
stateOrProvinceName         = State or Province Name (full name)
countryName                 = Country Name (2 letter code)
countryName_min             = 2
countryName_max             = 2
commonName                  = Common Name (hostname, IP, or your name)
commonName_max              = 64

# Default values for the above, for consistency and less typing.
# Variable name             Value
#------------------------     ------------------------------
0.organizationName_default  = My Company
localityName_default        = My Town
stateOrProvinceName_default = State or Providence
countryName_default         = US

[ v3_ca ]
basicConstraints            = CA:TRUE
subjectKeyIdentifier        = hash
authorityKeyIdentifier      = keyid:always,issuer:always

[ v3_req ]
basicConstraints            = CA:FALSE
subjectKeyIdentifier        = hash

I hope that helps.

我希望这有帮助。

回答by karthik

After installing OpenSSL, you need to restart your computer and use Run As Administrator. Then its works.

安装 OpenSSL 后,您需要重新启动计算机并使用Run As Administrator. 然后它的作品。

回答by T L

With the GnuWin32 tools I found the openssl.cnf under C:\gnuwin32\share

使用 GnuWin32 工具,我在 C:\gnuwin32\share 下找到了 openssl.cnf

set OPENSSL_CONF=C:\gnuwin32\share\openssl.cnf

回答by Ali

For me on Windows 8, I simply found openssl.cnf file and copied it on the C drive. then:

对于我在 Windows 8 上,我只是找到 openssl.cnf 文件并将其复制到 C 驱动器上。然后:

openssl req -new -key server.key -out server.csr -config C:\openssl.cnf

Worked perfectly.

完美地工作。

回答by Calgary Libertarian

In Windows 7 I didn't have to restart, simply run command prompt in administrator mode.

在 Windows 7 中,我不必重新启动,只需在管理员模式下运行命令提示符即可。

回答by Sunil Garg

In my case, I need to set the path of openssl.cnffile manually on the command using configoption. So the command

就我而言,我需要使用选项在命令上手动设置openssl.cnf文件的路径config。所以命令

openssl req -x509 -config "C:\Users\sk\Downloads\openssl-0.9.8k_X64\openssl.cnf" -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 900