Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
376 views
in Technique[技术] by (71.8m points)

iphone - Apple Push Notifications, how do I properly export my cert?

I can't seem to figure out how to properly export my cert for use in my iOS app with push notifications. I'm using the following cert, downloaded from the Certificates section of the iOS Provisioning Portal.

enter image description here

I'm then following one of the many tutorials I've found all over the web that are all different by the way, to get my cert into a .pem format for use in ruby-apns.

First I export it from the Keychain:

enter image description here

After I give it a name and a password I perform the following commands in the terminal*:

openssl pkcs12 -in cert.p12 -out apple_push_notification_dev.pem -nodes -clcerts

*note: this isn't the only way I've tried this, just the latest, I have also tried via the instructions at the following urls:

Not a single one of these solutions work. I'm sitting here looking at the following error from the console when I try to use ruby-apns:

read finished A: sslv3 alert certificate unknown (OpenSSL::SSL::SSLError)

And essentially every other server solution I've found has told me my certificate is incorrect or that there's a problem with it as well.

Am I doing this wrong?

===============================

Overnight Courtesy Bump Stealth Edit

So I beat my head against the wall last night, and actually came across Apple's own instructions for doing this. It's almost the exact same, and I tried it to the same tune. Nevertheless, here is the latest attempt from this link:

openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

(1) First you need to set the configuration for your app ID to enable push notification service. You can check in the image. enter image description here

(2) Then You can install the certificate and intall in your keychain in your machine. enter image description here

(3) Here you are exporting two files. Instead of that you just need to export the private key as shown in the screenshot. enter image description here

(4) Now you can export the private key and store with any name you want in .p12 format as shown in the screenshot below. enter image description here

(5) Then follows all other steps as you know very well like you mentioned above.

openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes

Please let me know if you still have any question or if you are not able to solve then let me know.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...