尝试使用CoDesign命令沙盒时出错 [英] Error when trying to Sandbox with codesign command

查看:0
本文介绍了尝试使用CoDesign命令沙盒时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用codesign命令对我的OS X应用程序进行沙箱保护(这是一个常见的lisp应用程序,不使用Xcode)。我已经创建了一个非常基本的enitlements plist,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
    <dict>
        <key>com.apple.security.app-sandbox</key>
        <true/>
    </dict>
</plist>

我正在调用codesign命令:

codesign -s - -f --entitlements "/path/to/my/app/MyApp.app/Contents/entitlements.plist" "/path/to/my/app/MyApp.app/"

但此命令返回以下错误:

/path/to/my/app/MyApp.app/Contents/entitlements.plist: cannot read entitlement data

此错误是否意味着我使用了错误的命令?如果是,该命令有什么问题?

推荐答案

Xcode生成的PLIST是二进制格式,对于相当标准的有限沙盒设置如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.developer.ubiquity-container-identifiers</key>
    <array>
        <string>$(TeamIdentifierPrefix)com.company.appanme</string>
    </array>
    <key>com.apple.developer.ubiquity-kvstore-identifier</key>
    <string>$(TeamIdentifierPrefix)com.company.appname</string>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.assets.movies.read-only</key>
    <true/>
    <key>com.apple.security.assets.music.read-only</key>
    <true/>
    <key>com.apple.security.assets.pictures.read-only</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
    <key>com.apple.security.print</key>
    <true/>
    <key>com.apple.security.files.bookmarks.document-scope</key>
    <true/>
</dict>
</plist>

我所能建议的就是使用Xcode构造plist,并手动剥离那些您不想要的键。在你的情况下...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
</dict>
</plist>

我只是想知道签名工具是否出于某种原因需要!DOCTYPE元素,并且编码属性应该是大写的。

我还留下了几个键,即使如您所说,它是一个基本的LISP应用程序,也可能需要它们,特别是com.apple.security.files.user-selected.read-write键,它将允许您访问进程文件。

这篇关于尝试使用CoDesign命令沙盒时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