代码设计错误:证书标识出现两次

发布于 2024-11-06 08:14:41 字数 165 浏览 2 评论 0原文

CodeSign 错误:证书身份“iPhone 开发人员:XXXX (12345678)”在钥匙串中出现多次。协同设计工具只需要一个。

所以我转到我的钥匙串并将其删除。但每次重新启动 Xcode 4 时都会出现此错误,并且某些应用程序将过期的旧证书添加回钥匙串中。有什么想法为什么以及哪个应用程序吗?

CodeSign error: Certificate identity 'iPhone Developer: XXXX (12345678)' appears more than once in the keychain. The codesign tool requires there only be one.

So I go to my keychain and delete it. But I get this error every time I restart Xcode 4 and some app is adding the expired old certificate back into keychain. Any ideas why and which app?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

┊风居住的梦幻卍 2024-11-13 08:14:41

我刚刚遇到了同样的问题。
已修复。
这是在我提交了一个应用程序并安装了一些证书来签署该应用程序之后发生的。

快速修复:
打开钥匙串访问>单击“我的证书”>在那里你可能会看到
iPhone 开发者: .您可能会看到它两次!
选择到期日期最早的那个,右键单击并选择“删除”。

如果没有,请重新启动 Xcode。
现在可以工作了。

I just had the same problem.
It's been fixed.
It came after I submitted an app and installed a few certificates to sign the app.

Quick Fix:
Open up KEYCHAIN ACCESS > click on MY CERTIFICATES> in there you will probably see
iPhone Developer: . You will probably see it TWICE!
Select the one with the earliest Expiration date, right click and select DELETE.

Restart Xcode if you haven't.
Works now.

长发绾君心 2024-11-13 08:14:41

我想我明白了为什么简单的删除不起作用。因为开发证书仍然存储在配置文件中,所以当我删除钥匙串中的证书后关闭/重新打开 Xcode 时,我看到旧证书又回来了。所以我又删除了。它起作用了。

简单的删除配置文件解决方案对我不起作用。

在我的案例中有效的解决方案:

  1. 退出 Xcode
  2. 如果钥匙串访问已打开,请保持打开状态。
  3. 现在启动 Xcode。
  4. 请注意,Xcode 抱怨的证书将在启动时从其缓存重新添加到钥匙串中。
  5. 继续删除它。
  6. 编译并快乐编码。

I think I figured out why the simple delete is not working. Because the dev certificate is still stored in the provision profile, when I close/re-open the Xcode after deleting the certificate in Keychain, I saw the old certificate come back. So I delete it again. It worked.

The simple delete the profile solution did not work for me.

Solution that worked in my case:

  1. Quit Xcode
  2. If the Keychain access is open, keep it open.
  3. Launch Xcode now.
  4. See that the certificate Xcode was complaining about will be re-added into the keychain at launch from its cache.
  5. Go ahead and delete it.
  6. Compile and happy coding.
成熟稳重的好男人 2024-11-13 08:14:41

我意识到这是 Xcode 中的一个错误。这篇文章给了我解决这个问题的线索:
证书神奇地重新出现在您的钥匙串中

就我而言,匹配的私钥位于系统钥匙串中,并且上面只有我的名字(很难说它是用于配置的)。我必须:

  • 将关联的私钥移至“登录”钥匙串
  • 重新启动 Xcode,并注意到私钥现在显示为关联(确认其用途)
  • 删除证书和私钥
  • 重新启动 Xcode 并噗!它停止添加我的旧证书

一个有趣的观察是,当您删除证书时,它不会删除关联的私钥。从视觉上看,它显示了证书下方的私钥。别被愚弄了。

I came to realize that it's a bug in Xcode. This post gave me a clue to fix it:
certificates magically re appearing in your keychain

In my case, the matching private key was in the System keychain, and just had my name on it (hard to tell it was for provisioning). I had to:

  • Move the associated private key to 'login' keychain
  • Restarted Xcode and noticed that the private key was now showing as associated (confirms what it was for)
  • Delete the cert and private key
  • Restart Xcode and poof! It stopped adding my old cert

An interesting observation is that when you delete the certificate, it doesn't delete the associated private key. Visually, it shows the private key below the cert. Don't be fooled.

