3 # verify contents of /System/Library/Keychains/SystemCACertificates.keychain
5 set BUILD_DIR
=$LOCAL_BUILD_DIR
8 set CERT_KC
=/System
/Library
/Keychains
/SystemCACertificates.keychain
10 # the contents of SystemCACertificates gets dumped here as a pile of certs.
11 # We delete on successful exit, else we leave them there.
13 set CERTS_DIR
=$BUILD_DIR/intermediateCerts
17 set CERTCRL
=$BUILD_DIR/certcrl
18 set CERTS_FROM_DB
=$BUILD_DIR/certsFromDb
19 foreach targ
($CERTCRL $CERTS_FROM_DB)
21 echo === $targ is missing. Try building clxutil.
27 set TRUST_SETTINGS_ARG
=
36 set TRUST_SETTINGS_ARG
=-g
40 echo "Usage: intermedTest [q(uiet)] [t(rustSettings)]"
45 echo Starting intermedTest
47 if ($QUIET == NO
) then
48 echo Initializing
$CERTS_DIR...
50 set cmd
="rm -rf $CERTS_DIR"
51 if ($QUIET == NO
) then
55 set cmd
="mkdir -p $CERTS_DIR"
56 if ($QUIET == NO
) then
61 if ($QUIET == NO
) then
62 echo Extracting certs from
$CERT_KC...
===
64 set cmd
="$CERTS_FROM_DB $CERT_KC f $CERTS_DIR/intermed q"
65 if ($QUIET == NO
) then
73 # -s use system anchors
74 # -a allow certs unverified by CRLs
75 # -f leaf cert is a CA
77 # -g use Trust Settings
79 # We can also specify an evaluation date prior to the expiration of
80 # various intermediate certs via the EVAL_TIME string:
82 #set EVAL_TIME="-T 20081201000000"
83 #echo "### Verification date for intermedTest is 2008-12-01"
87 foreach certFile
($CERTS_DIR/*)
88 set cmd
="$CERTCRL -c $certFile -s -a -f -L $TRUST_SETTINGS_ARG $EVAL_TIME"
89 if ($QUIET == NO
) then
93 set CERTNAM
=`basename "$certFile"`
94 set CERTNUM
=`echo -n "$CERTNAM" | sed -e 's/^intermed_\([0-9].*\)/\1/g'`
95 # skip DOD intermediates in this range as AIA fetch is timing out!
96 if($CERTNUM > 43 && $CERTNUM < 54) then
97 echo "******** Note: skipping $CERTNAM due to unreachable AIA location"
105 echo "******** Note: $CERTNAM is expired"
108 echo "++++++++ Verification error on $CERTNAM"
109 $CERTCRL -c $certFile -s -a -f -v
115 if($GOT_ERROR == 1) then
116 echo ++++ TEST FAILED
++++
120 set cmd
="rm -rf $CERTS_DIR"
121 if ($QUIET == NO
) then
126 if ($QUIET == NO
) then
127 echo "...intermedTest complete"