How to create the Apple Push Notification Certificate and Key

How to create the Apple Push Notification Certificate and Key


In order to enable you Vivocha powered application to receive push notifications from the agents you needs to configure your iOS Service with the Apple Push Notification Certificate and Key.



Log in to the Apple Developer Portal (https://developer.apple.com/account/overview.action)

 

Click on the Certificates section.

Select the Production.

Press the + button.

Select Apple Push Notification service SSL (Production) and press Continue.

Select your APP ID from the list and continue.

Follow the instructions Apple gives you.


Download the certificate, locate it in your file system and double click on it.

Open the Keychain Access app and go to the Certificates category.

Locate the Apple Production iOS Push Services' certificate and expand it - you will find your private key.

Right click on the certificate row and choose Export "Apple Production iOS Push Services: com.yourname.yourappname"

When a password request is prompted do not enter any password and press OK.

Do the same steps with you private key. (Export it in the same folder of your certificate)


Open a Terminal window and go to the folder where you saved the certificate and key.

Run the following commands:

openssl pkcs12 -in YOURCERTIFICATEFILENAME -out cert.pem -clcerts -nokeys

openssl pkcs12 -in YOURKEYFILENAME -nocerts -nodes | openssl rsa -out key.pem

By running these two commands you will produce two files named: cert.pem and key.pem

Now we need to encode these two files in Base64:

 openssl base64 -in cert.pem -out cert.txt

 openssl base64 -in key.pem -out key.txt

Open the key.txt file with a text editor ed it should appear similar to the following text: 

QmFnIEF0dHJpYnV0ZzBka3FxCkRXQ1BFRmpqqmljaFFRSmRjOXg0c0JaOTY1alMz
b1hKa3RaR09xMW5tRUZNNW1BUkRSQkpySHlHVVBMYVZUMmgKeHU2L3pNeXZFMUQz
S2YvNjRray96Tlp5QlowV1VwdXJWY29TWFFJREFRQUJBb0lCQUFoclVCTWlzUDFP
aGlvUQo1VUZHb3M1VQZ2FVTHZlTWZjRRTXZQCkdIVzNFUk5hNUtpbHVSNGhX
N244NkFMVVFqegp0eE9jTEtubjdBcDArVittdGdOMjM1RUVhNXViSENFTGIvdDBR
YUkwVGZ0NVFIUWo4azRqdE1qZ3IyaHlrZjZlCnlrbjVUTktURmNYWWtVNDBSUUV5
b015OXF2cVRZRXJ3RGc5b2g2WEVKYTVUY3lWckNXQmJKemMrU3V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Copy the entire text and paste it in the Key field in the iOS Service in the Agent Desktop.

Do the same with the cert.txt file and paste the content in the Certificate field.