How to Generate a P12 Certificate for Signing an iOS App
Code signing is a prerequisite for installing any app on a mobile iOS device.
A valid signature, which uses an Apple-issued certificate, ensures the integrity of an app and stands as proof that the app comes from a known and approved source and has not been tampered with.
By enforcing mandatory code signing, Apple ensures that no third-party app loads unsigned code resources or uses self-modifying code.
During the Appdome app Build, Build process adapters are added to the app to achieve the requested added functionality. As a result, the app’s original signature is invalidated and must be re-signed to allow deploying the app on mobile devices.
Appdome allows signing an app via the Sign tab, by using any of the following methods:
- On Appdome
Allowing Appdome to take care of the entire signing process. You only need to provide the signing credentials. For details, see topic How to Sign Secured iOS Apps without Xcode.
- Private Signing
Gives you full responsibility for handling the entire signing process. For details, see topic How to Privately Code Sign Sealed iOS Apps using DevSecOps Build System.
- Auto-DEV Private Signing
Allows you to sign the app without uploading the signing certificate to Appdome’s cloud service.
Appdome provides you with a script (.sh file), which runs on your trusted environment and signs the app by using your credentials (certificate and password) as input. For details, see topic How to Automate Secure iOS App Code Signing in DevOps CI/CD.
As part of the Appdome signing process of secured iOS apps, by using either Auto-dev Private Signing or Signing on Appdome, you are required to extract and upload a Provisioning Profile and an entitlement file for each executable in the app, and when using signing on Appdome, a P12 certificate and its password.
This article provides instructions for generating the P12 distribution certificate and for using it via Appdome.
What is a P12 file?
A distribution certificate identifies your team/organization within a distribution provisioning profile and allows you to submit your app to the Apple App Store.
A .p12 file contains the certificates that Apple needs in order to build and publish apps.
The steps below guide you through the process of creating an iOS Distribution Certificate and .p12 file. To learn more about certificates and how they work in Apple’s App Store, you are advised to visit the iOS Dev Center and consult the official Apple documentation.
If you already have an apple certificate, go to section Downloading the Certificate Signing Request from your Apple Developer Account (developer.apple.com).
Creating a New Certificate Signing Request for Development
Notice: The steps below require a Mac computer.
To create a new certificate signing request:
- Open Keychain Access.
- Go to Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.
- Enter your information: Email Address and Certificate Common Name.
Note: The Certificate Authority email address is not needed if you are saving the certificate signing request to disk.
- Select the Saved to Disk option and click Continue.
Select the directory on your Mac computer in which you would like to store the certificate signing request file. Alternatively, accept the default directory. When done, click Save.
- Go back to Apple developer webpage.
To generate your certificate, you need to import the certificate signing request.
- Click Continue.
Downloading the Certificate Signing Request from Your Apple Developer Account
Now that Your certificate is ready, download and activate it by running the following steps:
- Click Download to download the certificate to your Mac.
- Give the certificate a name with a .cer extension.
- Save the certificate file to a location of your choice on your Mac computer.
- Locate the certificate in the finder and double-click the certificate file name to add to Keychain Access on your Mac computer.
This step is required to allow you to create a P12 file from Keychain Access.
- Open Keychain Access on your Macintosh computer.
- From the left navigation panel, under Category, select Certificates.
- In the search bar, type: distribution.
- Locate your new certificate and expand it by clicking the triangle icon to the left of the certificate name.
After expanding, you should see a private key under the distribution certificate.
- Right-click the distribution certificate and click Export iPhone Distribution to create a P12 certificate file containing the distribution certificate and the private key.
- Give the P12 certificate file a name.
- Specify a location where the file is to be saved and then click Save.
This P12 certificate will be used for signing apps on the Appdome platform.
- After saving, you will be prompted to enter a password to protect the P12 certificate file.
- Click OK after entering and verifying your password.
This is the password you must provide when signing your application (locally or on Appdome).
Important: Do not lose this password, as it is required for future iOS signing.
- If prompted, click Allow to enable Keychain Access to export the key from your keychain.
Congratulations! You now have a proper P12 certificate file. Now you can use it to sign your application via Appdome.
For Further Details:
- How to Sign Secured iOS Apps Without Xcode
- How To Sign Secured Android Apps Without Android Studio
- signing apps with Extension or Frameworks.
- Request a demo at any time.
If you have any questions, you are welcome to contact us at firstname.lastname@example.org or via the chat window on the Appdome platform.