OpenSSL 驗證使用 CA 簽章憑證失敗,但使用自簽章憑證失敗?

OpenSSL 驗證使用 CA 簽章憑證失敗,但使用自簽章憑證失敗?

首先,我知道有很多相關的問題,但似乎大多數都是由於伺服器上缺少頒發者憑證造成的。

我一直在關注本指南啟用 SSL 用戶端身份驗證,但我一直堅持讓 Apache 接受客戶端憑證。經過仔細檢查,Apache 日誌中充滿了Certificate Verification: Error (20): unable to get local issuer certificate訊息。

我使用 CA 給我的憑證和我的私鑰作為 CA。

為了進一步診斷問題,我運行openssl verify -CAfile ca.cert client_signed.crt並得到了相同的錯誤。

我決定重做所有步驟。但是,從命令列執行所有操作仍然會傳回相同的錯誤

$ openssl x509 -req -days 360 -in client.csr -CA ca.cert -CAkey ca.key -CAcreateserial -out client_signed.crt
Signature ok
subject= ...
Getting CA Private Key
Enter pass phrase for server.key:
[I type in the password and press ENTER]
$ openssl verify -CAfile ca.cert client_signed.crt
[ .. ]
error 20 at 0 depth lookup:unable to get local issuer certificate
$ ls ca.cert
ca.cert

為了全面診斷問題,我決定產生並自簽署證書,用作 CA 來簽署客戶端證書。出乎我的意料,這完美地工作了。這實際上是我連結的教程的第一步。

顯然,這個問題與我的證書有關。我懷疑一定有與信任鏈相關的東西,因為我沒有簽署我自己的憑證的 CA 的憑證。我嘗試下載它們從他們的網站但我什至無法驗證我自己的證書。

$ ls /path/to/downloaded/files/
acrn.cer  ancca.crt  CorreoUruguayoCA.crt  CorreoUruguayoRootCA.crt
$ openssl verify -CApath /path/to/downloaded/files/ my.cert
error 20 at 0 depth lookup:unable to get local issuer certificate

任何幫助將不勝感激。

編輯:在 Ubuntu 上使用“查看文件”實用程式表明我的證書已是Verified by: Correo Uruguayo - CA.我不確定為什麼 openssl 無法驗證它。

相關內容