Generating a CSR and Generating a P12 Certificate is not as complicated as you think!
If you want to distribute your own app on the Apple App Store, you must know that you’re going to need a P12 certificate file (Why else would you be here?). If you’re doing this for the first time, you’re undoubtedly going to need some help. And even if you aren’t, it’s always good to have a guide on your side (Safety first, right?). So, here’s our guide that will help you create your own P12 file from your Apple developer account and get your App up and running.
To simplify the process, we’ve applied the ‘divide and rule’ principle (Who says only the colonialists can use it?). Upon dividing the P12 certificate file generation process, we’re left with three different steps that we must apply one after the other. Here are the three steps to making your own P12 certificate file:
- Generating Certificate Signing Request (CSR)
- Creating .cer file (certificate file)
- Installing the .cer file
If you manage to execute these three steps successfully, you’ll have a smoking hot P12 file ready to be served. To get your P12 certificate file ready to be served, you’ll need a few things – ingredients should we say. Here are the prerequisites:
- You must be using a Mac computer.
- You must have created your Apple iOS Developer account.
- You must have created an App ID in iTunes Connect.
If you have all these ingredients in place, you’re now ready to begin the certificate generation process.
1. Generating Certificate Signing Request (CSR)
- First, open Keychain Access on your Mac by going to Applications/Utilities
- In the drop-down menu, go to Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority
- Enter your E-mail address, it should be same as the one you used in iOS Developer.
- In the Common Name field, assign a name to your Private Key
- Leave the CA Email field blank and select the Save to disk button
- Click on Continue
- Now save the CSR file on your choice of location
- In the window named ‘Key Pair Information,’ set the Key Size as 2048 bits and select RSA as the Algorithm
- Click on Continue
Now your CSR file will be stored in your preferred location. A Public Key-Private Key pair would have been created in Keychain Access.
2. Creating .cer file (certificate file)
- First, go to https://developer.apple.com/ and log in
- Click on Certificates, Identifiers & Profiles
- Now click on Provisioning Profiles under the iOS Apps section. The section will expand
- Similarly, click on Certificate to expand it and click on Production
- Now click on the ‘+’ sign located on the top-right corner
- Under the Production section, click on App Store and Ad hoc
- Click on Continue
- Now select the CSR file you generated in the first step
- Click on Generate
- Now click on the Download button and then click on Done once the file is downloaded
3. Installing the .cer file
- Locate the .cer file and double-click on it. If you’re seeing an Add Certificates window, set the Keychain dropdown value to login and click on Add
- Once again open Keychain Access on your Mac by going to Applications/Utilities
- Go to the Keys section on the left-hand side panel. You should see your Private Key and Public Key
- Expand the Private Key. You’ll see the certificate file
- Now select the Private Key and Certificate file
- Right-click and click on Export two items
- Save the file where you want to and make sure the extension on the file is .p12
- Click on Save
- Now you’ll be asked to provide a password to secure the file. You can leave it blank, but we recommend protecting it with a strong password to avoid any misfortunate incidents
- Click on OK
If everything went well, you must have got your .p12 file on your preferred location.
- CSR Generation tool – To Generate CSR quickly
- SSL Converted Tool – Convert SSL files from one format to another one
- HTTPS Encryption for iOS and Android – A Step Towards Cybersecurity Awareness
- What is SSL on iPhone? How to Enable SSL on an iPhone
- Building Up iOS App Identity with Code Signing
- Apple App Transport Security – killing the Unencrypted Internet
- 10 Best Mobile Application Security Best Practices for Developers
Here we have elaborated the process of generating CSR and P12 Certificate to sign your iOS Apps. As per the SSL Certificate guideline for iOS, iOS will only accept the SSL Certificate from a genuine Certificate authority.