To push to your iOS/Mac App or to Passbook you'll need to generate an APNS certificate in the Apple developer portal. This page will guide you through this process.
Note that Apple also has some usefull instructions on Provisioning and Development.
You have two options to create your certificate signing request (CSR), with Keychain App on your Mac or using the commandline.
- Open the Keychain App
- Choose from the menu: Keychain > Certificate assistent > Request certificate from certificate authority…
- Fill out the e-mail and name you want in the certificate and choose "Save to disk"
- Go ahead and save the file somewhere you can find it again
- Open the terminal and go to a folder where you can put the certificate files
- Generate a new private key and CSR:
openssl req -nodes -newkey rsa:2048 -keyout private.plain.key -out certrequest.csr -subj "/emailAddress=email/CN=Name/C=US"
- Secure the private key with an passphrase:
openssl rsa -in private.plain.key -des3 -out private.key
Now that you have your CSR head over to the iOS or Mac "Certificates, Identifiers & Profiles" page in the Member Center.
- Click "App IDs"
- Look up/create the correct App ID, make sure it's an "Explicit App ID"
- Under "App Services" check the "Push Notifications" box (when editting you must first click "Settings" to check the box)
- When creating a new App ID continue to the next page
- Now upload the CSR you just generated by clicking create certificate under the Production and/or Development SSL Certificate
- Go through the wizard and generate and download your certificate
Note: After this you must update all provisioning profiles with this App ID before push notifications will work! Edit something in the related profile to trigger regeneration and download the profile again. See also the "Creating and Installing the Provisioning Profile" section.
- Click "Pass Type IDs"
- Look up the correct Pass Type ID and click "Settings"
- Click "Create certificate..."
- Click "Continue", upload the CSR you just generated
- Click "Generate", wait for the certificate to be generated and then download it!
Note: The certificate to sign your pass with is exactly the same certificate used for push!
Note: To generate a fresh Pass Type ID just follow the on screen instructions and upload the generated CSR during the process.
You now have your certificate, time to convert it to a Notificato compatible format.
- Click the
.cer
-file so Keychain will import it - Open Keychain and lookup the certificate
- Select both the certificate and the private key associated with it
- Right click on the selection and choose "Export 2 items…"
- Choose "Personal Information Exchange (.p12)" format and save it to disk as "keychainexport.p12"
- Convert the
.p12
-file to.pem
format by running:openssl pkcs12 -in keychainexport.p12 -out certificate.pem
Note: This will first ask for the passphrase you encrypted the p12 with while exporting from Keychain, then it will ask for a new passphrase to encrypt the pem-file with.
- Make sure the downloaded
.cer
-file is in the same folder as the other generated files - Open the terminal and go to the folder the certificate files are in
- Convert Apples certificate to PEM format:
openssl x509 -inform der -in aps_development.cer -out aps_development.pem
- Then add the key and certificate together:
cat aps_development.pem private.key > certificate.pem
Now certificate.pem
is the certificate file you can use to push messages with, of course it will only work with choosen APNS environment and App/Passbook Pass you generated the certificate for. Now go push something!