How can I add private key to the distribution certificate?
Asked Answered
C

10

75

Well, I've got my Developer Certificate linked with it's private key. Works Fine.

I've downloaded my iOS Profile of distributor, but it says Valid signing identity not found.

So I checked my certificates, and exactly, my developer certificate it's linked with its private key but not my distribution certificate. How can I link/add my private keys to this certificate!?

Will this solve the problem "Valid Signing identity not found"?

Checani answered 15/5, 2013 at 11:4 Comment(0)
M
97

Yes, the error you are getting means that there is not a private key on your Mac associated with the distribution certificate you are trying to use to sign the app.

There are two possible solutions, depending on whether the computer who requested the distribution certificate is available or not.

If the computer who requested the distribution certificate is available (or there is a backup of the distribution assets somewhere)

  1. From the computer where the distribution asset was generated, open Xcode.
  2. Click on Window, Organizer.
  3. Expand the Teams section.
  4. Select your team, select the certificate of "iOS Distribution" type, click Export and follow the instructions.
  5. Save the exported file and go to your computer.
  6. Repeat steps 1-3.
  7. Click Import and select the file you exported before.

If the computer where the distribution profile was created is not accessible anymore (and there is not a backup)

You have to revoke the certificate and create a new one.

You may need to ask your team admin or agent to give you some privileges in order to generate distribution certificates. Once you have enough privileges, follow these steps (accurate as of 15-May-2013):

  1. Go to this webpage: https://developer.apple.com/devcenter/ios/index.action
  2. Click on "Member Center" and enter your iOS developer credentials.
  3. Click on "Certificates, Identifiers & Profiles".
  4. Click on "Certificates" under the "iOS Apps" section.
  5. Expand the Certificates section on the left, select Distribution, and click on your distribution certificate.
  6. Click Revoke and follow the instructions.
  7. Click on the plus sign to add a new certificate.
  8. Select "App Store and Ad Hoc" option, and click Continue.
  9. Follow the steps printed in the webpage. That involves opening the Keychain application on your Mac and generate a Certificate Signing Request from there. Click Continue.
  10. Upload the .csr file and click Continue.
  11. A certificate is generated for distribution. Download it and double click it to integrate it in your keychain.

