Windows의 /usr/local/ssl/openssl.cnf에서 구성 정보를로드 할 수 없습니다
Windows에서 OpenSSL을 사용하는 동안 :
openssl genrsa -out privatekey.pem 1024 -->
성공적으로 생성
openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 365
---->
다음과 같은 오류 메시지 표시
/usr/local/ssl/openssl.cnf에서 구성 정보를로드 할 수 없습니다
OpenSSL을 설치 한 후 새로운 환경 변수를 만들어야했습니다.
- 이름:
OPENSSL_CONF
- 값:
C:\Program Files\OpenSSL\openssl.cnf
Powershell에서 :
$env:OPENSSL_CONF = "${env:ProgramFiles}\OpenSSL\openssl.cnf"
이 값은 이전 설치 버전과 다릅니다 (이 게시물의 이전 편집에서 볼 수 있음). 또한 openssl 바이너리 폴더 ${env:ProgramFiles}\OpenSSL
를 Path 에 추가하는 것을 잊지 마십시오 .
다음과 같이 구성의 절대 경로를 지정해야합니다.
openssl req -x509 -config "C:\OpenSSL-Win64\bin\openssl.cnf" ...
Windows 10에서는 관리자 모드에서 다시 시작하거나 실행할 필요가 없지만 openssl 구성을 다음과 같이 설정하십시오.
set OPENSSL_CONF=C:\Program Files (x86)\GnuWin32\share\openssl.cnf
물론 사용하고 있다면 GnuWin32
창에서 [ 유사한 시나리오 ]
같은 문제에 직면했지만 인증서 서명 요청을 요청하는 중이었습니다.
나는 아래를했다, 그것은 나를 위해 일했다.
OpenSSL이 설치되면 시스템을 재부팅 한 후 관리자 권한으로 명령 프롬프트를 실행합니다. [내가 최선을 다하려면 관리자와 시스템 재부팅으로 실행]
1. [오류 사례]
C:\OpenSSL-Win64\bin>openssl req -new -key server.key -out server.csr
경고 : 구성 파일을 열 수 없습니다 : C : \ OpenSSL-Win64 \ bin \ openssl.cnf 및 C : \ OpenSSL-Win64 \ bin \ openssl.cnf에서 구성 정보를로드 할 수 없습니다
2. [경고 작업]
C:\OpenSSL-Win64\bin> openssl req -new -key server.key -out server.csr -config C:\OpenSSL-Win64\bin\openssl.cfg
[경고 메시지] : 경고 : 구성 파일을 열 수 없습니다 : C : \ OpenSSL-Win64 \ bin \ openssl.cnf
하지만 저를 묻는 메시지가 전달 구 그것은은 server.key을 위해 일을 나를 위해.
나는이 링크 를 통해 도움을 받았다.
감사합니다.
만 이 상황에서 나를 위해 일한 것은이었다 자기가 만든 openssl.cnf의 파일 .
이 연습에 필요한 기본 사항은 다음과 같습니다 (필요에 따라 편집).
#
# 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
도움이 되길 바랍니다.
OpenSSL을 설치 한 후 컴퓨터를 다시 시작하고을 사용해야 Run As Administrator
합니다. 그런 다음 작동합니다.
GnuWin32 도구를 사용하여 C : \ gnuwin32 \ share에서 openssl.cnf를 찾았습니다.
set OPENSSL_CONF=C:\gnuwin32\share\openssl.cnf
Windows 8의 경우 openssl.cnf 파일을 찾아 C 드라이브에 복사했습니다. 그때:
openssl req -new -key server.key -out server.csr -config C:\openssl.cnf
완벽하게 작동했습니다.
Windows 7에서는 다시 시작할 필요가 없었으며 단순히 관리자 모드에서 명령 프롬프트를 실행하십시오.
필자의 경우 옵션을 사용하여 명령에서 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
If you're using Win32 OpenSSL v1.1.0g, setting up this environment variable:
set OPENSSL_CONF=C:\OpenSSL-Win32\bin\cnf\openssl.cnf
Before running this command with "server.key", successfully creating "server.csr":
openssl req -new -key server.key -out server.csr
For me put variable before calling did the trick:
OPENSSL_CONF=/usr/ssl/openssl.cnf openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 365
On the basic question of why openssl is not found: Short answer:Some installation packages for openssl have a default openssl.cnf pre-included. Other packages do not. In the latter case you will include one from the link shown below; You can enter additional user-specifics --DN name,etc-- as needed.
From https://www.openssl.org/docs/manmaster/man5/config.html,I quote directly:
"OPENSSL LIBRARY CONFIGURATION
Applications can automatically configure certain aspects of OpenSSL using the master OpenSSL configuration file, or optionally an alternative configuration file. The openssl utility includes this functionality: any sub command uses the master OpenSSL configuration file unless an option is used in the sub command to use an alternative configuration file.
To enable library configuration the default section needs to contain an appropriate line which points to the main configuration section. The default name is openssl_conf which is used by the openssl utility. Other applications may use an alternative name such as myapplication_conf. All library configuration lines appear in the default section at the start of the configuration file.
The configuration section should consist of a set of name value pairs which contain specific module configuration information. The name represents the name of the configuration module. The meaning of the value is module specific: it may, for example, represent a further configuration section containing configuration module specific information. E.g.:"
So it appears one must self configure openssl.cnf according to your Distinguished Name (DN), along with other entries specific to your use.
Here is the template file from which you can generate openssl.cnf with your specific entries.
One Application actually has a demo installation that includes a demo .cnf file.
Additionally, if you need to programmatically access .cnf files, you can include appropriate headers --openssl/conf.h-- and parse your .cnf files using
CONF_modules_load_file(const char *filename, const char *appname,
unsigned long flags);
Here are docs for "CONF_modules_load_file";
'IT story' 카테고리의 다른 글
서비스로서의 스프링 부트 어플리케이션 (0) | 2020.05.24 |
---|---|
PHP에서 "include"와 "require"의 차이점 (0) | 2020.05.24 |
꼬리와 비슷한 파이썬으로 파일의 마지막 n 줄 가져 오기 (0) | 2020.05.24 |
파이썬에서 목록을 사전으로 변환 (0) | 2020.05.24 |
C #의 "정적 방법"은 무엇입니까? (0) | 2020.05.24 |