Saturday, February 11, 2012

Renewing iPhone Developer Program Certificates

Renewing iPhone Developer Program Certificates

I wanted to take a moment to clearly document the process involved in renewing your iPhone development and distribution certificates through the iPhone Developer Program Portal. I briefly googled the subject and found a few helpful articles. I got a post from alex winston which I thought was so useful that I copied for my own benefit.

Many of you might have stumbled upon this article as you frantically try and figure out how to renew certificates for the iPhone Developer Program because you procrastinated and waited until the last minute like I did or are new to the use of certificates during development and in particular having to renew them periodically.

In the example that follows I will be renewing my Distribution certificate that I use for both Ad Hoc and Distribution provisioning. The process however is exactly the same for development certificates and provisioning profiles.

To get started obviously you will want to log into the iPhone Developer Program Portal and select “Certificates” from the menu on the left and then select the appropriate tab, in this case “Distribution”. You will then be presented with a list of certificates and unless yours has completely lapsed you will be presented with a list of “Actions” similar to that below.



You will want to click “Revoke” so that you will then be prompted to create a new certificate. Once the certificate is revoked you should see a button that allows you to request a new certificate. Unfortunately this is the one phase of the process that I did not capture a screenshot for.

Once you request a new certificate you should be prompted with a new screen which provides the option near the bottom of the screen to “Choose File” and upload your CSR for this certificate.



You might be asking yourself, just as I was at this moment, where the hell can I get my CSR? If you are fortunate to have saved it from the first time you did this then good for you. As for the rest of us this it is quite easy to generate one as long as you haven’t deleted your old private key used with your current certificate. To generate a CSR from your private key simply start Keychain Access and select “My Certificates” in the “Category” list on the left side of the application. Expand the appropriate certificate from the list on the right and select “Request a Certificate from a Certificate Authority” as depicted in the image below.



At this point you will be prompted to enter a “User Email Address” and “Common Name”. The email address should be that on file with the iPhone Developer Program and the common name is the name you used when you registered with the iPhone Developer Program. This might be your actual name or a company name. As an example mine is “Alex Winston”. Once this has been completed you should now have a CSR for upload.

Once the CSR has been uploaded you will receive an email from Apple stating that you have a certificate to approve and you will see the following “Actions” next to your renewed certificate.



Obvioulsy at this point you will want to “Approve” the certificate. After which you will be prompted with the original “Actions” to Download or Reject the certificate. At this point you will want to Download the new certificate and store it on your machine for use shortly. If you are renewing your Distribution certificate you will also notice that the list of provisioning profiles has also been cleared. Obviously this is because the new certificate is not associated to any provisioning profiles so you will next need to create this new association.



To create the new association simply select “Provisioning” from the “Program Portal” menu on the left. Select the appropriate tab and then you should be presented with a list of profiles that contain the following “Status” and “Actions”.



Simply select “Modify” and you will be presented with a screen that contains information about the current provisioning profile. Simply select “Submit” and you should now be able to download the new profile from the “Actions” menu.



There is one caveat. When modifying my Distribution profile I noticed that when the details were displayed the Submit button was grayed out. At first I panicked and wondered if maybe I needed to delete the profile however the simple solution was to simply select on the text field of the “Profile name” as displayed in the image below and suddenly the Submit button was enabled.



Once you have downloaded the updated provisioning profile to your computer for use later you should fire up Keychain Access one final time to remove the old certificate. Because you need to install the new certificate the easiest thing to do is simply double click on the .cer you downloaded after renewing your certificate and Keychain Access is automatically loaded and the new certificate is installed and associated with the corresponding private key. You will notice however there are two identical certificates now installed however it is a simple matter of selecting the older one and deleting it.



Once this in complete I next cleaned out my old provisioning profiles located at ~/Library/MobileDevice/Provisioning Profiles. I then copied the .mobileprovision file into this directory. Typically you should have one for development, adhoc and App store distribution and I name my accordingly to eliminate confusion.



Now that you have installed your new certificate into your keychain and placed the new .mobileprovision files in the appropriate directory it is best to remove the old profiles from your development device and install the new ones. Fire up Xcode and select the Organizer from the Window menu. At this point I simply highlight all the related profiles and delete them.



At this point you can simply drag the appropriate .mobileprovision file from the ~/Library/MobileDevice/Provisioning Profiles directory to support your development efforts. You should now be able to resume development however you might need to restart Xcode if it was open while you performed the steps outlined in this post.

originally -http://alexwinston.wordpress.com/2010/01/08/renewing-iphone-developer-program-certificates/