CLI:切换钥匙串以签署 xcodebuild
我正在尝试打开某个钥匙串,然后关闭另一个钥匙串。 我需要这个,因为我们的企业和应用商店标识的名称相同。
现在,我执行“安全解锁钥匙串”,然后执行“安全默认钥匙串”以打开正确的钥匙串,并在我不想使用的钥匙串上执行“安全锁定钥匙串”。
但 xcodebuild 仍然看到两个钥匙串中的条目并放弃。
iPhone Distribution: Company name.: ambiguous (matches "iPhone Distribution: Company name." in /Users/user/Library/Keychains/login.keychain and "iPhone Distribution: Company name" in /Users/user/Library/Keychains/enterprise.keychain)
如何防止系统找到我锁定的钥匙串中的条目?
I am trying to switch on a certain keychain, and close another one.
I need this because our enterprise & appstore identities are called the same.
Right now, I do a "security unlock-keychain" followed by a "security default-keychain" to open the correct keychain and do a "security lock-keychain" on the keychain I wish not to use.
But xcodebuild still sees the entries in both keychains and gives up.
iPhone Distribution: Company name.: ambiguous (matches "iPhone Distribution: Company name." in /Users/user/Library/Keychains/login.keychain and "iPhone Distribution: Company name" in /Users/user/Library/Keychains/enterprise.keychain)
How do I prevent the system from finding the entry in the keychain that I lock?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以告诉 Xcode 使用哪个钥匙串:
或者,如果您直接调用
codesign
:如果您使用 PackageApplication,则无法设置它。然而,PackageApplication 是一个非常简单的脚本,可以在必要时重新实现(如果您要与更大的系统/脚本集成,则非常有用)。
You can tell Xcode which keychain to use:
Or, if you call
codesign
directly:If you use PackageApplication, there isn't a way to set this. However, PackageApplication is a pretty simple script that can be reimplemented if necessary (very useful if you're integrating with a larger system/script).
解决方案:
我已将所有与应用程序商店相关的内容放入登录钥匙串中,并将企业内容放入单独的钥匙串文件中。
在构建脚本中,我按如下方式在它们之间切换:
Solution:
I've put all the appstore related stuff in the login keychain, and the enterprise stuff in a seperate keychain file.
In the buildscript, I switch between those as follows:
xcode 版本 6 及更低版本的另一个解决方案:通过 SHA1 而不是通过(不明确的)名称指定您的证书。来自“man codesign”:
以及来自“security help find-certificate”
不幸的是,此方法需要使用 PackageSign 脚本,该脚本已 在 Xcode 7 中已弃用
Another solution for xcode version 6 and below: specify your certificate by SHA1 instead of by (ambiguous) name. From "man codesign":
And from "security help find-certificate"
Unfortunately, this method requires using the PackageSign script, which has been deprecated in Xcode 7