]> git.saurik.com Git - apple/security.git/blame - SecurityTests/clxutils/newCmsTool/blobs/cmsEcdsaHandsoff
Security-57740.31.2.tar.gz
[apple/security.git] / SecurityTests / clxutils / newCmsTool / blobs / cmsEcdsaHandsoff
CommitLineData
d8f41ccd
A
1#! /bin/csh -f
2#
3# Run cmstest, handsoff, any user, any environment, ECDSA version.
4# This uses a keychain we have right here for this purpose. It's insecure - we
5# know its passphrase and use it here in the clear to unlock - and its private
6# keys have wide-open ACLs to avoid UI. We use the root used to generate the
7# certs in that keychain in the -A option to newCmsTool.
8#
9# To get identities with no ACLs, create them in the usual way (I do it with
10# the Cert app), export them in p12 form, delete from the keychain, and import
11# like this:
12#
13# % kcImport user3.p12 -z password -f pkcs12 -n -k ecdsaCmsKeychain.keychain
14#
15# We copy the test's keychain to ${BUILD_DIR}/ecdsaCmsKeychain.keychain just to keep the UI spew to
16# a minimum.
17#
18
19#
20# safely look for this required env var
21#
22setenv | /usr/bin/grep LOCAL_BUILD_DIR > /dev/null
23if($status != 0) then
24 echo Please set env var LOCAL_BUILD_DIR.
25 exit(1)
26endif
27set BUILD_DIR=$LOCAL_BUILD_DIR
28
29set TESTDIR=`pwd`
30set CMS_KEYCHAIN_SRC=ecdsaCmsKeychain.keychain
31set CMS_KEYCHAIN_DST=${BUILD_DIR}/ecdsaCmsKeychain.keychain
32set CMS_KEYCHAIN_PASSWORD=password
33set CMS_KEYCHAIN_ROOT=cmsEcdsaRoot.cer
34set USER1=user3@debug.apple.com
35set USER2=user4@debug.apple.com
36set QUIET=
37set OUR_QUIET=NO
38
39while ( $#argv > 0 )
40 switch ( "$argv[1]" )
41 case -q:
42 set QUIET="-q"
43 set OUR_QUIET=YES
44 shift
45 breaksw
46 default:
47 echo "Usage: cmstestHandsoff [-q(uiet)]"
48 exit(1)
49 endsw
50end
51
52echo Starting cmsEcdsaHandsoff
53
54set cmd="cp $CMS_KEYCHAIN_SRC $CMS_KEYCHAIN_DST"
55if($OUR_QUIET == NO) then
56 echo $cmd
57endif
58# ignore errors here...we'll soon fail if this does
59$cmd
60
61set cmd="/usr/bin/security unlock -p $CMS_KEYCHAIN_PASSWORD $CMS_KEYCHAIN_DST"
62if($OUR_QUIET == NO) then
63 echo $cmd
64endif
65$cmd || exit(1)
66
67set cmd="./cmstest -s $USER1 -S $USER2 -k $CMS_KEYCHAIN_DST -a $CMS_KEYCHAIN_ROOT $QUIET"
68if($OUR_QUIET == NO) then
69 echo $cmd
70endif
71$cmd || exit(1)
72
73# and try to be nice
74set cmd="rm $CMS_KEYCHAIN_DST"
75if($OUR_QUIET == NO) then
76 echo $cmd
77endif
78$cmd || exit(1)
79
80if($OUR_QUIET == NO) then
81 echo === cmsEcdsaHandsoff Succeeded ===
82endif
83