codesign 在 OSX 上将签名文本文件的签名存储在哪里?

Where does codesign store the signature for a signed text file on OSX?

我有一个具有以下结构的简单应用程序包:

myapp.app/Contents/
myapp.app/Contents/MacOS/myapp
myapp.app/Contents/Resources/empty.lproj
myapp.app/Contents/Info.plist
myapp.app/Contents/PkgInfo

如果我执行

codesign -s "Developer ID" myapp.app/Contents/Info.plist

我可以检查文件是否已用

签名
codesign -d -v myapp.app/Contents/Info.plist

给出以下输出

Executable=/pathToApp/quicknanobrowser.app/Contents/Info.plist
Identifier=Info
Format=generic
CodeDirectory v=20100 size=113 flags=0x0(none) hashes=1+2 location=embedded
Signature size=1278
Signed Time=26 Jan 2016 12:31:24
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=80

文件签名的数据存储在哪里?文件夹结构没有改变(没有新文件),文件的大小没有改变。它是否存储在某些文件系统特定的元数据中?是否可以访问/读取此元数据?

对于非 mach-o 二进制文件,codesign 将签名存储在 per-file 称为 HFS+ 扩展属性的元数据中:

ls -l@ Info.plist

com.apple.cs.CodeDirectory  142 
com.apple.cs.CodeRequirements   180 
com.apple.cs.CodeSignature  8551 

可以通过xattr

查看这些属性的内容
xattr -p com.apple.cs.CodeSignature Info.plist

但该工具似乎喜欢以十六进制转储。似乎没有用于访问属性的 shell shorthand,尽管您过去可以通过将 /rsrc 附加到文件名(例如 cat blah/rsrc)。