且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 iphone 中为推送通知生成 pem 文件?

更新时间:2022-10-26 21:46:32

finally i sloved generate push notification certifcates

complete step for generate push notification certificates.....

1) open key chain and request certificate show in below image.

2) change common name as your project_name.

3) in keychain open key you can show two key public and private

4) write click on private key and export it.

5) make name project_name_key.p12

6) add password ex-1234

7) enter system login password and save it. now you have following certificates.

8) now goto developer account (https://developer.apple.com/devcenter/ios/index.action) and goto identifier create new if not exits. and edit setting.

if push notification disable then enable it from edit.

9) for development you can create first one and distribution you can select last one.

10) after select and generate download apns certificate and put into desktop and double click on it.

11) then open key chain and goto certificates. and you can show your push service open then you show private key.

export it with 1234 password.

12) now you have following file.

13) open terminal and goto desktop.

14) generate .pem file using following line for push_cert.p12 file

openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in push_cert.p12

then enter password:-1234

15) generate .pem file using following line for project_name_key.p12 file

openssl pkcs12 -nocerts -out apns-dev-key.pem -in project_name_key.p12

then enter password:-1234 Enter PEM pass phrase:1234 Verifying - Enter PEM pass phrase:1234

16) enter following 3 line in terminal

openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem

Enter pass phrase for apns-dev-key.pem:1234

cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem

17) you have following certificate.

18) apns-dev.pem file send on server and it pass is 1234

19) for development you must use gateway.sandbox.push.apple.com server. and distribution you can use gateway.push.apple.com server.