Skip to main content

APNS Certificate/ PEM file

APNS Certificate/ PEM file

In order to send push notifications to your app, an APNS certificate has to be created for your app and the same has to be converted to .pem format and uploaded to our dashboard. Follow the steps below to create APNS certificate for your app :

Generating the Certificate Signing Request (CSR)

Open Keychain Access on your Mac (it is in Applications/Utilities) and choose the menu option Request a Certificate from a Certificate Authority.
You should now see the following window:
Enter your email address here. Enter your app name for Common Name. This allows us to easily find the private key later. Check Saved to disk and click Continue. Save the file as “Yourappname.certSigningRequest”.
Go to the Keys section of Keychain Access, you will see that a new private key has appeared in your keychain. Right click it and choose Export. Save the private key as yourappkey.p12 and enter a passphrase.

Creating an App ID and SSL Certificate

Login to the iOS Dev Center and “Select the Certificates, Identifiers and Profiles” from the left panel. Select Certificates in the iOS Apps section. Go to App IDs in the Identifiers and click the + button.
Fill the following details in the window presented: App ID. Description: yourappname In the App Services. Make sure you check the Push Notifications Checkbox. Explicit App ID: your app bundle id (in the format com.example.exampleapp).
Press the Continue button. You will be asked to verify the details of the app id, if everything seems fine, click Submit. You have successfully registered a new App ID.
After you have made the App ID, it shows up in the App IDs list. Select the yourappname app ID from the list. This will open up a window as shown below:
There are two orange lights that say “Configurable” in the Development and Distribution column. This means your App ID can be used with push, but you still need to set this up. Click on the Edit button to configure these settings.
Scroll down to the Push Notifications section and select the Create Certificate button in the Production SSL Certificate section.
The “Add iOS Certificate” wizard comes up, The first thing it asks you is to generate a Certificate Signing Request. You already did that, so click Continue. In the next step you upload the CSR. Choose the CSR file that you generated earlier and click Generate.
In the Your certificate is ready window, Download the certificate, it is named “aps_prod.cer”.

Creating a PEM file

So now you have 2 files: The private key as a p12 file - yourappkey.p12 and the SSL certificate - aps_prod.cer
Convert the .cer file into a .pem file:
$ openssl x509 -in aps_prod.cer -inform der -out yourappnamecert.pem
Convert the private key’s .p12 file into a .pem file:
$ openssl pkcs12 -nocerts -out yourappnamekey.pem -in yourappkey.p12
Enter Import Password:
MAC verified OK
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
Now verify that your PEM file is correct.
Test it using the following command:
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert “Certificate_name”.pem -key “Certificate_key”.pem 
Replace the "Certificate_name" and "Certificate_key" with your certificate name and key respectively. Remove the quotes.
Use the password which you used for converting the p12 to pem.
If you get the status CONNECTED(00000003) OR CONNECTED(00000006) , and the master key in the end, then the PEM is fine.
Else, please ensure that the two files you have are correct, or contact the iostutorialpoint team for help with the same.
Once the verification is done, combine the certificate and key into a single .pem file:
cat yourappnamecert.pem yourappnamekey.pem > finalkeytobeuploaded.pem

Uploading PEM file to MoEngage Dashboard

Open the settings page in the MoEngage Dashboard, go to Settings > Push > Mobile Push > iOS. Follow the steps below for uploading the .pem file:
  1. Upload the pem file which contains both certificate and key information.
  2. Enter the password for the key.

Comments

Popular Posts

How I Reduced the Size of My React Native App by 85%

How and Why You Should Do It I borrowed 25$ from my friend to start a Play Store Developer account to put up my first app. I had already created the app, created the assets and published it in the store. Nobody wants to download a todo list app that costs 25mb of bandwidth and another 25 MB of storage space. So today I am going to share with you how I reduced the size of Tet from 25 MB to around 3.5 MB. Size Matters Like any beginner, I wrote my app using Expo, the awesome React Native platform that makes creating native apps a breeze. There is no native setup, you write javascript and Expo builds the binaries for you. I love everything about Expo except the size of the binaries. Each binary weighs around 25 MB regardless of your app. So the first thing I did was to migrate my existing Expo app to React Native. Migrating to React Native react-native init  a new project with the same name Copy the  source  files over from Expo project Install all de...

How to recover data of your Android KeyStore?

These methods can save you by recovering Key Alias and Key Password and KeyStore Password. This dialog becomes trouble to you? You should always keep the keystore file safe as you will not be able to update your previously uploaded APKs on PlayStore. It always need same keystore file for every version releases. But it’s even worse when you have KeyStore file and you forget any credentials shown in above box. But Good thing is you can recover them with certain tricks [Yes, there are always ways]. So let’s get straight to those ways. 1. Check your log files → For  windows  users, Go to windows file explorer C://Users/your PC name/.AndroidStudio1.4 ( your android studio version )\system\log\idea.log.1 ( or any old log number ) Open your log file in Notepad++ or Any text editor, and search for: android.injected.signing and if you are lucky enough then you will start seeing these. Pandroid.injected.signing.store.file = This is  file path where t...

Video Calling In IOS Objective C

Video Calling Sources Project homepage on GIT — https://github.com/QuickBlox/quickblox-ios-sdk/tree/master/sample-videochat-webrtc Download ZIP - https://github.com/QuickBlox/quickblox-ios-sdk/archive/master.zip Overview The VideoChat code sample allows you to easily add video calling and audio calling features into your iOS app. Enable a video call function similar to FaceTime or Skype using this code sample as a basis. It is built on the top of WebRTC technology.            System requirements The QuickbloxWebRTC.framework supports the next:     * Quickblox.framework v2.7 (pod QuickBlox)     * iPhone 4S+.     * iPad 2+.     * iPod Touch 5+.     * iOS 8+.     * iOS simulator 32/64 bit (audio might not work on simulators).     * Wi-Fi and 4G/LTE connections. Getting Started with Video Calling API Installation with CocoaPods CocoaPods is a dependency manag...