23

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

dam1
  • 3,536
  • 3
  • 22
  • 18
rajkumar
  • 251
  • 1
  • 2
  • 8

4 Answers4

55

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

dam1
  • 3,536
  • 3
  • 22
  • 18
  • 3
    The key point is to select both the certificate and the key before exporting to .p12. That was enough in my case at least. – PakitoV Sep 29 '15 at 09:28
  • If you say so, i was't familiar with IOs Development. – dam1 Sep 29 '15 at 13:57
  • @dam1 I'm very glad your steps worked, as I didn't have to do any of the OpenSSL steps in https://code.google.com/archive/p/apns-sharp/wikis/HowToCreatePKCS12Certificate.wiki so am very pleased! Thanks – Magnus Smith Jan 29 '16 at 17:59
  • Thanks for my time saving!! – Pravin Kamble Oct 01 '16 at 12:59
  • I've done all that step by step and get "There was an unknown error while processing the request. Try again." – Florian Mac Langlade Jan 18 '17 at 10:23
  • Could you post a link to the Google Admin page where you can upload the certificate (last greenish screenshot)? I cannot seem to find it. – Onestone Feb 23 '17 at 09:50
  • In my case, just exporting the certificate (parent of private key) worked. Exporting both certificate and private key did not work. – Gautam Jain Jun 08 '18 at 10:07
4

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.

Jessicardo
  • 826
  • 1
  • 8
  • 12
2

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

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

Alex Filatov
  • 2,232
  • 3
  • 32
  • 39
Abdul Karim
  • 4,359
  • 1
  • 40
  • 55
1

This problem comes when we use Firefox to upload the .p12 file. In Chrome I am able to upload the same file.

rajkumar
  • 251
  • 1
  • 2
  • 8