Installing the SSL Certificate and Key on the Server
You should install the SSL distribution certificate and private
cryptographic key you obtained earlier on the server computer on which
the provider code runs and from which it connects with the sandBox or
production versions of APNs. To do so,complete the following steps:
Open Keychain Access utility and click the My Certificates category in the left pane.
Find the certificate you want to install and disclose its contents.
You’ll see both a certificate and a private key.Select both the certificate and key,choose File > Export Items,and export them as a Personal Information Exchange (.p12) file.
Servers implemented in languages such as Ruby and Perl often are better able to deal with certificates in the Personal Information
Exchange format. To convert the certificate to this format,complete
the following steps:
In KeyChain Access,select the certificate and choose File > Export Items. Select the Personal Information Exchange (.p12) option,
select a save location,and click Save.Launch the Terminal application and enter the following command after the prompt: openssl pkcs12 -in CertificateName.p12 -out
CertificateName.pem -nodes.Copy the .pem certificate to the new computer and install it in the appropriate place.
解决方法
1)打开钥匙链,请求证件显示在下图中.
2)将常用名称更改为您的project_name.
3)在钥匙扣开钥匙你可以显示两个关键的公共和私人
4)写点击私钥并导出.
5)make name project_name_key.p12
6)添加密码ex-1234
7)输入系统登录密码并保存.现在你有以下证书.
8)现在goto开发者帐户(https://developer.apple.com/devcenter/ios/index.action),并且goto标识符创建新的,如果不退出.并编辑设置.
如果推送通知禁用,然后启用它从编辑.
9)为了开发,你可以创建第一个,发行版可以选择最后一个.
10)选择并生成下载apns证书后放入桌面并双击.
11)然后打开钥匙链和goto证书.您可以显示您的推送服务打开,然后显示私钥.
用1234密码导出.
12)现在你有以下文件.
13)打开终端和goto桌面.
14)使用push_cert.p12文件的以下行生成.pem文件
openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in push_cert.p12
然后输入密码:-1234
15)使用project_name_key.p12文件的以下行生成.pem文件
openssl pkcs12 -nocerts -out apns-dev-key.pem -in project_name_key.p12
然后输入密码:-1234
输入PEM密码:1234
验证 – 输入PEM密码:1234
16)在终端中输入以下3行
openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
输入apns-dev-key.pem的密码:1234
cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem
17)你有以下证书
18)apns-dev.pem文件在服务器上发送,通过为1234
19)为了开发,你必须使用gateway.sandBox.push.apple.com服务器.并分发您可以使用gateway.push.apple.com服务器.