问题描述
在cmd中执行
openssl req -new -key localhost.key -out localhost.csr
Can’t open C:\ci\openssl_1569593028961_h_env\Library/openssl.cnf for reading, No such file or directory
9372:error:02001003:system library:fopen:No such process:crypto\bio\bss_file.c:69:fopen(‘C:\ci\openssl_1569593028961_h_env\Library/openssl.cnf’,‘r’)
9372:error:2006D080:BIO routines:BIO_new_file:no such file:crypto\bio\bss_file.c:76:
unable to find ‘distinguished_name’ in config
problems making Certificate Request
9372:error:0E06D06A:configuration file routines:NCONF_get_string:no conf or environment variable:crypto\conf\conf_lib.c:270:
原因分析
问题产生的可能原因
路径中存在其他版本的openssl,尤其是anaconda目录
解决办法
重新下载openssl,使用绝对路径执行命令
& ‘C:\Program Files\OpenSSL-Win64\bin\openssl.exe’ genrsa -out server.key 2048
& ‘C:\Program Files\OpenSSL-Win64\bin\openssl.exe’ req -new -x509 -key server.key -out server.crt -days 3650 -subj “/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net”
最后的解决方式是,直接到OpenSSL安装目的bin下,执行命令。
参考文章
https://www.pudn.com/news/6228ca9c9ddf223e1ad0c72f.html