Reopen Xcode and check your project configuration to see if you can now select an "iPhone Distribution" certificate (i.e. it's not grayed out).

Muire answered 15/5, 2013 at 11:20 Comment(10)
I have donwloaded the certificate from "Member Center", I removed my old certificate and install the new one, but stills the same. In the Organizer I can see how the iOs Development Team has a green tick of being verified but the iOS Distribution doesn't have it! And what means in point 4 follow the instructions?Checani
The certificate is not enough, you need the private key too. Can you export the certificate+private key from the machine where the distribution certificate was generated?Sideboard
No, I upgrade to Lion and I guess the certificates and key are gone. I found that I exported just the development cert+key, but not the distribution cert+key.Checani
Then you have to revoke the old certificate and create a new one. See my second solution in the above post.Sideboard
the bold sentence was the all answer for me. thanks.Korwun
One question: I've already have some apps signed with old certificate, and now I can't access that old computer, so I must follow your second approach. Will I have collateral effects on old uploaded apps? May I re-sign again all of it?Gribble
Organiser just shows me a list of builds, no team menu. Think this answer is outdated.Indescribable
i guess this answer should be removed because its not relevant anymoreEmbrocation
Voted to delete the answer as it's not answer at all. -1. Not right for posting a wrong answer.Shreeves
@Indescribable for me, i can do the stuff here: developer.apple.com/account/resources/certificates/listEmu
I
56

Since the existing answers were written, Xcode's interface has been updated and they're no longer correct (notably the Click on Window, Organiser // Expand the Teams section step). Now the instructions for importing an existing certificate are as follows:

To export selected certificates

  1. Choose Xcode > Preferences.
  2. Click Accounts at the top of the window.
  3. Select the team you want to view, and click View Details.
  4. Control-click the certificate you want to export in the Signing Identities table and choose Export from the pop-up menu.

Export certificate demo

  1. Enter a filename in the Save As field and a password in both the Password and Verify fields. The file is encrypted and password protected.
  2. Click Save. The file is saved to the location you specified with a .p12 extension.

Source (Apple's documentation)

To import it, I found that Xcode's let-me-help-you menu didn't recognise the .p12 file. Instead, I simply imported it manually into Keychain, then Xcode built and archived without complaining.

Indescribable answered 12/1, 2016 at 0:36 Comment(0)
E
32

With Xcode 9 the interface has been updated and now the way I did to resolve the problem was this:

  1. Choose Xcode > Preferences.
  2. Click Accounts at the top of the window.
  3. Select the team you want to view
  4. Click the gear icon () in the lower-left.

enter image description here

  1. Export Apple Id and Code Signing Assets
  2. After entering a filename in the Save As field and a password in both the Password and Verify fields you'll see a Window like this

enter image description here

  1. Click the gear icon () -> Click Import -> Select the file you exported in step 6
Embattle answered 17/1, 2018 at 15:47 Comment(2)
The export and re-import works for me. It solved my "Missing Private Key" problem in Xcode Preference - Account. However, it remains a mystery on why export/import helps in this case?Constipate
As often, there are several solutions applying to various stages of the software. The first one (by Daniel Martin) was impossible to execute because the respective UI elements have been removed, the second one (by andrewb) was executable but did not solve the problem, and the this one finally solved it. Maybe next year, another solution will be necessary...Liken
F
4

This site explain step by step that what you need to do Certificates, Identifiers & Profiles and as your question

"Valid Signing identity not found"?

You need the private key that were used to sign the code base with provisioning profile. . If you don't have then you can generate a new signing request on the iOS developer portal.

For Export:

Xcode -> Organizer, select your team. Click Export. Specify a filename and a password, and click Save.`

For Import:

Xcode -> Organizer, select your team. Click Import. Select the file containing your code signing assets. Enter the password for the file, and click Open.

Furtherance answered 15/5, 2013 at 11:6 Comment(0)
F
1

What you need to do is to create a Certificate Type (iOS Distributionfrom) from the link below

https://developer.apple.com/account/resources/certificates

Once this is done , download it into your Keychain on your computer.

Step 2: Go to the link below and create a profile

https://developer.apple.com/account/resources/profiles/list

While creating the profile make sure to select the same package ID for ur app.

Then download the profile u just created

Step 3: When pushing your App to the App store make sure to select Manual signing . Then select the profile u downloaded and import it and also select the certificate you created

this did it for me

Fokos answered 26/6, 2021 at 10:21 Comment(0)
R
1

What worked for me after getting this error on the same machine the distribution certificate was created was this:

  1. Open Xcode settings
  2. Select account
  3. select the proper Team
  4. click Manage Certificates
  5. click + button
  6. choose Apple Distribution

This added the proper certificate also to Keychain (which I thought I already downloaded and added manually before) and then xcodebuild was happy.

Reyesreykjavik answered 13/9, 2021 at 12:48 Comment(0)
G
0

For Developer certificate, you need to create a developer .mobileprovision profile and install add it to your XCode. In case you want to distribute the app using an adhoc distribution profile you will require AdHoc Distribution certificate and private key installed in your keychain.

If you have not created the cert, here are steps to create it. Incase it has already been created by someone in your team, ask him to share the cert and private key. If that someone is no longer in your team then you can revoke the cert from developer account and create new.

Guenna answered 15/5, 2013 at 11:15 Comment(2)
I've created the cert, and I installed I can see it in my keychain access. In The Certificates list I see the developer one, where I can expand it and see the private key, but the Distributor one I can not.Checani
Okay. Login to your dev account and create ad hoc distribution, if not already created. If it is created, just ask that concerned person in your team/company to share the cert and key with you.Guenna
D
0

"Valid Signing identity not found" This is because you don't have the private key for distribution certificate.

If the distribution certificate was created originally on a different Mac you may need to import this private key from that Mac. This private key is not available to download from your provisioning portal.

When you import the correct private key to your mac , XCode's organizer will recognize your already downloaded distribution profile as a "Valid profile"

However if you do not have access to the original Mac which created those profiles, the only option you have is revoking profiles.

Disputatious answered 15/5, 2013 at 11:20 Comment(0)
K
0

since xcode5 organizer no longer team section exists. but the bold sentence was the answer for me. God thanks there is another mac to restore and import to problemmatic mac. now all is ok.

Korwun answered 2/11, 2013 at 14:52 Comment(0)
P
0

What i did is that , i created a new certificate for distribution form my Mac computer and gave signing identity from this Mac computer as well, and thats it

Pitanga answered 22/12, 2017 at 14:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.