michael@0: #! /bin/bash michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ######################################################################## michael@0: # michael@0: # mozilla/security/nss/tests/crmf/crmf.sh michael@0: # michael@0: # Script to test NSS crmf library (a static library) michael@0: # michael@0: # needs to work on all Unix and Windows platforms michael@0: # michael@0: # special strings michael@0: # --------------- michael@0: # FIXME ... known problems, search for this string michael@0: # NOTE .... unexpected behavior michael@0: # michael@0: ######################################################################## michael@0: michael@0: ############################## smime_init ############################## michael@0: # local shell function to initialize this script michael@0: ######################################################################## michael@0: crmf_init() michael@0: { michael@0: SCRIPTNAME=crmf.sh # sourced - $0 would point to all.sh michael@0: michael@0: if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for michael@0: CLEANUP="${SCRIPTNAME}" # cleaning this script will do it michael@0: fi michael@0: michael@0: if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then michael@0: cd ../common michael@0: . ./init.sh michael@0: fi michael@0: if [ ! -r $CERT_LOG_FILE ]; then # we need certificates here michael@0: cd ../cert michael@0: . ./cert.sh michael@0: fi michael@0: html_head "CRMF/CMMF Tests" michael@0: michael@0: # cmrf uses the S/MIME certs to test with michael@0: grep "SUCCESS: SMIME passed" $CERT_LOG_FILE >/dev/null || { michael@0: Exit 11 "Fatal - S/MIME of cert.sh needs to pass first" michael@0: } michael@0: michael@0: CRMFDIR=${HOSTDIR}/crmf michael@0: R_CRMFDIR=../crmf michael@0: mkdir -p ${CRMFDIR} michael@0: cd ${CRMFDIR} michael@0: } michael@0: michael@0: ############################## crmf_main ############################## michael@0: # local shell function to test basic CRMF request and CMMF responses michael@0: # from 1 --> 2" michael@0: ######################################################################## michael@0: crmf_main() michael@0: { michael@0: echo "$SCRIPTNAME: CRMF/CMMF Tests ------------------------------" michael@0: echo "crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss crmf decode" michael@0: ${BINDIR}/crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss crmf decode michael@0: html_msg $? 0 "CRMF test" "." michael@0: michael@0: echo "crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss cmmf" michael@0: ${BINDIR}/crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss cmmf michael@0: html_msg $? 0 "CMMF test" "." michael@0: michael@0: # Add tests for key recovery and challange as crmftest's capabilities increase michael@0: michael@0: } michael@0: michael@0: ############################## crmf_cleanup ########################### michael@0: # local shell function to finish this script (no exit since it might be michael@0: # sourced) michael@0: ######################################################################## michael@0: crmf_cleanup() michael@0: { michael@0: html "
" michael@0: cd ${QADIR} michael@0: . common/cleanup.sh michael@0: } michael@0: michael@0: ################## main ################################################# michael@0: michael@0: crmf_init michael@0: crmf_main michael@0: crmf_cleanup michael@0: