ios 如何将私钥添加到分发证书?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16563364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 23:35:38  来源:igfitidea点击:

How can I add private key to the distribution certificate?

iosxcodekeychainsigning

提问by Pau Senabre

Well, I've got my Developer Certificate linked with it's private key. Works Fine.

好吧,我已经将我的开发人员证书与其私钥相关联。工作正常。

I've downloaded my iOS Profile of distributor, but it says Valid signing identity not found.

我已经下载了经销商的 iOS 配置文件,但显示未找到有效的签名身份。

So I checked my certificates, and exactly, my developer certificate it's linked with its private key but not my distribution certificate. How can I link/add my private keys to this certificate!?

所以我检查了我的证书,确切地说,我的开发人员证书与其私钥相关联,但不是我的分发证书。如何将我的私钥链接/添加到此证书!?

Will this solve the problem "Valid Signing identity not found"?

这会解决“未找到有效签名身份”的问题吗?

回答by Daniel Martín

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.

是的,您收到的错误意味着您的 Mac 上没有与您尝试用来签署应用程序的分发证书相关联的私钥。

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)

如果请求分发证书的计算机可用(或某处有分发资产的备份)

  1. From the computer where the distribution asset was generated, open Xcode.
  2. Click on Window, Organizer.
  3. Expand the Teams section.
  4. Select your team, select the certificate of "iOS Distribution" type, click Export and follow the instructions.
  5. Save the exported file and go to your computer.
  6. Repeat steps 1-3.
  7. Click Import and select the file you exported before.
  1. 在生成分发资产的计算机上,打开 Xcode。
  2. 单击窗口、管理器。
  3. 展开团队部分。
  4. 选择您的团队,选择“iOS Distribution”类型的证书,单击“导出”并按照说明进行操作。
  5. 保存导出的文件并转到您的计算机。
  6. 重复步骤 1-3。
  7. 单击导入并选择您之前导出的文件。

If the computer where the distribution profile was created is not accessible anymore (and there is not a backup)

如果创建分发配置文件的计算机无法再访问(并且没有备份)

You have to revoke the certificate and create a new one.

您必须撤销证书并创建一个新证书。

You may need to ask your team admin or agent to give you some privileges in order to generate distribution certificates. Once you have enough privileges, follow these steps (accurate as of 15-May-2013):

您可能需要请您的团队管理员或代理授予您一些权限才能生成分发证书。获得足够的权限后,请按照以下步骤操作(截至 2013 年 5 月 15 日准确):

  1. Go to this webpage: https://developer.apple.com/devcenter/ios/index.action
  2. Click on "Member Center" and enter your iOS developer credentials.
  3. Click on "Certificates, Identifiers & Profiles".
  4. Click on "Certificates" under the "iOS Apps" section.
  5. Expand the Certificates section on the left, select Distribution, and click on your distribution certificate.
  6. Click Revoke and follow the instructions.
  7. Click on the plus sign to add a new certificate.
  8. Select "App Store and Ad Hoc" option, and click Continue.
  9. Follow the steps printed in the webpage. That involves opening the Keychain application on your Mac and generate a Certificate Signing Request from there. Click Continue.
  10. Upload the .csr file and click Continue.
  11. A certificate is generated for distribution. Download it and double click it to integrate it in your keychain.
  1. 转到此网页:https: //developer.apple.com/devcenter/ios/index.action
  2. 单击“会员中心”并输入您的 iOS 开发人员凭据。
  3. 单击“证书、标识符和配置文件”。
  4. 单击“iOS 应用程序”部分下的“证书”。
  5. 展开左侧的证书部分,选择分发,然后单击您的分发证书。
  6. 单击“撤销”并按照说明进行操作。
  7. 单击加号以添加新证书。
  8. 选择“App Store 和 Ad Hoc”选项,然后单击“继续”。
  9. 按照网页上打印的步骤操作。这涉及在 Mac 上打开 Keychain 应用程序并从那里生成证书签名请求。单击继续。
  10. 上传 .csr 文件并单击继续。
  11. 生成用于分发的证书。下载并双击它以将其集成到您的钥匙串中。

