]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/importExport/importExportECDSA_P12
Security-57031.10.10.tar.gz
[apple/security.git] / SecurityTests / clxutils / importExport / importExportECDSA_P12
1 #! /bin/csh -f
2 #
3 # Run ECDSA/PKCS12 import/export tests.
4 #
5 # Run this from SecurityTests/clxutils/importExport. The
6 # kcImport and kcExport programs must exist in the location
7 # specified by the LOCAL_BUILD_DIR env var.
8 #
9 # For this test we do the following for each of 3 PFX files created
10 # by openssl and obtained from:
11 #
12 # http://dev.experimentalstuff.com:8082/pkcs12/
13 #
14 # The three PFX files contain root certs and the keys that signed them.
15 #
16 # unlock and clear the keychain;
17 # import the P12;
18 # export the imported private key in the clear;
19 # export the cert;
20 # extract the public key from the cert;
21 # sign using exported private key;
22 # verify using the public key;
23 #
24
25 source setupCommon
26
27 set ECDSA_SUBTOOL=./importExportECDSA_P12_Tool
28
29 # user specified variables
30 set QUIET=NO
31 set QUIET_ARG=
32 set NOCLEAN=NO
33 set CLEAN=YES
34
35 # user options
36
37 while ( $#argv > 0 )
38 switch ( "$argv[1]" )
39 case q:
40 set QUIET=YES
41 set QUIET_ARG=-q
42 shift
43 breaksw
44 case N:
45 set CLEAN=NO
46 shift
47 breaksw
48 default:
49 echo Usage: importExportECDSA_P12 \[q\(uiet\)\] \[N\(oClean\)\]
50 exit(1)
51 endsw
52 end
53
54 echo === Begin ECDSA/PKCS12 test ===
55
56 # always unlock first
57 set cmd="$SECURITY unlock -p $KEYCHAIN_PWD $KEYCHAIN"
58 if ($QUIET == NO) then
59 echo $cmd
60 endif
61 $cmd || exit(1)
62
63 set cmd="$ECDSA_SUBTOOL secp256r1ca.p12 $CLEAN $QUIET"
64 if ($QUIET == NO) then
65 echo $cmd
66 endif
67 $cmd || exit(1)
68
69 set cmd="$ECDSA_SUBTOOL secp384r1ca.p12 $CLEAN $QUIET"
70 if ($QUIET == NO) then
71 echo $cmd
72 endif
73 $cmd || exit(1)
74
75 set cmd="$ECDSA_SUBTOOL secp521r1ca.p12 $CLEAN $QUIET"
76 if ($QUIET == NO) then
77 echo $cmd
78 endif
79 $cmd || exit(1)
80
81 if ($QUIET == NO) then
82 echo === ECDSA/PKCS12 test complete ===
83 endif
84