2013-10-23 87 views
3

我已經成功地生成.p12文件,但我得到了這是一個如下的消息相匹配的私鑰:沒有證書而產生.p12文件

C:\OpenSSL-Win32\bin>openssl pkcs12 -export -inkey mykey.key -in exported.pem -out myfile.p12 

載入「屏幕」爲隨機狀態 - 做 沒有證書相匹配私鑰

任何人都可以告訴我這是什麼錯誤嗎?

另外,文件myfile.p12是0KB,當我試圖打開它,我得到了與OK按鈕的小窗口下面的消息的大小:

`無效的公鑰安全對象文件

此文件無效,如下所示:個人信息交換'

請澄清。

感謝

+0

我需要選擇導出爲Base64讓它按照以下文檔工作HTTP:// WWW .markbrilman.nl/2012/07/openssl-error-no-certificate-matches-private-key-when-creating-pfx/ – Jack

+0

嗯,我確實導出到BASE64,但仍然收到相同的錯誤。仍然想知道可能是什麼問題。唯一的區別是證書以PEM格式導出。 來源:http://www.markbrilman.nl/2012/07/openssl-error-no-certificate-matches-private-key-when-creating-pfx/ – Jack

回答

1

Source

OpenSSL的說,當該證書是DER編碼沒有證書相匹配的私鑰。只需在創建PKCS#12之前將其更改爲PEM編碼。

  1. 創建密鑰對openssl genrsa -out aps_development.key 2048

  2. 創建CSRopenssl req -new -sha256 -key aps_development.key -out aps_development.csr

  3. 上傳CSR到開發者門戶拿到證書aps_development.cer

  4. 轉換日Ë證書openssl x509 -inform DER -outform PEM -in aps_development.cer -out aps_development.pem

  5. 構建PKCS#12openssl pkcs12 -inkey aps_development.key -in aps_development.pem -export -out aps_development.p12