OpenSSL:如何创建一个空主题的证书?

时间:2014-09-26 11:22:27

标签: openssl

我需要生成带有空主题字段的证书。 我试过使用config:

[ req ]
default_bits                            = 1024                  # Size of keys
default_md                              = md5                           
algorithm
string_mask                             = nombstr               # permitted characters
#string_mask                            = pkix          # permitted characters
distinguished_name                      = req_distinguished_name
req_extensions                          = v3_req

[ policy_match ]
commonName              = optional
countryName             = optional
emailAddress            = optional

[ req_distinguished_name ]
# Variable name                         Prompt string
#-------------------------        ----------------------------------
0.organizationName                      = Organization Name (company)
organizationalUnitName                  = Organizational Unit Name (division)
localityName                            = Locality Name (city, district)
stateOrProvinceName                     = State or Province Name (full name)
countryName                             = Country Name (2 letter code)
commonName                              = Common Name (hostname, IP, or your name)
0.organizationName_default              = 
localityName_default                    = 
stateOrProvinceName_default             = 
countryName_default                     = 
emailAddress_default                    = 

[ v3_req ]
basicConstraints                        = CA:FALSE
subjectKeyIdentifier                    = hash
subjectAltName                          = critical,DNS:example3.com

但得到了:

Organization Name (company) []:
Organizational Unit Name (department, division) []:
Locality Name (city, district) []:
State or Province Name (full name) []:
Country Name (2 letter code) []:
Common Name (hostname, IP, or your name) []:
error, no objects specified in config file
problems making Certificate Request

我在这里发现了同样的问题:     https://superuser.com/questions/512673/openssl-how-to-create-a-certificate-with-an-empty-subject-dn

但没有解决方案。当我输入时只输入(空字段)我收到此错误: 错误,配置文件中没有指定对象

你可以帮忙吗?如何使用空主题名称生成CSR?

由于

2 个答案:

答案 0 :(得分:2)

我找到了解决此问题的方法并将其发布在原始链接中。看到 https://superuser.com/questions/512673/openssl-how-to-create-a-certificate-with-an-empty-subject-dn/944378#944378

答案 1 :(得分:0)

我发现,如果我至少在其中一个提示中输入了内容,就没有得到错误,并且创建了csr文件。

Country Name (2 letter code) []:US                        <-- only entered this
State or Province Name (full name) []:
Locality Name (eg, city) []:
Organization Name (eg, company) []:
Organizational Unit Name (eg, section) []: 
Common Name (eg, fully qualified host name) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: