Installing private key to upload to Appstore

I am archiving a new version of an app and want to upload to appstore.

I did this on a first mac (MBP / Xcode 12GM). [Is GM relevant here ? Can I archive with a GM version ?]
At some point after asking to upload, I was noticed that I missed a Distribution certificate (I may have revealed some time ago for other reason).

I thus created a new distribution certificate and went to upload.
I ask for automatically signing and it goes on processing.
I get the iPad content info , indicating notably the keychain-access-group and team identifier.
I hit upload, and after about 1 minute in "Creating App Store Connect API analysis file…" message I get an AppStore Connect Operation Error "an error occurred when uploading to the Appstore".
I could not see the last message for long, but in a blink it seems it was authentication error.


So I tried to archive and upload from the other Mac (Xcode 11.3).
Now, I get the message that "XXXX has 2 distribution certificates, but their private key are not installed. Contact the creator to get a copy of private key."

I'm lost here.
How do I get such a copy of private key ?
Do I need to recreate completely the private key ?
How do I install it ?
Should I remove certificates and recreate ? If so, is there a risk for other published apps ? Do I have to do it on each Mac ?

Or should I do it in Xcode, creating a new distribution certificate on each Mac (or only on one ?)


I looked at this SO: https://stackoverflow.com/questions/16563364/how-can-i-add-private-key-to-the-distribution-certificate

They say:
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)

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

But at step 3, I do not see Teams section in Organizer (may be it changed location since this SO thread ?)

Accepted Reply

Found the solution… in Xcode Help.

Replies

I tried on MBP with Xcode 11.6 instead of Xcode 12GM.

Same problem, during upload of spa, after trying to "authenticating with the App Store…"

So problem is not with Xcode 12GM, but most likely my certificates.

I looked at my Account in Xcode, opened "Manage Certificates…".

Here I see, on the MBP
  • iOS Development Certificates

Untitled created : 4-July-2020
  • Apple Development certificates

iMac (mine) created 10.10.2020. Not in keychain, dimmed . That's the one I created first when I revoked
MBP created 24-June-2020. no comment
  • Apps Distribution Certificate

Apple Distribution created 12-oct-2020 (today), no comment - That's apparently the one I created from Archiving window. Should I created a new one in Xcode to replace ?
Apple distribution created 31.12.2019 Not in Keychain, dimmed
  • Mac Installer Distribution Certificates

Mac Installer Distribution created 12-jun-2017 expired

On the iMac
  • Apple Development certificates

iMac (mine) created 10.10.2020. no comment (it is dimmed in MBP)
MBP created 24-June-2020. dimmed, not in keychain
  • Apps Distribution Certificate

Apple Distribution created 12-oct-2020 (today), not in keychain, dimmed
Apple distribution created 31.12.2019 Not in Keychain, dimmed
  • Developer ID Application certificates

4 certificates, all dimmed, not in keychain.
Partially solved.

After reading this: https://stackoverflow.com/questions/50507628/unable-to-upload-the-ipa-file-to-itunes-store
  • I checked my Appstore Connect account (contracts).

  • I noticed a yellow warning that some contact information were missing.

  • I updated.

Least I can say is that error message was not explicit (Appstore Connect upload failed, that's all).
That time, upload went to the end on MBP !

But the question about importing private key on iMac remains…
Found the solution… in Xcode Help.