1、準(zhǔn)備OpenSSL
訪問:http://slproweb.com/products/Win32OpenSSL.html?。并下載Win32 OpenSSL v1.0.1c Light版本(注意:版本可能會(huì)升級(jí)),如果您運(yùn)行OpenSSL有問題,還需要下載Visual C++ 2008 Redistributables安裝。
安裝OpenSSL完畢后,默認(rèn)在C盤的OpenSSL-Win32。
2、生成CSR請求文件
進(jìn)入Windows的命令行(WIN+R,進(jìn)入運(yùn)行)。開始輸入各個(gè)命令.
cd C:\OpenSSL-Win32\bin\
set RANDFILE=.rnd
set OPENSSL_CONF=C:\OpenSSL-Win32\bin\openssl.cfg
openssl genrsa -out my.key 2048
openssl req -new -key my.key -out my.certSigningRequest -subj "/emailAddress=myemail@sample.com,CN=Common Name,C=CN"
注意:myemail@sample.com 為郵箱地址
3、獲取CER證書
將生成的certSigningRequest文件上傳到Apple的開發(fā)者相關(guān)頁面(例如開發(fā)者證書、推送證書等)https://developer.apple.com/ios/manage/certificates/team/distribute.action

將最后生成的cer文件改個(gè)名字后放到C:\OpenSSL-Win32\bin\目錄中,和之前生成的文件放在一起。?
導(dǎo)出p12文件
P12文件包含了證書的密鑰和公鑰,可以方便遷移到其他電腦上。 最后在剛才的環(huán)境中運(yùn)行命令行(如果之前命令行窗口被關(guān)了,還是要重新執(zhí)行一遍開始的幾條set環(huán)境配置命令):
openssl x509 -in my.cer -inform DER -out my.pem -outform PEM
openssl pkcs12 -export -inkey my.key -in my.pem -out my.p12 -password pass:111111
這樣就生成了密碼為111111,文件名為my.p12的密鑰文件。