如何使用协同设计获取应用程序的 CodeRequirement?

How to get the CodeRequirement of an app using codesign?

我正在阅读 Apple 的配置文件参考,https://developer.apple.com/business/documentation/Configuration-Profile-Reference.pdf,第 65 页指出 CodeRequirement 身份字典键应该是通过命令 codesign -display -r - 获得的字符串:

但是,我无法将这些选项传递给我的 codesign 命令行应用程序。 codesign -d 有效,但只有 returns 可执行文件的路径:

/Applications> codesign -d Slack.app
Executable=/Applications/Slack.app/Contents/MacOS/Slack

然而,codesign -d -r 不起作用:

/Applications> codesign -d -r Slack.app
Usage: codesign -s identity [-fv*] [-o flags] [-r reqs] [-i ident] path ... # sign
       codesign -v [-v*] [-R=<req string>|-R <req file path>] path|[+]pid ... # verify
       codesign -d [options] path ... # display contents
       codesign -h pid ... # display hosting paths

如何使用 codesign 命令行工具为应用程序获取 CodeRequirement

原来少了一个破折号:

> codesign -d -r - /Applications/Slack.app
Executable=/Applications/Slack.app/Contents/MacOS/Slack
designated => identifier "com.tinyspeck.slackmacgap" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = BQR82RBBHL