First, sign into your Apple iOS developer account using your authentication details.
Click Certificates, Identifiers & Profiles on the right of the screen
On the next page, click on Certificates.
Click on the plus button at the top right
Choose App Store and Ad Hoc, under the Production heading and click Continue
You'll be asked to open the Keychain Access application on your Mac. Do this, and follow the instructions on screen. Once this stage is complete, download the certificate to your computer (and keep a backup for future needs).
Double click the .cer file you have just downloaded to install it on your Mac – click on the My Certificates option in the left hand panel of Keychain Access to check it has appeared.
Locate the entry you have just created in Keychain Access and use the arrow on the left to drop down a sub menu. Right click on the name next to the key icon and select Export.
Name the file relevant to your company and click save. This will export a .p12 certificate file.
Give the file a password and make a note of it.