Generating SSL Certificate for APP ID
- Log in to the iOS Dev Center and select the Certificates, Identifiers and Profiles
- Go to App IDs in the Identifiers Section of the sidebar and select your app if automatically created. Skip to Step 6.
- To create new App click + and fill the details for App ID, App Services (Check the push notification Checkbox) and Explicit App ID(Should be same as Bundle ID in your App)
- You will be asked to verify the details of the app id, if everything seems okay click Register.
- In the Push Notification row there are two orange lights that say “Configurable” in the Development and Distribution column.
- Select your App ID and click on EDIT.
- If Push Notification is not enabled, enable it to make it configurable.
- Select the Create Certificate in the Development/Production SSL Certificate
- In the next step it will ask you for generating a CSR
Generating the Certificate Signing Request
- Open Keychain Access on your Mac and choose the menu option Certificate Assistant -> Request a Certificate from a Certificate Authority
- Enter some descriptive name for Common Name (Give your app name appended by Gamooga preferably to identify it)
- Check Save to disk option and click continue
- In the Keys section of the Keychain Access, a new private key would have appeared with Common name specified
- Choose the CSR that you generated to create the push certificate
- Click Continue and download the certificate
- Double click on the downloaded certificate. This will add your certificate to your private key in your keychain
- Go to Keys section in the Keychain and find your private key
- You should be able to expand the private key and find your certificate with it. Select both the private key and the certificate after expanding (as shown in the snapshot).
- Right click on it to export it as .p12 file. Make sure you are exporting 2 items as shown￼
- Name your file as your_app_name and save it with file format .p12
- You will be prompted to enter a password. Directly click Ok to save without any password.
- In the next step, you will require your system password to finally save the file.
Creating a pem file from p12 file
- Create Certificate .pem from Certificate .p12
openssl pkcs12 -clcerts -nokeys -out your_app_name_cert.pem -in your_app_name.p12
- Create Key .pem from Key .p12
openssl pkcs12 -nocerts -out your_app_name_key.pem -in your_app_name_key.p12
- Optional (If you have entered a passphrase asked in second step you need to remove it. This step is mandatory if you have entered a password to encrypt your key)
openssl rsa -in your_app_name_key.pem -out your_app_name_key_noenc.pem
- Check certificate validity and connectivity to APNS
If 3rd step is not performed
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert your_app_name_cert.pem -key your_app_name_key.pem
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert your_app_name_cert.pem -key your_app_name_key_noenc.pem