古詩詞大全網 - 藝術簽名 - 如何生成自簽名雙向認證證書 ssl

如何生成自簽名雙向認證證書 ssl

1.創建CA私鑰: ca.key

2.創建根證書請求文件ca.csr:

這裏需要填入配置信息:

3.自簽根證書ca.cer:

4.這壹步可做可不做生成p12格式根證書ca.p12(密碼填寫123456,之前ca.csr的密碼,ps:這裏輸入的時候是不可見的輸入完成後回車即可)

5.生成服務端私鑰key server.key:

6.生成服務端請求文件 server.csr

填入證書配置信息:

server.csr

7.生成服務端證書server.cer(ca.cer,ca.key,servr.key,server.csr這4個生成服務端證書):

8.生成客戶端key client.key:

9.生成客戶端請求文件client.csr:

填入證書配置信息:

10.生成客戶端證書 client.cer:

11.可做可不做生成客戶端p12格式根證書client.p12(密碼設置123456):

至此,證書就制作完畢了:

原因:請求沒有帶上ca證書,無法校驗服務器的證書?

解決方法1:

curl?加上-cacert ca證書 校驗服務器證書

解決方法2:

curl 加上-k 可以不校驗服務器證書。

網上給出的答復是:

Whatever method you use to generate the certificate and key files, the Common Name value used for the server and client certificates/keys must each differ from the Common Name value used for the CA certificate. Otherwise, the certificate and key files will not work for servers compiled using OpenSSL.

When OpenSSL prompts you for the Common Name for each certificate, use different names.

解決方案:

參考文檔鏈接:/p/094c7fc8cb85,感謝作者CQ_TYL