Xcode-如果使用“撤消”按钮创建了私钥,则如何将私钥添加到“开发证书”中 [英] Xcode -How to add a private key to Development Certificate if it's created using the Revoke button

查看:169
本文介绍了Xcode-如果使用“撤消”按钮创建了私钥,则如何将私钥添加到“开发证书”中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于错误,我按下了 Revoke 按钮。:

By mistake I pressed the Revoke button.:

我去了 developer.apple > 证书我下载了新的开发证书,该证书是通过按 Revoke 按钮创建的。之后,我遇到的错误之一就是

I went to developer.apple > Certificates I downloaded the new Development Certificate that was created from pressing the Revoke button. Afterwards one of the errors I got is

错误的第二部分表示证书需要私钥(橙色)。

The second part of the error says the certificate needs a private key (in orange).

Xcode > 首选项> 帐户> 应用程序ID > 团队> 加号它表示该到期开发证书 10/30/20,12:04 AM

In Xcode > Preferences > Accounts > App ID > Team > plus sign it says the expiration of that Development Certificate is 10/30/20, 12:04 AM:

< a href = https://i.stack.imgur.com/1U6n1.png rel = nofollow noreferrer>

当我查看钥匙串时,带有该失效日期的证书在那儿,但是左边没有箭头它可以切换嵌套的私钥:

When I look in keychain the certificate with that expiration date is there but there isn't an arrow on the left of it to toggle the nested private key:

如何向使用撤销按钮创建的开发证书中添加私钥?

Btw按下 Revoke 按钮后创建的分发证书确实附加了私钥。

Btw the Distribution Certificate that was created after pressing the Revoke button did have a private key attached to it.

推荐答案

当您按下撤消按钮时,您将获得新的 iPhone发行证书和新的 iPhone Developer证书。您可以在开发人员门户中的 developer.apple > 证书中查看这些证书。这些证书也将在您的钥匙串中。您使用证书的有效期来查看哪些证书对应于什么。

When you press the Revoke button you get issued a new iPhone Distribution certificate and a new iPhone Developer certificate. You can view these certificates inside the developer portal at developer.apple > certificates. Those certificates will also be inside your keychain. You use the certificate expiration dates to see which certificates correspond to what.

按下撤消按钮的问题是您将得到带有私钥的iPhone分发证书,但远至 iPhone Developer证书不会具有私钥。

The problem with pressing the Revoke button is you will get a iPhone Distribution certificate with a private key but as far as the iPhone Developer certificate it won't have a private key.

如果您查看钥匙串,则会在下面看到此图片。请注意, iPhone发行证书旁边有一个灰色箭头,但 iPhone Developer证书没有:

If you look into your keychain you will see this pic below. Notice the iPhone Distribution certificate has a gray arrow next to it but the iPhone Developer certificate doesn't:

这将导致以下2个错误:

That will cause the following 2 errors:

它会导致您按<$ c再次单击$ c>撤消按钮,您将出现相同的2个错误。我不确定为什么苹果会这样做,但是肯定有人犯错了。

It causes a cycle where you press the Revoke button again and you wind up with the same 2 errors. I'm not sure why Apple did it this way but someone definitely made a mistake.

当您进入钥匙扣> 登录> 我的证书,您只会看到具有私钥的证书(灰色箭头表示)。由于按下撤消按钮的 iPhone Developer证书没有密钥,因此不会在其中。 据此您需要该密钥,否则会得到错误:

When you go to Keychain > login > My Certificates you will only see certificates that have a private key (the gray arrow indicates that). Since the iPhone Developer certificate from pressing the Revoke button doesn't have a key it won't be in there. According to this you need that key otherwise you'll get the errors:


如果您的iOS开发人员和发行证书未出现在$中b $ b 我的证书 ,则未正确配置它们以在Mac上的
上使用。请注意,证书 是Mac持有的所有
证书的存储库,而我的证书 是证书的
子集仅对Mac实际有效有效-仅在证书 中出现的
证书是不够的。

If your iOS developer and distribution certificates do not appear in "My Certificates", then they are not correctly configured for use on your Mac. Please note that "Certificates" is a repository of all certificates your Mac holds, whereas "My Certificates" is the subset of certificates valid for your Mac to actually use - a certificate appearing in "Certificates" only is not enough.