无所的.畏惧 2024-11-13 08:14:41

好的,找到了另一个“相关”问题的答案。
Xcode 证书过期问题
Xcode 4 的已知问题
http://openradar.appspot.com/9173280

Ok, found the answer on another "Related" question.
Xcode expired certificate problem
Known issue with Xcode 4
http://openradar.appspot.com/9173280

蓝海 2024-11-13 08:14:41

如果您是 iOS Developer 和 Enterprise iOS Developer 计划的成员,并且您在两个应用程序中输入了相同的公司名称,那么您最终将获得两个具有相同名称的有效分发证书。

我相信这个问题解决了这种情况:
开发人员和企业分发之间的 CodeSign 冲突

If you are a member of the iOS Developer and Enterprise iOS Developer programs and you entered your company name in the same for both applications, you will end up with two valid distribution certificates with the same name.

I believe this question addresses that situation:
CodeSign collisions between Developer and Enterprise Distribution

浅笑轻吟梦一曲 2024-11-13 08:14:41

答案是这里

使用旧证书和管理器删除所有旧的配置文件,然后退出 XCode,从钥匙串中删除旧证书并重新启动 XCode。

当您在配置文件中引用 时,看起来 xcode 会保留证书

Answer is here

remove all of my old provisioning profiles using the old certificate with Organizer then quit XCode, remove the old certificate from Keychain and restart XCode.

looks like the xcode will keep certificates around when you have references to the in the provisioning profiles

浅忆流年 2024-11-13 08:14:41

我对 xcode45-DP1 也有同样的问题。这对我有用:

  1. 从钥匙串中删除与您的帐户相关的所有证书。退出钥匙串

  2. 从 xcode:organizer:device:Library:provisioning profile 中删除与您的帐户相关的所有配置配置文件。退出 xcode

  3. 撤销您的证书并重新生成它并将其下载到您的构建机器

  4. 在下载配置文件之前,请单击下载按钮旁边的编辑,以确保选择您的名称。

  5. 然后下载配置文件

  6. 双击证书将其安装到钥匙串

  7. 将配置文件拖到 xcode:organizer:device:Library:provisioning profile

  8. 不要单击 xcode 中的刷新按钮。

  9. 进行构建。

I have the same issue with xcode45-DP1. this works for me:

  1. Remove all certificates related to your account from keychain. QUIT keychain

  2. Remove all provisioning profiles related to your account from xcode:organizer:device:Library:provisioning profiles. QUIT xcode

  3. Revoke your certificate and regenerate it and download it to your build machine

  4. Before download provisioning profile, click on Edit next to the download button to make sure your name is selected.

  5. Then download the provisioning profile

  6. Double click on the certificate to install it onto keychain

  7. Drag the provisioning profile to xcode:organizer:device:Library:provisioning profiles

  8. Do not click the refresh button from the xcode.

  9. Make the build.

疏忽 2024-11-13 08:14:41

我在将僵尸证书重新填充到我的钥匙串中并且证书身份出现两次时遇到问题。简单地删除重复的证书是行不通的。

在 Xcode 中,当我查看目标中的代码签名时,我记得“Ad Hoc”构建中的分发配置文件与“Release”构建中的分发配置文件不同。

当我生成新证书时,我只下载了 Ad Hoc 版本的新配置文件,而不是 Release 版本。

Xcode 挂在这两个配置文件的证书上,因此 Xcode 导致了重复的证书......因为我忘记正确更新我的配置文件。

确保将所有配置文件更新为新证书,并在 Xcode 中同时更改所有配置文件。

请务必使用新证书更新所有配置文件,否则 Xcode 将尝试将两个配置文件的证书放入钥匙串中。 ..导致重复错误!

I was having trouble with zombie certificates being repopulated into my keychain and the certificate identity appearing twice. Simply deleting the duplicate cert did not work.

In Xcode, when I looket at my Code Signing in the target, I remembered I had a different distribution profile in "Ad Hoc" builds than "Release" builds.

When I generated a new certificate, I only downloaded a new profile for Ad Hoc builds, and not for Release builds.

