Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • http://blog.boxedice.com/2010/06/05/how-to-renew-your-apple-push-notification-push-ssl-certificate/
  • http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/
  • http://code.google.com/p/apns-sharp/wiki/HowToCreatePKCS12Certificate
  • http://wiki.cs.unh.edu/wiki/index.php/Using_the_Apple_Push_Notification_Service

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
like image 480
zkwentz Avatar asked Jul 04 '11 22:07

zkwentz


1 Answers

(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.

like image 130
AppAspect Avatar answered Oct 06 '22 09:10

AppAspect