xcode - 代码签名 : Identifier of Designated Requirements mismatches app identifier

标签 xcode macos code-signing

我有一个 codesign 无法完全验证的应用程序,因为它“不满足其指定的要求”。第一次检查返回“在磁盘上有效”,所以没关系。
codesign -dvvvv -r- PATH_TO_APP 告诉我要求,它是:

Identifier=com.foobar.BarBuz-Helper
[...]
designated => anchor apple generic and identifier "com.foobar” and
  (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or 
  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] = XXXXXXXXXX)

看起来正确。除了应用程序的标识符实际上不是“com.foobar”而是“com.foobar.BarBuz-Helper”,我认为这就是它不满足其要求的原因。

Xcode 使用错误的标识符对应用程序进行签名。这是运行的 Xcode 命令:
CodeSign /Users/matthias/[…]-Helper
    setenv CODESIGN_ALLOCATE /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    Using code signing identity "Developer ID Application: Matthias Bauch"
    /usr/bin/codesign --force --sign 0123456789 --requirements =designated\ =>\ anchor\ apple\ generic\ \ and\ identifier\ \"com.foobar\"\ and\ ((cert\ leaf[field.1.2.840.113635.100.6.1.9]\ exists)\ or\ (\ 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]\ =\ \"XXXXXXXXXX\"\ )) /Users/matthias/[...]-Helper

我不知道为什么会发生这种情况。

有人知道这里出了什么问题吗?应用程序从哪里获得其指定的代码签名要求?为什么应用的标识符与 DR 中的标识符不匹配?

我检查了所有的 plist 和build设置,我找不到发生这种情况的地方。

最佳答案

事实证明,指定需求中的标识符来自应用程序的 Info.plist。

由于此应用程序是命令行应用程序,因此默认情况下它没有 info.plist。我想用 SMJobBless 运行这个助手,所以我创建了一个 info.plist 并且我将 plist(链接器中的 -sectcreate)嵌入到应用程序中。

我没有做的是在打包build设置中设置“Info.plist 文件”。当我正确指定 Info.plist 时,codesign 可以验证应用程序。

关于xcode - 代码签名 : Identifier of Designated Requirements mismatches app identifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19914159/

相关文章:

ios - 如何将 View Controller 中的数据传递到另一个 View Controller 中的 Collection View ?

java - Mac 上 Eclipse src 文件夹中图像文件的路径

clickonce - Authenticode 代码签名非常慢

xcode 7.3 UI测试随机通过或失败

ios - Swift 中的简单 TableView 出现问题,错误 SIGNAL SIGART

xcode - 通过使用 UIbutton 在 lightContent 和默认值之间切换来更新状态栏外观

python - Apple Python 启动器作用于命令键绑定(bind)

macos - SwiftUI macOS 禁用滚动指示器背景

code-signing - 代码签名证书有什么特别之处?

java - 使用 Maven + Java + Clojure 确保良好的安全性/代码签名