1#!/bin/zsh
2
3test -x ${SECURITY:=~/build/security} || unset SECURITY
4SECURITY=${SECURITY?must specify the full path to the security command}
5TMPDIR=/tmp/smime-$$
6NAME=mb@apple.com
7
8mkdir $TMPDIR
9cd $TMPDIR
10
11$SECURITY cms -O -r $NAME -o content
12$SECURITY cms -D -i content -o /dev/null
13$SECURITY cms -D -h 0 -n -i content
14
15$SECURITY cms -S -N $NAME -Y NONE -i content -o signed
16$SECURITY cms -D -i signed -o signed.out
17$SECURITY cms -D -h 0 -n -i signed
18cmp content signed.out
19
20$SECURITY cms -S -N $NAME -Y NONE -G -i content -o signed+date
21$SECURITY cms -D -i signed+date -o signed+date.out
22$SECURITY cms -D -h 0 -n -i signed+date
23cmp content signed+date.out
24
25$SECURITY cms -S -N $NAME -G -P -i content -o signed+smime
26$SECURITY cms -D -i signed+smime -o signed+smime.out
27$SECURITY cms -D -h 0 -n -i signed+smime
28cmp content signed+smime.out
29
30$SECURITY cms -S -N $NAME -T -Y NONE -i content -o signed+detached
31$SECURITY cms -D -c content -i signed+detached -o signed+detached.out
32$SECURITY cms -D -h 0 -n -c content -i signed+detached
33cmp content signed+detached.out
34
35$SECURITY cms -S -N $NAME -T -G -P -i content -o signed+detached+smime
36$SECURITY cms -D -c content -i signed+detached+smime -o signed+detached+smime.out
37$SECURITY cms -D -h 0 -n -c content -i signed+detached+smime
38cmp content signed+detached+smime.out
39
40$SECURITY cms -E -r $NAME -i content -o encrypted
41$SECURITY cms -D -i encrypted -o encrypted.out
42$SECURITY cms -D -h 0 -n -i encrypted
43cmp content encrypted.out
44