Xcode was hanging onto the certificate for both of those profiles, and Xcode was therefore causing the duplicate certificates... because I forgot to update my profiles properly.

Make sure to update ALL your provisioning profiles to the new certificate, and change ALL the profiles at the same time in Xcode.

Be sure to update all your provisioning profiles with the new certificate, otherwise Xcode will try to put the certificate for BOTH profiles in the keychain... causing the duplicate error!

平安喜乐 2024-11-13 08:14:41

我遇到了这个问题并阅读了所有相关信息,最后我自己找到了解决方案。人们没有提到的是,清理 Xcode 管理器中的证书和 清理钥匙串中的过期密钥之前,您需要确保没有任何过期的密钥配置门户中的证书。
如果您有一个使用旧开发人员证书的旧应用程序的过期证书,Xcode 会在第一次构建时将其拉入其管理器,然后从那里它将转到您的钥匙串并导致重复。

I had this problem and read every piece of information about it, finally I've found the solution on my own. What people failed to mention is that BEFORE cleaning the certificates in Xcode organizer and BEFORE cleaning the expired keys in your keychain you need to make sure that you don't have any expired certificates in the Provisioning Portal.
If you'll have even one expired certificate for an old app that used the old Developer certificate Xcode will pull that into its organizer with first build and from there it will go to your keychain and will cause a duplicate.

远昼 2024-11-13 08:14:41

就我而言,Xcode 正在查看的“缓存”是一个附加的 iOS 设备。要确定这是否是您的问题:

  1. 断开所有 iOS 设备
  2. 从钥匙串访问中删除有问题的证书和私钥
  3. 重新启动 Xcode
  4. 检查钥匙串访问:在我的情况下,此时未重新创建副本
  5. 重新连接 iOS 设备
  6. 再次重新启动 Xcode
  7. 检查钥匙串访问:就我而言,此时已重新创建重复项

如果这是您的根本原因,您可以通过确保在启动 Xcode 之前断开 iOS 设备的连接来解决此问题。

In my case, the "cache" Xcode was looking at was an attached iOS device. To determine if this is the problem for you:

  1. Disconnect all iOS devices
  2. Delete offending certificate and private key from Keychain Access
  3. Restart Xcode
  4. Check Keychain Access: in my case the duplicate was NOT recreated at this point
  5. Reconnect the iOS device
  6. Restart Xcode again
  7. Check Keychain Access: in my case the duplicate was recreated at this point

If this is the root cause for you, you can get round it by making sure you disconnect iOS devices before starting Xcode.

千寻… 2024-11-13 08:14:41

简单地删除冗余证书对我来说不起作用。似乎每次调用 xcodebuild 时,它都会从某处的缓存“重新创建”钥匙串中的证书...与 avi 我为它创建了一个黑客/修复程序,试图找到文件的缓存位置并清除它,但没有运气。最后,对我有用的(有点黑客,但是嘿,你还能做什么)是找出证书编号是什么,并在调用 xcodebuild 后不久手动将其从钥匙串中删除。首先,转到 /usr/bin/ 目录(或者任何有 xcodebuild 文件的目录,尝试 which xcodebuild)并运行以下命令:

sudo mv xcodebuild xcodebuild_actual

然后使用您最喜欢的编辑器创建一个文件(不要忘记sudo)并使用以下代码:

xcodebuild_actual $* &
echo "xcodebuild started, waiting to wipe certificate, 10 seconds"
sleep 2
echo "Wiping Certificate..."
sudo security -v delete-certificate -t -Z 407629F811D52C0BB7AD31BBB18DCB496354B05E

注意:您必须修改 sudoers 文件才能无需输入密码即可运行此特定命令。

将上面 -Z 之后的十六进制标识替换为有问题的僵尸证书的十六进制标识。最后,确保 xcodebuild 文件是可执行的:

sudo chmod 755 xcodebuild 

您现在可以打开钥匙串并运行构建命令,并观察有问题的僵尸证书如何复活,然后在它成为协同签名问题之前立即将其消灭。希望苹果能够为此提供真正的解决方案。

