nss: import at 3.0.1 beta 1
[mozilla-nss.git] / security / nss / tests / sdr / sdr.sh
blobad02a104482b47de714bde9e4fe419e99d70600b
1 #! /bin/sh
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
16 # The Original Code is the Netscape security libraries.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1994-2000
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
39 ########################################################################
41 # mozilla/security/nss/tests/sdr/sdr.sh
43 # Script to start test basic functionallity of NSS sdr
45 # needs to work on all Unix and Windows platforms
47 # special strings
48 # ---------------
49 # FIXME ... known problems, search for this string
50 # NOTE .... unexpected behavior
52 ########################################################################
54 ############################## sdr_init ################################
55 # local shell function to initialize this script
56 ########################################################################
57 sdr_init()
59 SCRIPTNAME=sdr.sh
60 if [ -z "${CLEANUP}" ] ; then
61 CLEANUP="${SCRIPTNAME}"
64 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
65 cd ../common
66 . ./init.sh
68 SCRIPTNAME=sdr.sh
70 #temporary files
71 VALUE1=$HOSTDIR/tests.v1.$$
72 VALUE2=$HOSTDIR/tests.v2.$$
74 T1="Test1"
75 T2="The quick brown fox jumped over the lazy dog"
77 SDRDIR=${HOSTDIR}/SDR
78 D_SDR="SDR.$version"
79 if [ ! -d ${SDRDIR} ]; then
80 mkdir -p ${SDRDIR}
83 PROFILE=.
84 if [ -n "${MULTIACCESS_DBM}" ]; then
85 PROFILE="multiaccess:${D_SDR}"
88 cd ${SDRDIR}
89 html_head "SDR Tests"
92 ############################## sdr_main ################################
93 # local shell function to test NSS SDR
94 ########################################################################
95 sdr_main()
97 echo "$SCRIPTNAME: Creating an SDR key/Encrypt"
98 echo "sdrtest -d ${PROFILE} -o ${VALUE1} -t Test1"
99 ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE1} -t Test1
100 html_msg $? 0 "Creating SDR Key"
102 echo "$SCRIPTNAME: SDR Encrypt - Second Value"
103 echo "sdrtest -d ${PROFILE} -o ${VALUE2} -t '${T2}'"
104 ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE2} -t "${T2}"
105 html_msg $? 0 "Encrypt - Value 2"
107 echo "$SCRIPTNAME: Decrypt - Value 1"
108 echo "sdrtest -d ${PROFILE} -i ${VALUE1} -t Test1"
109 ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE1} -t Test1
110 html_msg $? 0 "Decrypt - Value 1"
112 echo "$SCRIPTNAME: Decrypt - Value 2"
113 echo "sdrtest -d ${PROFILE} -i ${VALUE2} -t ${T2}"
114 ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE2} -t "${T2}"
115 html_msg $? 0 "Decrypt - Value 2"
118 ############################## sdr_cleanup #############################
119 # local shell function to finish this script (no exit since it might be
120 # sourced)
121 ########################################################################
122 sdr_cleanup()
124 html "</TABLE><BR>"
125 cd ${QADIR}
126 . common/cleanup.sh
129 sdr_init
130 sdr_main
131 sdr_cleanup