如果证书不在我的证书中,则很有可能是
,因为您在该
上也没有该证书的正确密钥
苹果电脑。您将需要找到为该
证书创建的私钥(例如,从要求
证书的原始Mac或备份服务器)。

If the certificate is not in My Certificates then this is most likely because you do not have the correct key for that certificate also on that Mac. You will need to locate the private key made for that certificate (i.e., from the original Mac which requested the certificate or a backup server).

只要它们确实出现在我的证书中,它们就在其中。

As long as they do appear in My Certificates, then they key is there.

iPhone Developer证书不会出现在我的证书中,此修复是在您按下撤消按钮,从两者开发者门户网站 Apple。$ iPhone开发者证书。 $ c>> 证书 AND 钥匙串从钥匙串中删除它非常重要!使用到期日期进行查找。请保留 iPhone发行证书,因为它应该可以正常工作并具有密钥(由灰色箭头指示)。

Since the iPhone Developer certificate won't appear in My Certificates the fix is after you press the Revoke button, delete the iPhone Developer certificate that it generates from BOTH the developer portal at developer.apple > certificates AND keychain. It's VERY important you delete it from keychain! Use the expiration date to locate it. Please keep the iPhone Distribution Certificate because that should work fine and have a key (indicated by the gray arrow).

将其从两个两个地方删除后,您可以按照这些说明

After it's deletes from both BOTH places you can manually generate a developer certificate yourself following these directions:

生成代码签名证书手动

1-打开您的钥匙串访问

2-在Apple符号旁边的左上角,选择钥匙串访问> 证书助手> 向证书颁发机构请求证书。

2- In the upper left hand corner next to the Apple sign select Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority...

3-填写用户电子邮件地址(只需使用您的名称)和通用名称(只需使用您的名称),然后选择保存到磁盘即可。我选择了让我指定密钥对信息(也许没有必要),但是在下一个屏幕上,只需使用 Key Size:2048 bits 算法:RSA 。单击继续,然后将生成的certSigningRequest文件保存到桌面。

3- Fill in User Email Address(just use yours) and the Common Name (just use your name) and select Saved to Disk. I selected Let me specify key pair information (maybe it's not necessary) but on the next screen just use the Key Size: 2048 bits and algorithm: RSA. Click on Continue and save the generated certSigningRequest file to your desktop.

4-转到 https://developer.apple.com 并登录到您的帐户。

4- Go to https://developer.apple.com and log in to your account.

5-选择证书,ID和证书。

5- Select Certificates, IDs & Profiles from the left sidebar.

6-转到证书,然后单击右上角的+按钮。

6- Go to Certificates and click on the + button on the top right corner.

7-选择 iOS应用开发,然后单击继续。

7- Select iOS App Development and click Continue.

8-在下一页上,您将看到有关创建certSigningRequest文件的说明。

8- On the next page you see the instructions for creating the certSigningRequest file. Click continue.

9-将创建的certSigningRequest(从第3步,保存到您的桌面)上传到表单,然后单击Continue。

9- Upload the created certSigningRequest (from the 3rd step, the one saved to your desktop) to the form and click continue. It will generate your code signing certificate for you.

10-下载证书并双击安装它。安装后,它将被添加到您的钥匙串访问应用程序中。假设它已保存到您的下载文件夹中,则只需在其中双击即可。

10- Download the certificate and double click to install it. Once installed it will be added to your Keychain Access app. Assuming it saves to your download folder you can just go in there and double click it.

完成这些步骤后,两个错误均应消失。

Once you do those steps both errors should go away.

如果仍然有错误,请在两个门户中的 developer.apple > 证书中查看证书 code>和钥匙串> 我的证书。如果门户中有任何内容,但我的证书中没有,则需要找到它的钥匙串访问权限(在钥匙串> 证书中查看),删除并将其从门户网站中删除。

If you continue to have errors look at the certificates in both the portal at developer.apple > certificates and keychain > My Certificates. If anything is in the portal but isn't in My Certificates then you need to find it keychain access (look in keychain > Certificates), delete it, and delete it from the portal.

我花了一些时间才弄清楚,但是有效期是查找混乱证书的关键。

It took me a while to figure this out but the expiration date is the key to locating messed up certificates.

这篇关于Xcode-如果使用“撤消”按钮创建了私钥,则如何将私钥添加到“开发证书”中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