Openssl

我無法讓 OpenSSL 簽署證書請求

  • August 22, 2021

我在 Windows 10 上使用 OpenSSL 1.1.1k 25 Mar 2021(原始碼)。我正在關注此幫助頁面以嘗試使用 RabbitMQ tls

‘c:\OpenSSL\x64\bin’ 是我路徑的一部分。

openssl.cnf在工作目錄中的文件:

[ ca ]
default_ca = testca

[ testca ]
dir = .
certificate = $dir/ca_certificate.pem
database = $dir/index.txt
new_certs_dir = $dir/certs
private_key = $dir/private/ca_private_key.pem
serial = $dir/serial

default_crl_days = 7
default_days = 365
default_md = sha256

policy = testca_policy
x509_extensions = certificate_extensions

[ testca_policy ]
commonName = supplied
stateOrProvinceName = optional
countryName = optional
emailAddress = optional
organizationName = optional
organizationalUnitName = optional
domainComponent = optional

[ certificate_extensions ]
basicConstraints = CA:false

[ req ]
default_bits = 2048
default_keyfile = ./private/ca_private_key.pem
default_md = sha256
prompt = yes
distinguished_name = root_ca_distinguished_name
x509_extensions = root_ca_extensions

[ root_ca_distinguished_name ]
commonName = hostname

[ root_ca_extensions ]
basicConstraints = CA:true
keyUsage = keyCertSign, cRLSign

[ client_ca_extensions ]
basicConstraints = CA:false
keyUsage = digitalSignature,keyEncipherment
extendedKeyUsage = 1.3.6.1.5.5.7.3.2

[ server_ca_extensions ]
basicConstraints = CA:false
keyUsage = digitalSignature,keyEncipherment
extendedKeyUsage = 1.3.6.1.5.5.7.3.1

到目前為止,一切都已經奏效。當我輸入 ‘openssl ca -config openssl.cnf -in ..\server\req.pem -out server_certificate.pem -notext -batch -extensions server_ca_extensions -verbose’ 我什麼也沒得到。在我能找到的任何地方都沒有“server_certificate.pem”。也沒有錯誤資訊。

任何診斷此問題的幫助將不勝感激。

更新

我現在嘗試了不同的發行版(也更新了我的路徑),結果相同。我什至嘗試將/openssl.cnf 中的所有內容替換為\\.

好的,我applogize。這是我的錯誤。我用記事本創建了 index.txt。我需要做的是:copy nul index.txt。在那之後,一切都奏效了。

引用自:https://serverfault.com/questions/1075275