如何通过命令行安装用于iOS开发的开发者证书/私钥和配置文件?

发布于 2024-10-06 22:43:50 字数 183 浏览 4 评论 0原文

我正在为 iOS 应用程序项目配置自动构建服务器。 我已经完成了大部分。现在,这是最后一轮。保安。

开发人员证书/私钥和配置文件可以通过 GUI 轻松安装到钥匙串中。但我想通过命令行来实现这一点,甚至可以自动化配置过程。 通过命令行导出/导入证书、私钥、配置文件。

任何建议将不胜感激。

I'm configuring automated build server for iOS application project.
I've done most of it. Now, it's the final round. The security.

Developer certificate/private key and provisioning profile can be easily installed into Keychain with GUI. But I want to do this via command line to automate even the configuring process. Exporting/importing certificates, private keys, provisioning profiles via command line.

Any recommendations will be very appreciated.

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

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

发布评论

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

评论(3

山田美奈子 2024-10-13 22:43:50

始终允许 GUI 被触发,因为尚未为 codesign 提供访问您的私钥的 acl。试试这个:

security unlock-keychain -p <my keychain password>
security import Certificate.p12 -k ~/Library/Keychains/login.keychain -P password -T /usr/bin/codesign

-T 标志告诉安全性允许 codesign 访问您在 Certificate.p12 中导入的密钥。

The always allow GUI is being triggered because codesign hasn't been given an acl to access your private key. try this:

security unlock-keychain -p <my keychain password>
security import Certificate.p12 -k ~/Library/Keychains/login.keychain -P password -T /usr/bin/codesign

The -T flag tells security to allow codesign to have access to the keys you are importing in Certificate.p12.

唠甜嗑 2024-10-13 22:43:50

我从以下地方找到了提示:
http://lists.apple.com/archives/apple-cdsa /2010/Mar/msg00021.html

该命令是security。我正在阅读手册页。我将在试用后稍后更新此答案:)

--(编辑)--

首先,我们必须手动授予“始终允许”对钥匙串中的证书/密钥的访问权限。我不知道如何在没有 GUI 的情况下做到这一点。

并在为每个会话运行构建工具之前运行命令security unlock-keychain。我使用了 SSH,所以我必须为每个登录会话执行一次。

I found hints from:
http://lists.apple.com/archives/apple-cdsa/2010/Mar/msg00021.html

The command is security. I'm reading manual page. I'll update this answer later after trial :)

--(edit)--

First, we have to give 'Always Allow' access to the certificates/keys in the Keychain manually once. I don't know how to do this without GUI.

And run the command security unlock-keychain before running build tool for every session. I've used SSH, so I had to execute it once for every login sessions.

逆蝶 2024-10-13 22:43:50

使用命令行安装证书:

security unlock-keychain -p <machine login password>
security import my_certificate.p12 -k ~/Library/Keychains/login.keychain -P my_password -T /usr/bin/codesign

安装移动配置文件:

简单方法:

#install profiles, will trigger xcode to install the profile
open "my_profile1.mobileprovision"

# wait for xcode to process the request
sleep 3

# shut down xcode (optional)
kill $(ps aux | grep 'Xcode' | awk '{print $2}')

复杂方法:

PROVISION_FILE ="my_profile.mobileprovision"

uuid=`security cms -D -i ${PROVISION_FILE } | grep -aA1 UUID | grep -o "[-a-zA-Z0-9]\{36\}"`

cp "$PROVISION_FILE " ~/Library/MobileDevice/Provisioning\ Profiles/$uuid.mobileprovision

Install certificate using command line:

security unlock-keychain -p <machine login password>
security import my_certificate.p12 -k ~/Library/Keychains/login.keychain -P my_password -T /usr/bin/codesign

Install mobile provision profile:

The simple way:

#install profiles, will trigger xcode to install the profile
open "my_profile1.mobileprovision"

# wait for xcode to process the request
sleep 3

# shut down xcode (optional)
kill $(ps aux | grep 'Xcode' | awk '{print $2}')

The complex way:

PROVISION_FILE ="my_profile.mobileprovision"

uuid=`security cms -D -i ${PROVISION_FILE } | grep -aA1 UUID | grep -o "[-a-zA-Z0-9]\{36\}"`

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