iOS: p12 Generate Certificates
Step-by-step guide for creating an iOS / macOS Push Authentication Certificate (.p12)
To send push notifications to iOS apps, an authenticated connection to Apple Push Notification Services (APNs) is required. You can authenticate using a token-based (.p8 key) or a certificate-based (.p12 file) method — but only one is necessary.
This guide will walk you through setting up a certificate-based (.p12 file). This is not recommended because you must renew it annually. This includes logging into your Apple Developer Account to generate the new certificate and uploading it to your OneSignal dashboard every year.
Requirements
Make sure you have the following before starting:
- An iOS mobile app.
- A Paid Apple Developer Account with Admin access.
- A OneSignal Account.
- A mac with Xcode 14+.
- The Bundle ID for your app target as set in Xcode.
- An Xcode project with Push Notification capability enabled.
Generate a Push Certificate
You first need to create a Certificate Signing Request .certSigningRequest
File (CSR) on macOS.
- Open Keychain Access: Applications > Utilities > Keychain Access
- Launch the Certificate Assistant
- From menu bar, click:
Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority...

- Enter Your Information
Fill in the required fields:
- User Email Address:
[email protected]
- Common Name: Your name or the name for the certificate
- CA Email Address: Leave this blank
- Request is: Select Saved to disk
- Click Continue
- Choose a location to save the
.certSigningRequest
file - Click Save to finish
You now have your .certSigningRequest
file ready to use!
Enable Push Capabilities for the App ID
Skip if you use Automatically manage signing within Xcode.
- Go to the Identifiers section of the Apple Developer portal, locate and select your app's App ID from the list.

- Enable the Push Notifications capability by checking the box. ⚠️ Do not click "Configure" — just enable the toggle.

Create a Push Certificate
Follow these steps to generate the Apple Push Notification service (APNs) SSL certificate:
-
Visit the Apple Certificates page.
-
Click the plus (+) button to create a new certificate.
-
Under Services, select:
- Apple Push Notification service SSL (Sandbox & Production)
- Then click Continue
-
Select your App ID from the list and click Continue.

- Upload your previously generated
.certSigningRequest
file.

- Click Continue, then click Download to save the resulting
.cer
file to your computer.

You’ll use this .cer
file to configure push notification services.
Create a Private Key and export the .p12 certificate
- Double-click the downloaded
.cer
file to import it into Keychain Access. - In Keychain Access, navigate to:
- Keychains > Login
- Category > My Certificates
- Locate the certificate named Apple Push Services.
- Right-click the certificate and select Export.

- Choose a location to save the file, and select the file format as
.p12
. When prompted, you can set a password for the.p12
file (this password is required when uploading to services like OneSignal).

Upload the .p12 to OneSignal
- In your OneSignal dashboard, go to your app > Settings > Push & In-App > Apple iOS.
- Upload the
.p12
file (and enter the password if you set one). Click Save.
Success!
You’ve successfully set up APNs authentication using a .p12 certificate in OneSignal.
Your iOS app is now ready to send and receive push notifications! 🎉
.p12 troubleshooting
Invalid Certificate Format Error
- Cause: The uploaded file is not in
.p12
format. - Fix: Ensure you export the certificate from Keychain Access as
.p12
(not.cer
or.pem
).
"Incorrect Password" When Uploading to OneSignal
- Cause: Password was entered incorrectly or not set.
- Fix:
- Try exporting again and set a new password.
- Ensure no extra spaces are added when pasting.
- If using Provisionator, the password is shown in the UI.
Missing Private Key in Exported File
- Cause: Certificate was imported but not paired with a private key.
- Fix:
- Make sure you generate the CSR from Keychain Access on the same machine.
- After downloading the
.cer
file, double-click to install and check if the key appears under My Certificates.
Push Notifications Not Working After Upload
- Cause: Incorrect App ID, or Provisioning Profile missing capabilities.
- Fix:
- Confirm the
.p12
matches the App ID used in the app. - In Apple Developer Portal, ensure the App ID has Push Notifications enabled.
- Make sure the Provisioning Profile includes Push.
- Confirm the
Expired Certificate
- Cause:
.p12
certificate is no longer valid. - Fix:
- Go to Apple Developer > Certificates and check expiry.
- Revoke the old certificate and create a new one.
FAQ
Do I need a provisioning profile and how to create it?
Yes, Apple requires different types of profiles for development, testing (Ad Hoc), and distribution to the App Store.
In Xcode, you should be able to select Automatically manage signing to create one automatically.

Otherwise, see Apple's docs on provisioning profiles for details.
Updated 13 days ago