NAME=entitlements mach with iC
FILE=bins/mach0/AppIOSEntitlements.ios
CMDS=iC
EXPECT=<<EOF
<?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.application-identifier</key>
        <string>9JTH7AWHE6.com.bot.r2ftw</string>
        <key>com.apple.developer.aps-environment</key>
        <string>production</string>
        <key>com.apple.developer.icloud-container-environment</key>
        <string>Production</string>
        <key>com.apple.developer.icloud-container-identifiers</key>
        <array>
                <string>iCloud.com.bot.r2ftw</string>
        </array>
        <key>com.apple.developer.icloud-services</key>
        <array>
                <string>CloudKit</string>
        </array>
        <key>com.apple.developer.team-identifier</key>
        <string>9JTH7AWHE6</string>
        <key>com.apple.developer.ubiquity-kvstore-identifier</key>
        <string>9JTH7AWHE6.com.bot.r2ftw</string>
        <key>com.apple.security.app-sandbox</key>
        <true/>
        <key>com.apple.security.files.downloads.read-write</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.personal-information.location</key>
        <true/>
</dict>
</plist>

EOF
RUN

NAME=entitlements with rabin2
FILE=bins/mach0/AppIOSEntitlements.ios
ARGS=-a x86
CMDS=!rabin2 -OC `i~file:0[1]`
EXPECT=<<EOF
<?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.application-identifier</key>
        <string>9JTH7AWHE6.com.bot.r2ftw</string>
        <key>com.apple.developer.aps-environment</key>
        <string>production</string>
        <key>com.apple.developer.icloud-container-environment</key>
        <string>Production</string>
        <key>com.apple.developer.icloud-container-identifiers</key>
        <array>
                <string>iCloud.com.bot.r2ftw</string>
        </array>
        <key>com.apple.developer.icloud-services</key>
        <array>
                <string>CloudKit</string>
        </array>
        <key>com.apple.developer.team-identifier</key>
        <string>9JTH7AWHE6</string>
        <key>com.apple.developer.ubiquity-kvstore-identifier</key>
        <string>9JTH7AWHE6.com.bot.r2ftw</string>
        <key>com.apple.security.app-sandbox</key>
        <true/>
        <key>com.apple.security.files.downloads.read-write</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.personal-information.location</key>
        <true/>
</dict>
</plist>

EOF
RUN

NAME=DER entitlements mach with iC
FILE=bins/mach0/MASTestApp
CMDS=iC
EXPECT=<<EOF
<?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>application-identifier</key>
	<string>D4WYSK5293.org.owasp.mastestapp.MASTestApp-iOS</string>
	<key>com.apple.developer.team-identifier</key>
	<string>D4WYSK5293</string>
	<key>get-task-allow</key>
	<true/>
</dict>
</plist>

;; DER entitlements (slot 7, magic 0xfade7172)
  OFFSET  HDR +    OBJ DEPTH FORM NAME                : VALUE
       0  0x3 +   0x98     0 cons Application_16      : 30
     0x3  0x2 +    0x1     1 prim INTEGER             : 01
     0x6  0x3 +   0x92     1 cons Context [16]        : 30
     0x9  0x2 +   0x48     2 cons SEQUENCE            : 30
     0xb  0x2 +   0x16     3 prim UTF8String          : application-identifier
    0x23  0x2 +   0x2e     3 prim UTF8String          : D4WYSK5293.org.owasp.mastestapp.MASTestApp-iOS
    0x53  0x2 +   0x31     2 cons SEQUENCE            : 30
    0x55  0x2 +   0x23     3 prim UTF8String          : com.apple.developer.team-identifier
    0x7a  0x2 +    0xa     3 prim UTF8String          : D4WYSK5293
    0x86  0x2 +   0x13     2 cons SEQUENCE            : 30
    0x88  0x2 +    0xe     3 prim UTF8String          : get-task-allow
    0x98  0x2 +    0x1     3 prim BOOLEAN             : true

EOF
RUN
