security/nss/tests/crmf/crmf.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/tests/crmf/crmf.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,89 @@
     1.4 +#! /bin/bash  
     1.5 +#
     1.6 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +
    1.10 +########################################################################
    1.11 +#
    1.12 +# mozilla/security/nss/tests/crmf/crmf.sh
    1.13 +#
    1.14 +# Script to test NSS crmf library (a static library) 
    1.15 +#
    1.16 +# needs to work on all Unix and Windows platforms
    1.17 +#
    1.18 +# special strings
    1.19 +# ---------------
    1.20 +#   FIXME ... known problems, search for this string
    1.21 +#   NOTE .... unexpected behavior
    1.22 +#
    1.23 +########################################################################
    1.24 +
    1.25 +############################## smime_init ##############################
    1.26 +# local shell function to initialize this script
    1.27 +########################################################################
    1.28 +crmf_init()
    1.29 +{
    1.30 +  SCRIPTNAME=crmf.sh      # sourced - $0 would point to all.sh
    1.31 +
    1.32 +  if [ -z "${CLEANUP}" ] ; then     # if nobody else is responsible for
    1.33 +      CLEANUP="${SCRIPTNAME}"       # cleaning this script will do it
    1.34 +  fi
    1.35 +
    1.36 +  if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
    1.37 +      cd ../common
    1.38 +      . ./init.sh
    1.39 +  fi
    1.40 +  if [ ! -r $CERT_LOG_FILE ]; then  # we need certificates here
    1.41 +      cd ../cert
    1.42 +      . ./cert.sh
    1.43 +  fi
    1.44 +  html_head "CRMF/CMMF Tests"
    1.45 +
    1.46 +  # cmrf uses the S/MIME certs to test with
    1.47 +  grep "SUCCESS: SMIME passed" $CERT_LOG_FILE >/dev/null || {
    1.48 +      Exit 11 "Fatal - S/MIME of cert.sh needs to pass first"
    1.49 +  }
    1.50 +
    1.51 +  CRMFDIR=${HOSTDIR}/crmf
    1.52 +  R_CRMFDIR=../crmf
    1.53 +  mkdir -p ${CRMFDIR}
    1.54 +  cd ${CRMFDIR}
    1.55 +}
    1.56 +
    1.57 +############################## crmf_main ##############################
    1.58 +# local shell function to test basic CRMF request and CMMF responses
    1.59 +# from 1 --> 2"
    1.60 +########################################################################
    1.61 +crmf_main()
    1.62 +{
    1.63 +  echo "$SCRIPTNAME: CRMF/CMMF Tests ------------------------------"
    1.64 +  echo "crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss crmf decode"
    1.65 +  ${BINDIR}/crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss crmf decode
    1.66 +  html_msg $? 0 "CRMF test" "."
    1.67 +
    1.68 +  echo "crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss cmmf"
    1.69 +  ${BINDIR}/crmftest -d ${P_R_BOBDIR} -p Bob -e dave@bogus.com -s TestCA -P nss cmmf 
    1.70 +  html_msg $? 0 "CMMF test" "."
    1.71 +
    1.72 +# Add tests for key recovery and challange as crmftest's capabilities increase
    1.73 +
    1.74 +}
    1.75 +  
    1.76 +############################## crmf_cleanup ###########################
    1.77 +# local shell function to finish this script (no exit since it might be
    1.78 +# sourced)
    1.79 +########################################################################
    1.80 +crmf_cleanup()
    1.81 +{
    1.82 +  html "</TABLE><BR>"
    1.83 +  cd ${QADIR}
    1.84 +  . common/cleanup.sh
    1.85 +}
    1.86 +
    1.87 +################## main #################################################
    1.88 +
    1.89 +crmf_init
    1.90 +crmf_main
    1.91 +crmf_cleanup
    1.92 +

mercurial