Simply deleting the redundant certificate didn't work for me. It seems that every time xcodebuild is called, it is "Re-creating" the certificate in the keychain from a cache somewhere... same issue as avi I created a hack / fix for it, tried to find where the file was getting cached and clear it, but had not luck. In the end, what worked for me (a bit of a hack, but hey, what else can you do), was to figure out what the certificate number is, and manually remove it from the keychain shortly after xcodebuild is called. First, go to your /usr/bin/ directory (or whatever directory has your xcodebuild file, try which xcodebuild) and run the following command:

sudo mv xcodebuild xcodebuild_actual

Then create a file using your favorite editor (don't forget to sudo) with the following code:

xcodebuild_actual $* &
echo "xcodebuild started, waiting to wipe certificate, 10 seconds"
sleep 2
echo "Wiping Certificate..."
sudo security -v delete-certificate -t -Z 407629F811D52C0BB7AD31BBB18DCB496354B05E

Note: you'll have to modify your sudoers file to have access to run this specific command without having to enter a password.

Replace the hex identity after -Z above with the hex identity of the offending zombie certificate. Finally, make sure that the xcodebuild file is executable:

sudo chmod 755 xcodebuild 

You can now open your keychain and run the build command, and watch how the offending zombie certificate is resurrected, and then summarily shotgunned prior to it becoming a problem for codesigning. Hopefully Apple will come up with a real fix for this.

枯寂 2024-11-13 08:14:41

就我而言,删除证书不起作用。 XCode 4 似乎可以缓存或恢复它们。最终对我有用的技巧是让钥匙串和 xcode 运行。然后在钥匙串中将我的 2 个证书(dev+dist)从“登录”拖到“系统”。然后重复项神奇地重新出现,我能够删除它们,然后我将证书拖回“登录”

In my case deleting the certificates didnt work. XCode 4 seems to cache or restore them. The trick that finally worked for me was to have keychain and xcode running. Then in keychain drag my 2 certificates (dev+dist) from 'login' to 'system'. Then the duplicates magically reappeared and i was able to delete them, and then i dragged the certificates back to 'login'

蓝颜夕 2024-11-13 08:14:41

这很简单,将正确的证书导出到您的桌面即可。删除该证书
在钥匙串中。尝试构建带有错误消息的源(没有证书..)
然后再次导入证书。 =>成功!

It's very easy, export the correct Certificate to your desktop. Delete that Certificate
in the keychain. Try to build source with error message (have no cert..)
Then import again the certificate. => Success!

人│生佛魔见 2024-11-13 08:14:41

我刚刚删除了钥匙串中我不再需要的证书的私钥之一。

即使证书重新出现,但私钥也不会重新出现。现在检查有效证书,只会出现一个证书,其他私钥被删除的证书将不再显示在有效证书下。

我认为这是解决这个问题的最简单的方法。

I just deleted one of the private keys in my keychain for the certificate that I don't need any more.

Even though the certificate re-appers but the private key doesn't reappear. Now check for the valid certificates and only one certificate will appear and the other certificates whose private key is deleted is no longer displayed under valid certificates.

I think this is the simplest way to resolve this issue.

少年亿悲伤 2024-11-13 08:14:41

我曾经处理过同样的问题。我已经通过从 xcode 的 Organizer 选项卡中删除未使用的配置文件来解决这个问题。实际上,钥匙串将从该配置文件中获取该证书,该证书要么是过期的证书,要么是通过吊销的证书构建的。

因此,您只需从“管理器”选项卡中删除此配置文件即可。管理器位于 xcode 的右上角按钮上,打开它,然后在管理器中删除您不使用的配置文件。

这是屏幕截图,

在此处输入图像描述

并且不要忘记从钥匙串中删除额外的证书,但之后这些证书没有再次出现。

I was dealing with same problem once. And I have solved it by removing unused provisioning profile from Organizer tab in xcode. Actually Keychain will get that certificate from this provisioning profile which is either expired certificate or the build by revoked certificate.

So you just have to delete this provisioning profile from Organizer tab. Organizer is on right-top side button of xcode Open it and than in Organizer remove the provisioning profiles that you don't using.

Here is the screenshot,

enter image description here

And don't forget to remove extra certificate from the keychain but after that those certificate does not appear again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文