crmf.sh (2804B)
1 #! /bin/bash 2 # 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 ######################################################################## 8 # 9 # mozilla/security/nss/tests/crmf/crmf.sh 10 # 11 # Script to test NSS crmf library (a static library) 12 # 13 # needs to work on all Unix and Windows platforms 14 # 15 # special strings 16 # --------------- 17 # FIXME ... known problems, search for this string 18 # NOTE .... unexpected behavior 19 # 20 ######################################################################## 21 22 ############################## smime_init ############################## 23 # local shell function to initialize this script 24 ######################################################################## 25 crmf_init() 26 { 27 SCRIPTNAME=crmf.sh # sourced - $0 would point to all.sh 28 29 if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for 30 CLEANUP="${SCRIPTNAME}" # cleaning this script will do it 31 fi 32 33 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then 34 cd ../common 35 . ./init.sh 36 fi 37 if [ ! -r $CERT_LOG_FILE ]; then # we need certificates here 38 cd ../cert 39 . ./cert.sh 40 fi 41 html_head "CRMF/CMMF Tests" 42 43 # cmrf uses the S/MIME certs to test with 44 grep "SUCCESS: SMIME passed" $CERT_LOG_FILE >/dev/null || { 45 Exit 11 "Fatal - S/MIME of cert.sh needs to pass first" 46 } 47 48 CRMFDIR=${HOSTDIR}/crmf 49 R_CRMFDIR=../crmf 50 mkdir -p ${CRMFDIR} 51 cd ${CRMFDIR} 52 } 53 54 ############################## crmf_main ############################## 55 # local shell function to test basic CRMF request and CMMF responses 56 # from 1 --> 2" 57 ######################################################################## 58 crmf_main() 59 { 60 echo "$SCRIPTNAME: CRMF/CMMF Tests ------------------------------" 61 echo "crmftest -d ${P_R_BOBDIR} -p Bob -e dave@example.com -s TestCA -P nss crmf decode" 62 ${BINDIR}/crmftest -d ${P_R_BOBDIR} -p Bob -e dave@example.com -s TestCA -P nss crmf decode 63 html_msg $? 0 "CRMF test" "." 64 65 echo "crmftest -d ${P_R_BOBDIR} -p Bob -e dave@example.com -s TestCA -P nss cmmf" 66 ${BINDIR}/crmftest -d ${P_R_BOBDIR} -p Bob -e dave@example.com -s TestCA -P nss cmmf 67 html_msg $? 0 "CMMF test" "." 68 69 # Add tests for key recovery and challange as crmftest's capabilities increase 70 71 } 72 73 ############################## crmf_cleanup ########################### 74 # local shell function to finish this script (no exit since it might be 75 # sourced) 76 ######################################################################## 77 crmf_cleanup() 78 { 79 html "</TABLE><BR>" 80 cd ${QADIR} 81 . common/cleanup.sh 82 } 83 84 ################## main ################################################# 85 86 crmf_init 87 crmf_main 88 crmf_cleanup