How can I add private key to the distribution certificate?

IosXcodeKeychainSigning

Ios Problem Overview


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"?

Ios Solutions


Solution 1 - Ios

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).

Solution 2 - Ios

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 > > 5. 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. > 6. 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.

Solution 3 - Ios

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 (http://i.stack.imgur.com/rockU.png" width="10">) 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 (http://i.stack.imgur.com/rockU.png" width="10">) -> Click Import -> Select the file you exported in step 6

Solution 4 - Ios

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.

Solution 5 - Ios

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

Solution 6 - Ios

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.

Solution 7 - Ios

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.

Solution 8 - Ios

"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.

Solution 9 - Ios

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.

Solution 10 - Ios

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPau SenabreView Question on Stackoverflow
Solution 1 - IosDaniel MartínView Answer on Stackoverflow
Solution 2 - IosandrewbView Answer on Stackoverflow
Solution 3 - IosJorge CasariegoView Answer on Stackoverflow
Solution 4 - IosBuntylmView Answer on Stackoverflow
Solution 5 - Iosshine odigieView Answer on Stackoverflow
Solution 6 - IoskjyvView Answer on Stackoverflow
Solution 7 - IosAmarView Answer on Stackoverflow
Solution 8 - IosRukshanView Answer on Stackoverflow
Solution 9 - IosZen Of KursatView Answer on Stackoverflow
Solution 10 - IosLogicView Answer on Stackoverflow