代码签名:指定需求的标识符与应用程序标识符不匹配

时间:2013-11-11 19:21:10

标签: 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中的标识符不匹配?

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

1 个答案:

答案 0 :(得分:2)

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

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

我没做的是在打包构建设置中设置“Info.plist文件”。当我正确指定Info.plist时,代码签名可以验证应用程序。