如何为 iPhone 分发证书创建私钥?
在iPhone开发者计划门户中,有一个视频演示如何创建开发证书和分配私钥
现在我已经完成了开发过程并开始分发
我已经创建了“分发证书”,但是如何分配私钥到这个证书?
因为编译时出现“CodeSign 错误:代码签名身份‘...’与钥匙串中的任何代码签名证书不匹配”,
如果我需要为分发证书分配私钥,我会很高兴现在就告诉我如何。
请注意,我在这里不是在谈论开发证书,谢谢。
In iPhone Developer Program Portal, there's a video to demonstrate how to create a development certificate and assign a private key
Now I have finished the development process and starting to distribute
I have created a "Distribution Certificate", but how do I assign a private key to this certificate?
As it got the "CodeSign error: code signing identity '...' does not match any code-signing certificate in your keychain" when compiles
It will be glad to let me now if I need to assign a private key to the distribution cert and how.
Please be noticed that I am NOT talking about development certificate here, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于自从 Nathan 指出原始答案链接不可用以来,没有人更新或回答这个问题(在 stackoverflow 上发布的第一点“请务必回答问题”),这是我的答案经验,希望它对某人有所帮助:
对于这个特定问题(安装了开发/分发证书但没有私钥),答案是 2 个替代方案的选择:
1。 通过苹果开发者门户创建新的证书身份
在这种情况下,您需要登录苹果开发人员门户并使用助手,作为此过程的一部分,您需要创建并上传 CSR(证书签名请求),这还将在计算机上创建公钥和私钥。 Apple 对请求进行签名,瞧,这是一个签名的公共/私有证书对: 参考
2. 从最初用于创建证书的机器导出私钥
这种情况是当您使用之前创建的身份进行签名时,可能是在旧机器上,或者如果(如我的情况)您为已创建 ID 的客户进行开发。 如果您无法访问最初用于创建证书身份的计算机,您将必须按照指南/助理创建新身份。
为此,您需要通过钥匙串访问导出您的私钥(.p12 文件)或公钥/私钥对,并将私钥或密钥对安装到您进行开发的计算机上。 这是我在 stackoverflow 上找到的指南。
参考:http://iphonedevsdk.com/forum/iphone-sdk-development/11498-problems-exporting-importing-p12-private-key-for-developing-on-another-mac.html
PS> 请注意,我现在正在执行后一个选项,虽然有证据表明这会起作用,但到目前为止我还没有测试过,如果不起作用,我会重新回复!
As no one has updated or answered this question since Nathan pointed out the original answer link is unavailable (Point number one on posting on stackoverflow "Please be sure to answer the question") here is an answer from my experiance, hope it helps someone:
For this specific question (Dev/Distribution cert installed but no private key) the answer is a choice of 2 alternatives:
1. Create a new certificate identity via the apple devloper portal
In this case you'll need to log into the apple developer portal and use the assistant, as part of this you will need to create and upload a CSR (Certificate Signing Request) which will also create the public and private keys on the machine. Apple sign the request and voila, a signed public/private certificate pair : Reference
2. Export the private key from the machine originally used to create the Certificate
This case is when your signing with an identity previously created, probably on an old machine or if (as in my case) your developing for a client that has their ID's already created. If you can't access the machine originally used to create the certificate identity you'll have to create a new identity as per the guide/assistant.
To do this, you will need to export your private key (a .p12 file), or public/private key pair via Keychain Access, and install the private key or key pair to the machine your developing on. Here's a guide I found on stackoverflow.
Ref: http://iphonedevsdk.com/forum/iphone-sdk-development/11498-problems-exporting-importing-p12-private-key-for-developing-on-another-mac.html
PS> Be warned, I am performing the latter option right now, and while evidence suggests this will work, it is untested by me as of yet, If if doesn't work I will re-reply!
请阅读 Xcode 帮助网站的维护签名资产部分。 它以正确的顺序逐步解释您需要执行的操作。
Read the Maintain Signing Assets section of the Xcode Help site. It explains step-by-step what you will need to do, in the correct order.
对我来说 - 重新启动 Xcode 解决了这两个问题。
显然,一切都在某处正确设置,但需要刷新/同步。
For me - restarting Xcode solved both these issues.
Everything was obviously setup correctly somewhere, but needed to be flushed/synced.
如果将鼠标悬停在图像上并单击红色小删除图标,则保存该图像。 离开并返回此页面,您将能够再次添加图标。
If you hover over the image and click the small red delete icon, then save this. Navigate away and come back to this page you will be able to add the icon again.