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

4

我有一个应用程序, 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和构建设置,但找不到导致这种情况的地方。

1个回答

6
原来指定要求中的标识符来自于应用程序的Info.plist文件。由于这个应用程序是一个命令行应用程序,因此默认情况下没有info.plist文件。我想使用SMJobBless运行这个助手,所以我创建了一个info.plist文件,并将其嵌入到应用程序中(使用链接器中的- sectcreate)。但我没有在打包构建设置中设置“Info.plist文件”。当我正确指定Info.plist时,代码签名可以验证应用程序。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接