找不到 openSSL 配置文件 distinguished_name

openSSL config file cannot find distinguished_name

我正在尝试在 Ubuntu 中创建配置文件以创建自签名证书,但是当我尝试创建证书密钥时出现以下错误:

这是 vim 编辑器中的实际配置,您可以在其中看到它确实有一个专有名称,所以我怀疑真正的错误是第 1 行出了什么问题——但正如您所看到的,第一行只是评论?

您的 [ req ] 部分似乎缺少 distinguished_name 部分。编辑:我看到你有它,它只是指向错误或不存在的部分。请参阅下面的内容,了解我自己的配置文件中的内容。

[ req ]
# Options for the `req` tool (`man req`).
default_bits        = 4096
distinguished_name  = req_distinguished_name
string_mask         = utf8only

# SHA-1 is deprecated, so use SHA-2 instead.
default_md          = sha256

# Extension to add when the -x509 option is used.
x509_extensions     = v3_ca

[ req_distinguished_name ]
# See <https://en.wikipedia.org/wiki/Certificate_signing_request>.
# See <https://en.wikipedia.org/wiki/Certificate_signing_request>.
countryName                     = Country Name (2 letter code)
stateOrProvinceName             = State or Province Name
localityName                    = Locality Name
0.organizationName              = Organization Name
organizationalUnitName          = Organizational Unit Name
commonName                      = Common Name
emailAddress                    = Email Address

根据您的情况,我认为您需要将以下内容插入 [ req ] 部分:

distinguished_name  = root_ca_distinguished_name