Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate valid APNS Certificate (.p12) for use in GCM for iOS?

I am trying Google Cloud Messaging sample app for iOS platform. https://developers.google.com/cloud-messaging/ios/start

To generate GoogleServices-Info.plist APNS development and production certificates are needed (PKCS#12 file format). I have created .p12 file in MAC KeyChain Access (bundling both APNS dev certificate and private key).

But when uploading the .p12 file, it says it is not in valid format (The certificate must be a valid PKCS12 file).

like image 265
rajkumar Avatar asked Jun 02 '15 17:06

rajkumar


People also ask

How can I get certificate .p12 file?

How to open a P12 file. To install a p12 key on a Windows or Mac PC, simply double-click the file. The Certificate Import Wizard (Windows) or Add Certificates Wizard (Mac) will appear to guide you through installing the key.


3 Answers

Here's my solution, without the terminal !

  • delete your actual certificate ( in Keychain ) : "Apple Development IOS Push Service" & "Apple Production IOS Push Service"

  • Go to Apple Developer, Identifiers, App IDs, Select "YourApp", Edit, Push Notification and download the 2 certificates (dev & prod)

enter image description here

enter image description here

  • import these 2 certificates in Keychain

  • in Keychain, go to "My Certificates", find the "Apple Development IOS Push Service" & "Apple Production IOS Push Service", click on the arrow to expand the Certificate + Key

  • Select both the the Certificate + Key, Right click "Export 2 items", you have your .p12 valid certificate ready for upload to GCM Services

enter image description here

enter image description here

This link helped me : http://faq.appaloosa-store.com/knowledgebase/articles/61785-how-to-generate-push-notification-p12-file

like image 160
dam1 Avatar answered Oct 17 '22 06:10

dam1


For anyone still having this issue, the solution for me was to not select both the key and the certificate for export - rather just export the certificate which ALREADY includes the key.

like image 42
Jessicardo Avatar answered Oct 17 '22 04:10

Jessicardo


you can select only one also to export in .p12 format..

macApplication > Keychain Access > My Certificates > Export in .p12 format

like image 2
Abdul Karim Avatar answered Oct 17 '22 05:10

Abdul Karim