]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/signerAndSubjTp/makeSmimeCert
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / clxutils / signerAndSubjTp / makeSmimeCert
1 #! /bin/csh -f
2 #
3 # Make S/MIME cert and a root that signs it. Import the subject cert and
4 # its private key into keychain specified by argv[2]. Email address
5 # of subject cert specified in argv[1]. Root cert written to ssRootCert.cer.
6 # which should be imported into the system root DB via KCA.
7 #
8 if( $#argv != 2 ) then
9 echo Usage: makeSmimeCert emailAddrs keychain
10 exit(1)
11 endif
12 #
13 #
14 # const names shared with signerAndSubjTp
15 set subjCertFile=ssSubjCert.cer
16 set subjKeyFile=ssSubjKey.der
17 set rootCertFile=ssRootCert.cer
18 #
19 # args from command line
20 #
21 set emailAddr=$argv[1]
22 set kcName=$argv[2]
23 #
24 #
25 #
26 echo creating certs and keys...
27 set cmd="signerAndSubjTp w e=$emailAddr"
28 echo $cmd
29 $cmd || exit(1)
30 #
31 echo Importing subject cert and private key into $kcName...
32 set cmd="certtool i $subjCertFile k=$kcName r=$subjKeyFile f=8 d"
33 echo $cmd
34 $cmd || exit(1)
35 #
36 echo === Complete ===
37 echo Remember to import $rootCertFile into X509Anchors.
38