1 # 2 # Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 24 # @test 25 # @bug 4938185 7106773 26 # @summary KeyStore support for NSS cert/key databases 27 # 512 bits RSA key cannot work with SHA384 and SHA512 28 # @library /test/lib 29 # @run shell ClientAuth.sh 30 31 # set a few environment variables so that the shell-script can run stand-alone 32 # in the source directory 33 34 if [ "${TESTSRC}" = "" ] ; then 35 TESTSRC=`pwd` 36 fi 37 if [ "${TESTCLASSES}" = "" ] ; then 38 TESTCLASSES=`pwd` 39 fi 40 if [ "${TESTJAVA}" = "" ] ; then 41 TESTJAVA="/net/radiant/export1/charlie/mustang/build/solaris-sparc" 42 fi 43 if [ "${COMPILEJAVA}" = "" ]; then 44 COMPILEJAVA="${TESTJAVA}" 45 fi 46 echo TESTSRC=${TESTSRC} 47 echo TESTCLASSES=${TESTCLASSES} 48 echo TESTJAVA=${TESTJAVA} 49 echo COMPILEJAVA=${COMPILEJAVA} 50 echo CPAPPEND=${CPAPPEND} 51 echo "" 52 53 OS=`uname -s` 54 case "$OS" in 55 SunOS ) 56 ARCH=`isainfo` 57 case "$ARCH" in 58 sparc* ) 59 FS="/" 60 PS=":" 61 CP="${FS}bin${FS}cp" 62 CHMOD="${FS}bin${FS}chmod" 63 ;; 64 i[3-6]86 ) 65 FS="/" 66 PS=":" 67 CP="${FS}bin${FS}cp" 68 CHMOD="${FS}bin${FS}chmod" 69 ;; 70 amd64* ) 71 FS="/" 72 PS=":" 73 CP="${FS}bin${FS}cp" 74 CHMOD="${FS}bin${FS}chmod" 75 ;; 76 * ) 77 # ?itanium? ) 78 # amd64* ) 79 echo "Unsupported System: Solaris ${ARCH}" 80 exit 0; 81 ;; 82 esac 83 ;; 84 Linux ) 85 ARCH=`uname -m` 86 case "$ARCH" in 87 i[3-6]86 ) 88 FS="/" 89 PS=":" 90 CP="${FS}bin${FS}cp" 91 CHMOD="${FS}bin${FS}chmod" 92 ;; 93 * ) 94 # ia64 ) 95 # x86_64 ) 96 echo "Unsupported System: Linux ${ARCH}" 97 exit 0; 98 ;; 99 esac 100 ;; 101 Windows* ) 102 FS="\\" 103 PS=";" 104 CP="cp" 105 CHMOD="chmod" 106 107 # 'uname -m' does not give us enough information - 108 # should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk), 109 # but JTREG does not pass this env variable when executing a shell script. 110 # 111 # execute test program - rely on it to exit if platform unsupported 112 113 ;; 114 * ) 115 echo "Unsupported System: ${OS}" 116 exit 0; 117 ;; 118 esac 119 120 # first make cert/key DBs writable 121 122 ${CP} ${TESTSRC}${FS}ClientAuthData${FS}cert8.db ${TESTCLASSES} 123 ${CHMOD} +w ${TESTCLASSES}${FS}cert8.db 124 125 ${CP} ${TESTSRC}${FS}ClientAuthData${FS}key3.db ${TESTCLASSES} 126 ${CHMOD} +w ${TESTCLASSES}${FS}key3.db 127 128 # compile test 129 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \ 130 -classpath ${TESTSRC} \ 131 -d ${TESTCLASSES} \ 132 ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \ 133 ${TESTSRC}${FS}ClientAuth.java \ 134 ${TESTSRC}${FS}..${FS}PKCS11Test.java 135 136 # run test 137 echo "Run ClientAuth TLSv1 ..." 138 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ 139 -classpath ${TESTCLASSES}${PS}${CPAPPEND} \ 140 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 141 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 142 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 143 -DNO_DEFAULT=true \ 144 -DNO_DEIMOS=true \ 145 -Dtest.src=${TESTSRC} \ 146 -Dtest.classes=${TESTCLASSES} \ 147 ClientAuth TLSv1 148 149 # save error status 150 status=$? 151 152 # return if failed 153 if [ "${status}" != "0" ] ; then 154 exit $status 155 fi 156 157 # run test 158 echo "Run ClientAuth TLSv1.1 ..." 159 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ 160 -classpath ${TESTCLASSES}${PS}${CPAPPEND} \ 161 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 162 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 163 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 164 -DNO_DEFAULT=true \ 165 -DNO_DEIMOS=true \ 166 -Dtest.src=${TESTSRC} \ 167 -Dtest.classes=${TESTCLASSES} \ 168 ClientAuth TLSv1.1 169 170 # save error status 171 status=$? 172 173 # return if failed 174 if [ "${status}" != "0" ] ; then 175 exit $status 176 fi 177 178 # run test with specified TLS protocol and cipher suite 179 echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA" 180 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ 181 -classpath ${TESTCLASSES}${PS}${CPAPPEND} \ 182 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 183 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 184 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 185 -DNO_DEFAULT=true \ 186 -DNO_DEIMOS=true \ 187 -Dtest.src=${TESTSRC} \ 188 -Dtest.classes=${TESTCLASSES} \ 189 ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA 190 191 # save error status 192 status=$? 193 194 # return 195 exit $status