將推送證書轉(zhuǎn)成pem文件
$ openssl x509 -in aps_developer_push.cer -inform der -out PushCert.pem
將P12文件轉(zhuǎn)成pem文件
$ openssl pkcs12 -nocerts -out PushKey.pem -in PushKey.p12 Enter Import Password: <輸入你導(dǎo)出密鑰時(shí)用的那個(gè)密碼> MAC verified OK Enter PEM pass phrase: <輸入一個(gè)新的密碼> Verifying - Enter PEM pass phrase: <重復(fù)密碼>
合并兩個(gè)文件
$ cat PushCert.pem PushKey.pem > ck.pem
調(diào)試apns服務(wù)器
$ telnet gateway.sandbox.push.apple.com 2195 Trying 17.172.232.226... Connected to gateway.sandbox.push-apple.com.akadns.net. Escape character is '^]'.
測(cè)試證書是否有效
$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert PushCert.pem -key PushKey.pem Enter pass phrase for PushKey.pem: <輸入密碼>