]>
git.saurik.com Git - apple/security.git/blob - OSX/codesign_tests/SignatureEditing.sh
6 t
=$(mktemp -d /tmp/cs-edit-XXXXXX)
12 echo "[BEGIN] ${test}"
15 "$@" > $t/outfile.txt
2>&1
17 [ $res != 0 ] && res
=1 #normalize
19 if expr "$test" : "fail" > /dev
/null
; then
25 ${v} cat $t/outfile.txt
26 if [ $res -eq $exp ]; then
40 codesign
=${codesign:-codesign}
50 runTest validate
-$name $codesign -v -R="anchor apple" -v "$target"
51 runTest dump
-cms-$name $codesign -d --dump-cms=$t/cms
"$target"
52 runTest edit
-nonsense-into-cms-$name $codesign -e "$target" --edit-cms /etc
/hosts
53 runTest fail
-nonsense-validation-$name $codesign -v -R="anchor apple" -v "$target"
54 runTest edit
-original-into-cms-$name $codesign -e "$target" --edit-cms $t/cms
55 runTest success
-cms-validation-$name $codesign -v -R="anchor apple" -v "$target"
56 runTest edit
-cat-cms-into-cms-$name $codesign -e "$target" --edit-cms $t/cat.cms
57 runTest fail
-cat-cms-validation-$name $codesign -v -R="anchor apple" -v "$target"
58 runTest edit
-original-again-into-cms-$name $codesign -e "$target" --edit-cms $t/cms
59 runTest success
-cms-validation-again-$name $codesign -v -R="anchor apple" -v "$target"
62 runTest dump
-cat-cms $codesign -d --dump-cms=$t/cat.cms
/bin
/cat
64 runTest prepare
-ls cp -R /bin
/ls $t/ls
66 runTest prepare
-TextEdit cp -R /Applications
/TextEdit.app
$t/TextEdit.app
67 editTest TextEdit
$t/TextEdit.app
69 runTest prepare
-codeless cp -R /var
/db
/gke.bundle
$t/gke.bundle
70 editTest codeless
$t/gke.bundle
72 runTest codesign
-remove-signature $codesign --remove $t/ls
73 runTest codesign
-omit-adhoc $codesign -s - -f --omit-adhoc-flag $t/ls
74 runTest adhoc
-omitted sh
-c "$codesign -d -v $t/ls 2>&1| grep -F 'flags=0x0(none)'"
78 if [ $fails != 0 ] ; then
79 echo "$fails signature edit tests failed"
82 echo "all signature edit tests passed"