转载自:http://zhang8mss.blog.163.com/blog/static/1104637562012260250222/
生成p12需要3个文件:
1,本机在https://developer.apple.com/ios/manage/certificates/team/index.action生成certifacates时上传的本机证书:CertificateSigningRequest.certSigningRequest
2,从https://developer.apple.com/ios/manage/overview/index.action的app IDs里拿到的Push SSL Certificate,命名为:aps.cer
3,在本机双击aps.cer会自动加载到本机的Keychain中,在keychain中找到该证书,展开,导出其下的private key为:key.p12
将以上3个文件放在同一个文件夹中,并用terminal打开,一次输入下面命令(需要输入密码时均填写123456):
1,openssl x509 -in aps.cer -inform DER -out aps.pem -outform PEM
2,openssl pkcs12 -nocerts -out key.pem -in key.p12
3,openssl pkcs12 -export -in aps.pem -inkey key.pem -certfile CertificateSigningRequest.certSigningRequest -name "push" -out push.p12