使用openssl
,我創建了一個私有密鑰如下:創建.p12文件
openssl genrsa -out myKey.pem
然後,生成由CA要求的csr
,我執行以下操作:
openssl req -new -key myKey.pem -out cert.csr
CA的迴應,這是我保存在一個文件名爲證書myCert.cer
我現在想捆綁必要的組件(私鑰,公鑰(?)和證書證書)成一個單一的.p12
。要做到這一點,我運行以下命令:
openssl pkcs12 -export -out keyStore.p12 -inkey myKey.pem -in myCert.cer
但我發現了以下錯誤消息:
No certificate matches private key
我怎樣才能做到這一點?
順便說一句,如果有人想籤'cert.csr '他自己,那麼可以使用'openssl x509 -req -in cert.csr -signkey key.pem -out cert.crt',然後'openssl pkcs12 -export -in cert.crt -inkey key.pem -out cert.p12 '。無需使用答案中的附加命令。 – Tom
@Tom謝謝,您的評論解決了我的問題。 –