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 Linux ) 56 ARCH=`uname -m` 57 case "$ARCH" in 58 i[3-6]86 ) 59 FS="/" 60 PS=":" 61 CP="${FS}bin${FS}cp" 62 CHMOD="${FS}bin${FS}chmod" 63 ;; 64 * ) 65 # ia64 ) 66 # x86_64 ) 67 echo "Unsupported System: Linux ${ARCH}" 68 exit 0; 69 ;; 70 esac 71 ;; 72 Windows* ) 73 FS="\\" 74 PS=";" 75 CP="cp" 76 CHMOD="chmod" 77 78 # 'uname -m' does not give us enough information - 79 # should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk), 80 # but JTREG does not pass this env variable when executing a shell script. 81 # 82 # execute test program - rely on it to exit if platform unsupported 83 84 ;; 85 * ) 86 echo "Unsupported System: ${OS}" 87 exit 0; 88 ;; 89 esac 90 91 # first make cert/key DBs writable 92 93 ${CP} ${TESTSRC}${FS}ClientAuthData${FS}cert8.db ${TESTCLASSES} 94 ${CHMOD} +w ${TESTCLASSES}${FS}cert8.db 95 96 ${CP} ${TESTSRC}${FS}ClientAuthData${FS}key3.db ${TESTCLASSES} 97 ${CHMOD} +w ${TESTCLASSES}${FS}key3.db 98 99 # compile test 100 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \ 101 -classpath ${TESTSRC} \ 102 -d ${TESTCLASSES} \ 103 ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \ 104 ${TESTSRC}${FS}ClientAuth.java \ 105 ${TESTSRC}${FS}..${FS}PKCS11Test.java 106 107 # run test 108 echo "Run ClientAuth TLSv1 ..." 109 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ 110 -classpath ${TESTCLASSES}${PS}${CPAPPEND} \ 111 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 112 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 113 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 114 -DNO_DEFAULT=true \ 115 -DNO_DEIMOS=true \ 116 -Dtest.src=${TESTSRC} \ 117 -Dtest.classes=${TESTCLASSES} \ 118 ClientAuth TLSv1 119 120 # save error status 121 status=$? 122 123 # return if failed 124 if [ "${status}" != "0" ] ; then 125 exit $status 126 fi 127 128 # run test 129 echo "Run ClientAuth TLSv1.1 ..." 130 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ 131 -classpath ${TESTCLASSES}${PS}${CPAPPEND} \ 132 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 133 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 134 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 135 -DNO_DEFAULT=true \ 136 -DNO_DEIMOS=true \ 137 -Dtest.src=${TESTSRC} \ 138 -Dtest.classes=${TESTCLASSES} \ 139 ClientAuth TLSv1.1 140 141 # save error status 142 status=$? 143 144 # return if failed 145 if [ "${status}" != "0" ] ; then 146 exit $status 147 fi 148 149 # run test with specified TLS protocol and cipher suite 150 echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA" 151 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ 152 -classpath ${TESTCLASSES}${PS}${CPAPPEND} \ 153 -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ 154 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 155 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \ 156 -DNO_DEFAULT=true \ 157 -DNO_DEIMOS=true \ 158 -Dtest.src=${TESTSRC} \ 159 -Dtest.classes=${TESTCLASSES} \ 160 ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA 161 162 # save error status 163 status=$? 164 165 # return 166 exit $status