Reopen Xcode and check your project configuration to see if you can now select an "iPhone Distribution" certificate (i.e. it's not grayed out).

重新打开 Xcode 并检查您的项目配置,看看您现在是否可以选择“iPhone Distribution”证书(即它没有变灰)。

回答by andrewb

Since the existing answers were written, Xcode's interface has been updated and they're no longer correct (notably the Click on Window, Organiser // Expand the Teams sectionstep). Now the instructions for importing an existing certificate are as follows:

由于已编写现有答案,Xcode 的界面已更新,它们不再正确(尤其是单击窗口、组织器 // 展开团队部分步骤)。现在导入现有证书的说明如下:

To export selected certificates

  1. Choose Xcode > Preferences.
  2. Click Accounts at the top of the window.
  3. Select the team you want to view, and click View Details.
  4. Control-click the certificate you want to export in the Signing Identities table and choose Export from the pop-up menu.

Export certificate demo

  1. Enter a filename in the Save As field and a password in both the Password and Verify fields. The file is encrypted and password protected.
  2. Click Save. The file is saved to the location you specified with a .p12 extension.

导出选定的证书

  1. 选择 Xcode > 首选项。
  2. 单击窗口顶部的帐户。
  3. 选择您要查看的团队,然后单击查看详细信息。
  4. 在“签名身份”表中按住 Control 键并单击要导出的证书,然后从弹出菜单中选择“导出”。

出口证书演示

  1. 在另存为字段中输入文件名,并在密码和验证字段中输入密码。该文件已加密并受密码保护。
  2. 单击保存。该文件将保存到您使用 .p12 扩展名指定的位置。

Source (Apple's documentation)

来源(Apple 的文档)

To import it, I found that Xcode's let-me-help-you menu didn't recognise the .p12 file. Instead, I simply imported it manually into Keychain, then Xcode built and archived without complaining.

为了导入它,我发现 Xcode 的 let-me-help-you 菜单无法识别 .p12 文件。相反,我只是将它手动导入到 Keychain 中,然后 Xcode 构建和存档,没有任何抱怨。

回答by Jorge Casariego

With Xcode 9 the interface has been updated and now the way I did to resolve the problem was this:

使用 Xcode 9,界面已经更新,现在我解决问题的方法是这样的:

  1. Choose Xcode > Preferences.
  2. Click Accountsat the top of the window.
  3. Select the teamyou want to view
  4. Click the gear icon () in the lower-left.
  1. 选择Xcode > 首选项
  2. 单击窗口顶部的帐户
  3. 选择您要查看的团队
  4. 单击左下角的齿轮图标 ( )。

enter image description here

在此处输入图片说明

  1. Export Apple Id and Code Signing Assets
  2. After entering a filename in the Save As field and a password in both the Password and Verify fields you'll see a Window like this
  1. 导出 Apple Id 和代码签名资产
  2. 在另存为字段中输入文件名并在密码和验证字段中输入密码后,您将看到这样的窗口

enter image description here

在此处输入图片说明

  1. Click the gear icon () -> Click Import -> Select the file you exported in step 6
  1. 单击齿轮图标 ( ) -> 单击导入 -> 选择您在步骤 6 中导出的文件

回答by Buntylm

This site explain step by step that what you need to do Certificates, Identifiers & Profilesand as your question

该站点逐步解释了您需要做什么证书、标识符和配置文件以及作为您的问题

"Valid Signing identity not found"?

You need the private key that were used to sign the code base with provisioning profile. . If you don't have then you can generate a new signing request on the iOS developer portal.

您需要用于使用配置文件对代码库进行签名的私钥。. 如果没有,则可以在 iOS 开发人员门户上生成新的签名请求。

For Export:

Xcode -> Organizer, select your team. Click Export. Specify a filename and a password, and click Save.`

Xcode -> Organizer,选择你的团队。单击导出。指定文件名和密码,然后单击保存。`

For Import:

Xcode -> Organizer, select your team. Click Import. Select the file containing your code signing assets. Enter the password for the file, and click Open.

Xcode -> Organizer,选择你的团队。单击导入。选择包含代码签名资产的文件。输入文件的密码,然后单击“打开”。

回答by Amar

For Developer certificate, you need to create a developer .mobileprovision profile and install add it to your XCode. In case you want to distribute the app using an adhoc distribution profile you will require AdHoc Distribution certificate and private key installed in your keychain.

对于开发人员证书,您需要创建一个开发人员 .mobileprovision 配置文件并将其添加到您的 XCode 中。如果您想使用临时分发配置文件分发应用程序,则需要在您的钥匙串中安装临时分发证书和私钥。

If you have not created the cert, here are steps to createit. Incase it has already been created by someone in your team, ask him to share the cert and private key. If that someone is no longer in your team then you can revoke the cert from developer account and create new.

如果您尚未创建证书,请按照以下步骤创建证书。如果它已经由您团队中的某个人创建,请让他共享证书和私钥。如果那个人不再在你的团队中,那么你可以从开发者帐户中撤销证书并创建新的。

回答by sleepwalkerfx

"Valid Signing identity not found" This is because you don't have the private key for distribution certificate.

“未找到有效签名身份”这是因为您没有分发证书的私钥。

If the distribution certificate was created originally on a different Mac you may need to import this private key from that Mac. This private key is not available to download from your provisioning portal.

如果分发证书最初是在不同的 Mac 上创建的,您可能需要从该 Mac 导入此私钥。无法从您的配置门户下载此私钥。

When you import the correct private key to your mac , XCode's organizer will recognize your already downloaded distribution profile as a "Valid profile"

当您将正确的私钥导入您的 mac 时,XCode 的组织者会将您已下载的分发配置文件识别为“有效配置文件”

However if you do not have access to the original Mac which created those profiles, the only option you have is revoking profiles.

但是,如果您无权访问创建这些配置文件的原始 Mac,您唯一的选择就是撤销配置文件。

回答by Kursat Turkay

since xcode5 organizer no longer team section exists. but the bold sentence was the answer for me. God thanks there is another mac to restore and import to problemmatic mac. now all is ok.

因为 xcode5 组织者不再存在团队部分。但大胆的句子是我的答案。上帝,感谢有另一个 mac 可以恢复并导入到有问题的 mac。现在一切正常。

回答by Logic

What i did is that , i created a new certificate for distribution form my Mac computer and gave signing identity from this Mac computer as well, and thats it

我所做的是,我为我的 Mac 计算机的分发创建了一个新证书,并从这台 Mac 计算机上提供了签名标识,就是这样