54

Possible Duplicate:
Xcode - iPhone - profile doesn’t match any valid certificate-/private-key pair in the default keychain

I'm having a problem installing a provisioning profile created by another developer.

  1. Development Certificate already exists
  2. App I'm working on has a Provisioning Profile associated with the certificate
  3. My device UUID has been added
  4. AppID for the app already exists
  5. Development Provisioning Profile exists, with my UUID

When I download the Certificate and Provisioning Profile I get the error in Organizer:

Xcode could not find a valid private certificate/valid key-pair for this profile in your keychain

How can I resolve?

Community
  • 1
  • 1
Sheehan Alam
  • 57,155
  • 123
  • 348
  • 546

10 Answers10

64

You also need the private key that was used when requesting the certificate.

The private key is what is used for signing every device binary you compile using that developer identity. The certificate you download and import is basically just a stamp on your private key saying "code that is signed using this key is allowed to run on a device".

Have the other developer export the keys used when generating the original certificate signing request and then import them on your machine.

Look in Keychain to see if the key is correctly paired with the certificate once you have both:

When everything is correctly in place you should see a little disclosure triangle on your certificate which lets you see the key (and vice versa on the key page where you should see the certificate under the key). Otherwise the relationship is not correct, not recognized by Keychain during import (I have seen this in some cases when importing a renewed certificate while the expired one was still in the keychain).

I was recently trying to move the public/private key pair for an iOS developer certificate to another machine. The public file was exported using Keychain Access to .pem and the private file to a password protected .p12.

On the other machine Keychain Access would not import them. The solution was the good old command line:

security import ios_priv.p12 -k ~/Library/Keychains/login.keychain 
security import ios_pub.pem -k ~/Library/Keychains/login.keychain

So try this if you have problems transferring the keys for your certificate.


EDIT to reply to @baudot's comment below. (It wouldn't fit in a comment)

Make sure you also have the Apple Developer Relations Root CA certificate in your keychain. That is what is used to verify the certificate.

You could also opt for a fresh start. Just delete the keys and certificates from your keychain, revoke them on the ADC portal and delete their associated provisioning profiles.

Once you have removed everything you can generate a new key pair and associated certificate signing request. Then make sure to export the keys and stash them in a good place for the future.

Then you go to the ADC portal, upload your new cert signing request, generate new provisioning profiles and you are good to go.

The only irreplaceable thing is your ADC account. All the rest can be restored or recreated.

I would also recommend that you use the fancy new automatic provisioning built into Xcode. That saves you the headache of downloading and importing the provisioning profiles. It simply syncs your existing ones with ADC.

Heiberg
  • 5,407
  • 2
  • 24
  • 28
  • I'm wresting with this problem, and looking over my hard drive, see that I have no less than four private keys, any of which might be the one I used to sign with originally, and all of which KeyChain Access seems to have already installed. And still it shows this error. – baudot Apr 15 '11 at 00:52
  • 2
    The key above is "generate NEW provisioning profiles". I found that "renew" does not work. – Chris Newman Oct 21 '11 at 10:48
  • I second starting over! I tried lots of things, but everything just worked once I started over. – Ivan Andrus Jan 19 '12 at 17:09
  • Really nice answer, All confusion cleared. Especially "Edit". – viral Jan 31 '12 at 05:18
  • This did make me look elsewhere. After facing this issue for quite sometime, I ended up opening my 'DeveloperProfile.developerprofile' from backups. Once XCode imports this in the organiser, the valid key-signing identity issues are gone. – Abhishek Mishra Dec 17 '12 at 10:37
22

This happened to me because I dropped the profile onto the device's Provisioning Profiles section in the Xcode Organizer, but not into the Library's Provisioning Profiles section. Once I dropped it there too, the warning disappeared in the device section.

Hope this can help anyone...

marcgg
  • 60,067
  • 49
  • 172
  • 221
5

When the certificate is OK, restart Xcode to help it find it.

Matthew Mitchell
  • 4,747
  • 12
  • 63
  • 114
3

I had a similar problem. One solution is to delete the certificate from your keychain and request a new one. Apple has a really detailed walkthrough here:

technotes

NANNAV
  • 4,718
  • 4
  • 26
  • 48
Nate Smith
  • 51
  • 2
1

I had this issue after my certificate expired and was certain the keys were all good and in the right places. The step I was missing was deleting the profiles in the Provisioning Portal and recreating them. Don't trust that "renew" link - it looks like such a tempting shortcut, but it just didn't work for me!

So, for a fresh start, not only do you need to delete the keys and certificates from your Keychain, you need to wipe the contents of the Development and Distribution tabs under Provisioning.

Chris Newman
  • 2,231
  • 1
  • 23
  • 30
1

I also had this problem on 10.6, Xcode 4.2. After trying many other things, I finally just exited Xcode and restarted it. Then the error message went away. Got figure.

Tony Perez
  • 11
  • 1
1

I have only been able to solve this by using Xcode -> Organizer -> Developer Profile and there clicking Export in the bottom of the right pane. This saves a consolidated .developerprofile file that you cat just open/import on the target machine.

Disclaimer: this may arguably not be what the poster originally intended to achieve. I have however not been able to successfully move private+public+cert between my machines any other way.

conny
  • 9,012
  • 6
  • 35
  • 43
0

Just had this problem now.

Simply hit "Refresh" on the bottom toolbar and XCode 4 will download and install everything for you.

0

You have to edit you provisioning profile in iOS provisioning portal. Select "edit" button and then "Modify". Enter the required info (your name, devices, appl. id).

When the system shows that the profile is "Active", go to Certificates section of the iOS provisioning portal and check your development certificate. It should have your provisioning profile listed in the "Provisioning Profile" entry.

After then, you can download the profile and drop it into Xcode.

Hynek
  • 91
  • 1
  • 3
0

If your old mac is not accessible, but you have ssh access (like powered on in an office cube far, far away), there is a solution. You can simply copy the keychain from your old machine to your new machine using the command line:

scp user@oldmac:Library/Keychains/login.keychain ~/Downloads/oldmac.keychain
--or-- ssh oldmac; cp Library/Keychains/login.keychain ~/Dropbox/oldmac.keychain

On the new Mac, open Keychain Access. Go to File -> Add Keychain and choose Downloads/oldmac.keychain

Then simply copy the necessary public keys from the oldmac keychain to the default "login" keychain.

Stickley
  • 4,192
  • 2
  • 27
  • 27