xcode 从命令行确定代码签名身份?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7747230/
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-09-14 22:06:33  来源:igfitidea点击:

Determining codesigning identities from the command line?

iphoneiosxcodecode-signingcodesign

提问by Matt Blackmon

I'm trying to set up an automated way to sign my iOS apps. Before using codesign, is there a way to programmatically determine from the command line what my valid signing identities are?

我正在尝试设置一种自动方式来签署我的 iOS 应用程序。在使用 codesign 之前,有没有办法从命令行以编程方式确定我的有效签名身份是什么?

For example, for the command

例如,对于命令

codesign -v --sign "iPhone Distribution: Joe Developer" /path/to/app

How could I figure out that "iPhone Distribution: Joe Developer" is a valid identity? How would I figure other valid identities?

我怎么知道“iPhone Distribution:Joe Developer”是一个有效的身份?我将如何计算其他有效身份?

I'd prefer a way to do this from within a command line, but from within cocoa would work as well.

我更喜欢从命令行中执行此操作的方法,但从可可中也可以使用。

回答by Dov

To get a list of signing identities, I found the perfect answer in this objc.io article:

为了获得签名身份列表,我在这篇 objc.io 文章中找到了完美的答案:

security find-identity -v -p codesigning

It gives output like:

它提供如下输出:

1) 4E8D512C8480FAC679947D6E50190AE9BAB3E825 "3rd Party Mac Developer Application: Developer Name (DUCNFCN445)"
2) 8B0EBBAE7E7230BB6AF5D69CA09B769663BC844D "Mac Developer: Developer Name (DUCNFCN445)"
3) 4E8D512C8480AAC67995D69CA09B769663BC844D "iPhone Developer: App Developer (DUCNFCN445)"
4) 65E24CDAF5B3E1E1480818CA4656210871214337 "Developer ID Application: App Developer (DUCNFCN445)"
   4 valid identities found