security/nss/tests/crmf/crmf.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial