如何使用现有的私钥来获取新的 iOS 开发证书?
出于美观原因,我想使用不久前创建分发证书时使用的相同私钥来创建新的开发证书(我的旧证书已过期)。但 iOS 配置门户上的“如何创建开发证书:”要求您使用 Keychain Access 创建新密钥。当我尝试执行“钥匙串访问”时 >证书助理>使用“(我的密钥名称)”从证书颁发机构请求证书,证书助手实际上并不创建 CSR 文件。
有谁知道这是否可以做到,如果可以,如何做到?
For aesthetic reasons, I would like to use the same private key that I used to create my distribution certificate a while ago, to create a new development certificate (my old one expired). But the "How to create a development certificate:" on the iOS provisioning portal require that you use Keychain Access create a new key. When I try to do Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority With "(my key name)" the Certificate Assistant doesn't actually create a CSR file.
Does anyone know if this can be done, and if so, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
首先,我必须将我的私钥从钥匙串导出为 p12 文件。我尝试编写此脚本,但没有成功。
运行以下 openssl 命令将受密码保护的 p12 文件转换为 pem。 openssl 将提示输入密码。
对 pem 文件运行以下命令以生成 csr。
First, I had to export my private key from the keychain as a p12 file. I tried scripting this, but was unsuccessful.
Run the following openssl command to convert your password-protected p12 file to a pem. openssl will prompt for a password.
Run the following command on your pem file to generate the csr.
要从钥匙串访问中的现有私钥生成 CSR,只需右键单击(两指单击)您要使用的私钥并选择
使用“(我的密钥名称)”向证书颁发机构请求证书
然后输入用户电子邮件地址和 CA 电子邮件地址(我只是对两者使用相同的电子邮件地址),然后选择“保存到磁盘”。
To generate a CSR from an existing Private Key in Keychain Access, just right-click (two-finger click) on the Private Key you want to use and choose
REQUEST A CERTIFICATE FROM A CERTIFICATE AUTHORITY WITH "(My Key Name)"
Then enter the User Email Address and CA Email Address (I just use the same email address for both) and then choose Saved To Disk.
您对 OpenSSL 和命令行感到满意吗?邮件列表上有一个关于创建 CSR 的讨论手动。 FWIW,我也无法使用钥匙串访问/证书助手中选定的密钥创建 CSR。
Are you comfortable with OpenSSL and the command-line? There's a discussion on a mailing list about creating the CSR manually. FWIW, I wasn't able to create a CSR using a selected key in Keychain Access/Certificate Assistant either.
我今天经历了这个地狱。我想通过命令行自动导出密钥以创建 CSR。我发现一个用
c
编写的工具可以满足我的需求:keychain_access。我编译并使用了它,但无法导出我的分发密钥。我使用最新的苹果安全 API 和钥匙串项目属性打印再次从头开始创建该工具,但仍然无法通过标签找到密钥。我能够在没有标签搜索的情况下列出它。在绝望的尝试中,我将钥匙串访问工具重命名为 key 并将其重命名回旧名称。之后我的工具终于通过标签拾取了密钥。并且右键单击使用“(我的密钥名称)”从证书颁发机构请求证书
也开始再次起作用。看来该名称是以不同的编码或其他方式保存的。不是苹果自己的钥匙串访问工具能够找到钥匙!I went through this hell today. I wanted to automate the export of a key to create the CSR via commandline. I found a tool written in
c
that promised what I wanted: keychain_access. I compiled and played around with it but wasn't able to export my distribution key. I created the tool again from scratch with the newest apple security API's and keychain item attribute printing, but still wasn't able to find the key by label. I was able to list it with no label search. In an desperate attempt I renamed to key in the keychain access tool and renamed it back to the old name. After that my tool finally picket up the key by label. And also the right clickREQUEST A CERTIFICATE FROM A CERTIFICATE AUTHORITY WITH "(My Key Name)"
started to work again as well. It seems that the name was saved in a different encoding or something. Not event apples own keychain access tool was able to find the key!