2

I am having some trouble creating my .p12 certificate. I have previously created an application with push notification, this works fine. The application takes the users device id and saves it into a database.

I have added the code into my new application(with the amendments to work with the new application), and from the Log it seems to be working in the same way as my other app.

I have downloaded the relevant files that i need and then i know i needed to use ssl to be able to create my new and combined p12. I cant for the life of me remember how i created the p.12 file.

I'm using moonapns.

I have used the following:

Step 1:

openssl x509 -in aps_developer_identity.cer -inform DER -out aps_developer_identity.pem -outform PEM}

Where aps_developer_identity.cer is the file you download from the portal

Step 2:

openssl pkcs12 -nocerts -out APSCertificates.pem -in APSCertificates.p12

Where APSCertificates.p12 is a file you export from the Mac Keychain. This is critical, you must import the certificate from the portal into keychain. Find it in My Certificates, open the disclosure triangle and highlight both the certificate and the private key, then right click and export them. Give them a password and save them to a p12 file.

Step 3:

openssl pkcs12 -export -in aps_developer_identity.pem -out aps_developer_identity.p12 -inkey APSCertificates.pem

I have added the certificate and it isn't working, i'm not receiving the notification to the device. Does any one know how else i am supposed to create the certificate??

Sophia_xoox
  • 917
  • 3
  • 12
  • 26
  • Try to restart your xcode after the installation of files – SRI Sep 23 '13 at 10:27
  • http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1 check this tutorial – sabeer Sep 23 '13 at 10:33
  • @sabeer i have tried that but it only creates a pem file i then need to convert that back to a p12 file for windows and this is where i get stuck? – Sophia_xoox Sep 23 '13 at 10:34
  • I did get the same case, it was only valid for one apps, but when i tried to generate another certificate(s) it didn't work. – Yoshua Joo Bin Jan 02 '14 at 02:54

2 Answers2

0
openssl pkcs12 -export -in your_app.pem -inkey your_key.pem -out your_app_key.p12

refer this link http://www.raywenderlich.com/forums/viewtopic.php?f=20&t=7468

sabeer
  • 583
  • 8
  • 27
  • I took a look at the link, thank you. Do you mean that i need to type the following line into terminal before combining the two pem files into one pem file? and not use the line "$ cat PushChatCert.pem PushChatKey.pem > ck.pem" – Sophia_xoox Sep 23 '13 at 12:50
  • I Tried again and still no luck? is there any other ideas that could be the problem maybe? – Sophia_xoox Sep 23 '13 at 14:01
  • Has it solved yet ? if it were solved, please tell me what was the main problem, i got the same case :( – Yoshua Joo Bin Jan 02 '14 at 02:57
0

Try this:

After downloading the .cer file (aps_development certificate is not the ios_development), manages the pem file with the following command:

openssl x509 -in "path_to_apple_cert.cer" -inform DER -out "path_to_an_output_Cert.pem" -outform PEM

Take your APSCertificates.p12 file and run the second command:

openssl pkcs12 -nocerts -in "path_to_exported_p12_from_apple_cer.p12" -out "path_to_an_output_Key.pem" -passin pass:your_p12_password -passout pass:your_new_p12_password

Now take the two pem files that you generated and run the following command:

openssl pkcs12 -export -inkey "path_to_an_output_Key.pem" -in "path_to_an_output_Cert.pem" -out "path_to_final_p12.p12" -passin pass:your_new_p12_password -passout pass:your_final_p12_password

This is your P12 for push notifications.

If you do not want to use the

$ cat command PushChatCert.pem PushChatKey.pem > ck.pem

contained in some instances, if you are on windows you can use:

type PushChatCert.pem PushChatKey.pem > ck.pem