makecert
然后按Enter键,然后发生此错误。
我尝试了提供的解决方案,但这对我没用。
ex:设置OPENSSL_CONF = c:/OpenSSL_Win64/bin/openssl.cnf
<pre>WARNING: can't open config file: ./bin/openssl.cnf
Unable to load config info from ./bin/openssl.cnf
WARNING: can't open config file: ./bin/openssl.cnf
Error opening Private Key privkey.pem
5344:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\
bss_file.c:398:fopen('privkey.pem','rb')
5344:error:20074002:BIO routines:FILE_CTRL:system lib:.\crypto\bio\bss_file.c:40
0:
unable to load Private Key
WARNING: can't open config file: ./bin/openssl.cnf
Loading 'screen' into random state - done
server.csr: No such file or directory
Could Not Find C:\xampp\apache\.rnd
Could Not Find C:\xampp\apache\privkey.pem
Could Not Find C:\xampp\apache\server.csr
The system cannot find the file specified.
The system cannot find the file specified.
-----
Das Zertifikat wurde erstellt.
The certificate was provided.</pre>
答案 0 :(得分:6)
当您使用OpenSSL软件包或the Windows installer时,此错误主要发生在Windows计算机上!
原因是 OpenSSL 无法找到 openssl.cnf 文件!
我建议您执行以下操作(仅限Windows):
以管理员打开命令提示符(少数OpenSSL命令以随机状态打开),因此当OpenSSL尝试在磁盘上写入内容时,它会失败。
现在,在运行任何OpenSSL命令之前,请输入以下内容:
set OPENSSL_CONF=c:\[PATH TO YOUR OPENSSL DIRECTORY]\bin\openssl.cfg
C:\OpenSSL-Win32\bin\openssl.cfg
。对于Windows(x64位),请使用C:\OpenSSL-Win64\bin\openssl.cfg
!现在这样做之后你就可以使用你的OpenSSL了。试试openssl version
,错误就消失了。
请记住,每次打开命令提示符时都必须运行上面的命令,除非将其设置为环境变量。
你的问题可能是:
OpenSSL_Win64
文件夹。应该是 OpenSSL-Win64
!openssl.cnf
,但必须 openssl.cfg
!另请阅读:
答案 1 :(得分:2)
在正确的位置手动创建 openssl.cnf 文件可以解决问题。
Here是一个文件模板(根据需要进行编辑):
#
# 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
答案 2 :(得分:0)
在安装应用程序penSSL_Win64时,它将位于C:\ Program Files \ OpenSSL-Win64 so中,因此您需要使用控制台命令将此路径设置为以下路径并编写: 设置OPENSSL_CONF = C:\ Program Files \ OpenSSL-Win64 \ bin \ openssl.cfg