]> git.saurik.com Git - apple/security.git/blame - SecurityTests/clxutils/importExport/importExportECDSA_P12
Security-57740.31.2.tar.gz
[apple/security.git] / SecurityTests / clxutils / importExport / importExportECDSA_P12
CommitLineData
d8f41ccd
A
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
25source setupCommon
26
27set ECDSA_SUBTOOL=./importExportECDSA_P12_Tool
28
29# user specified variables
30set QUIET=NO
31set QUIET_ARG=
32set NOCLEAN=NO
33set CLEAN=YES
34
35# user options
36
37while ( $#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
52end
53
54echo === Begin ECDSA/PKCS12 test ===
55
56# always unlock first
57set cmd="$SECURITY unlock -p $KEYCHAIN_PWD $KEYCHAIN"
58if ($QUIET == NO) then
59 echo $cmd
60endif
61$cmd || exit(1)
62
63set cmd="$ECDSA_SUBTOOL secp256r1ca.p12 $CLEAN $QUIET"
64if ($QUIET == NO) then
65 echo $cmd
66endif
67$cmd || exit(1)
68
69set cmd="$ECDSA_SUBTOOL secp384r1ca.p12 $CLEAN $QUIET"
70if ($QUIET == NO) then
71 echo $cmd
72endif
73$cmd || exit(1)
74
75set cmd="$ECDSA_SUBTOOL secp521r1ca.p12 $CLEAN $QUIET"
76if ($QUIET == NO) then
77 echo $cmd
78endif
79$cmd || exit(1)
80
81if ($QUIET == NO) then
82 echo === ECDSA/PKCS12 test complete ===
83endif
84