如何使用代码读取协同设计信息

How to read codesign information using code

我想验证一个文件的代码签名,我可以使用 codesign -dv 从命令行获取信息。

Executable=/Users/user/XXXXXXXX.txt
Identifier=com.apple.xxxxxx
Format=bundle with Mach-O thin (x86_64)
CodeDirectory v=20200 size=281 flags=0x200(kill) hashes=4+5 location=embedded
Hash type=sha1 size=20
CDHash=ca2c3d47e597a19d7776e248832169488bc8c4a0
Signature size=4169
Authority=Apple Mac OS Application Signing
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Info.plist entries=31
TeamIdentifier=K36BKF7T3D
Sealed Resources version=2 rules=8 files=151
Internal requirements count=1 size=128

但是有什么方法可以使用代码获取相同的信息。

是的。 codesign 工具的源代码可在 http://www.opensource.apple.com/source/security_systemkeychain/security_systemkeychain-55202/src/.

上找到