将推送证书转成pem文件
$ openssl x509 -in aps_developer_push.cer -inform der -out PushCert.pem
将P12文件转成pem文件
$ openssl pkcs12 -nocerts -out PushKey.pem -in PushKey.p12 Enter Import Password: <输入你导出密钥时用的那个密码> MAC verified OK Enter PEM pass phrase: <输入一个新的密码> Verifying - Enter PEM pass phrase: <重复密码>
合并两个文件
$ cat PushCert.pem PushKey.pem > ck.pem
调试apns服务器
$ telnet gateway.sandbox.push.apple.com 2195 Trying 17.172.232.226... Connected to gateway.sandbox.push-apple.com.akadns.net. Escape character is '^]'.
测试证书是否有效
$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert PushCert.pem -key PushKey.pem Enter pass phrase for PushKey.pem: <输入密码>